diff --git a/buf.gen.yaml b/buf.gen.yaml index ee348e663..dc42faba8 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,5 +1,14 @@ version: v2 clean: true +# Packages still under active design are excluded from codegen so their shape +# can churn without dragging the Rust workspace along. They stay in the module, +# so `buf format`, `buf lint`, `buf build`, and `buf breaking` still cover them. +# Removing a path here is what promotes a package into the generated crate. +inputs: + - directory: . + exclude_paths: + - proto/trogonai/session + - proto/trogonai/usage plugins: - local: protoc-gen-buffa out: rsworkspace/crates/platform/trogonai-proto/src/gen diff --git a/rsworkspace/Cargo.lock b/rsworkspace/Cargo.lock index f123829f0..1df661582 100644 --- a/rsworkspace/Cargo.lock +++ b/rsworkspace/Cargo.lock @@ -7340,7 +7340,6 @@ dependencies = [ "buffa-types", "chrono", "serde", - "serde_json", "thiserror 2.0.19", "trogon-decider", "trogon-decider-runtime", diff --git a/rsworkspace/crates/mcp/mcp-nats-server/src/runtime/tests.rs b/rsworkspace/crates/mcp/mcp-nats-server/src/runtime/tests.rs index c0321b289..760dc9b6e 100644 --- a/rsworkspace/crates/mcp/mcp-nats-server/src/runtime/tests.rs +++ b/rsworkspace/crates/mcp/mcp-nats-server/src/runtime/tests.rs @@ -545,3 +545,98 @@ fn custom_request_extensions_restore_meta_and_allowlisted_http_headers() { let request = serde_json::to_value(request).unwrap(); assert_eq!(request["params"]["_meta"]["test.marker"], "preserved"); } + +#[derive(Clone)] +struct NoopServerHandler; + +impl ServerHandler for NoopServerHandler {} + +#[tokio::test] +async fn proxy_worker_times_out_pending_requests_that_never_get_a_response() { + let nats = trogon_nats::AdvancedMockNatsClient::new(); + let _inbound = nats.inject_messages(); + let mismatched = ServerJsonRpcMessage::response( + ServerResult::InitializeResult( + InitializeResult::new(ServerCapabilities::default()) + .with_server_info(Implementation::new("remote-server", "1.0.0")), + ), + NumberOrString::Number(99), + ); + let encoded = wire::encode_tx::(&mismatched).unwrap(); + nats.set_response_wire("mcp.v1.server.default.initialize", encoded.headers, encoded.body); + + let (_http_side, handler_side) = tokio::io::duplex(1024); + let running = rmcp::service::serve_directly(NoopServerHandler, handler_side, None); + let peer = running.peer().clone(); + + let (command_tx, command_rx) = mpsc::channel(1); + let worker = tokio::spawn(run_proxy_worker( + nats, + mcp_config().with_operation_timeout(Duration::from_millis(150)), + McpPeerId::new("http-test").unwrap(), + McpPeerId::new("default").unwrap(), + command_rx, + )); + + let JsonRpcMessage::Request(request) = initialize_request() else { + panic!("expected initialize request"); + }; + let (response_tx, response_rx) = oneshot::channel(); + command_tx + .send(ProxyCommand::Request { + request: Box::new(request.request), + request_id: RequestId::Number(1), + peer, + response_tx, + }) + .await + .unwrap(); + + let delivered = response_rx.await.unwrap(); + assert_eq!( + delivered.unwrap_err().message.as_ref(), + "MCP NATS proxy timed out waiting for a response" + ); + + drop(command_tx); + worker.await.unwrap(); +} + +#[tokio::test] +async fn evict_expired_pending_keeps_requests_that_are_still_within_their_deadline() { + let (expired_tx, expired_rx) = oneshot::channel(); + let (live_tx, _live_rx) = oneshot::channel(); + let mut pending: HashMap = HashMap::new(); + pending.insert( + RequestId::Number(1), + PendingEntry { + response_tx: expired_tx, + deadline: Instant::now(), + }, + ); + pending.insert( + RequestId::Number(2), + PendingEntry { + response_tx: live_tx, + deadline: Instant::now() + Duration::from_secs(60), + }, + ); + + evict_expired_pending(&mut pending); + + assert_eq!(pending.len(), 1); + assert!(pending.contains_key(&RequestId::Number(2))); + assert_eq!( + expired_rx.await.unwrap().unwrap_err().message.as_ref(), + "MCP NATS proxy timed out waiting for a response" + ); +} + +#[tokio::test] +async fn wait_for_deadline_never_resolves_without_a_pending_deadline() { + assert!( + tokio::time::timeout(Duration::from_millis(20), wait_for_deadline(None)) + .await + .is_err() + ); +} diff --git a/rsworkspace/crates/platform/trogonai-proto/Cargo.toml b/rsworkspace/crates/platform/trogonai-proto/Cargo.toml index a20058b89..e60011fc1 100644 --- a/rsworkspace/crates/platform/trogonai-proto/Cargo.toml +++ b/rsworkspace/crates/platform/trogonai-proto/Cargo.toml @@ -12,7 +12,6 @@ workspace = true default = [] chrono = ["dep:buffa-types", "dep:chrono"] schedules = ["dep:buffa", "dep:buffa-types", "dep:serde", "dep:trogon-decider", "chrono"] -sessions = ["dep:buffa", "dep:buffa-types", "dep:serde", "dep:serde_json", "dep:trogon-decider", "chrono"] runtime-snapshot = ["schedules", "dep:trogon-decider-runtime"] runtime-host = ["schedules", "dep:trogon-decider-runtime"] agents = ["dep:buffa", "dep:buffa-types", "dep:serde", "dep:trogon-decider"] @@ -24,6 +23,5 @@ buffa = { workspace = true, optional = true } buffa-types = { workspace = true, optional = true } chrono = { version = "0.4", optional = true, default-features = false, features = ["std"] } serde = { workspace = true, optional = true } -serde_json = { workspace = true, optional = true } trogon-decider = { version = "0.1.0", path = "../../decider/trogon-decider", optional = true } trogon-decider-runtime = { workspace = true, optional = true } diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/mod.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/mod.rs index 5c39389e5..b15991add 100644 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/mod.rs +++ b/rsworkspace/crates/platform/trogonai-proto/src/gen/mod.rs @@ -400,293 +400,4 @@ pub mod trogonai { } } } - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod session { - use super::*; - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod sessions { - use super::*; - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod artifacts { - use super::*; - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod v1alpha1 { - use super::*; - include!("trogonai.session.sessions.artifacts.v1alpha1.mod.rs"); - } - } - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod diff { - use super::*; - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod v1alpha1 { - use super::*; - include!("trogonai.session.sessions.diff.v1alpha1.mod.rs"); - } - } - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod doctor { - use super::*; - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod v1alpha1 { - use super::*; - include!("trogonai.session.sessions.doctor.v1alpha1.mod.rs"); - } - } - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod maintenance { - use super::*; - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod v1alpha1 { - use super::*; - include!("trogonai.session.sessions.maintenance.v1alpha1.mod.rs"); - } - } - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod queries { - use super::*; - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod v1alpha1 { - use super::*; - include!("trogonai.session.sessions.queries.v1alpha1.mod.rs"); - } - } - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod replay { - use super::*; - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod v1alpha1 { - use super::*; - include!("trogonai.session.sessions.replay.v1alpha1.mod.rs"); - } - } - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod state { - use super::*; - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod v1alpha1 { - use super::*; - include!("trogonai.session.sessions.state.v1alpha1.mod.rs"); - } - } - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod v1alpha1 { - use super::*; - include!("trogonai.session.sessions.v1alpha1.mod.rs"); - } - } - } - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod usage { - use super::*; - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod settlement { - use super::*; - #[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception - )] - pub mod v1alpha1 { - use super::*; - include!("trogonai.usage.settlement.v1alpha1.mod.rs"); - } - } - } } diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.artifact_error.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.artifact_error.__view.rs deleted file mode 100644 index 70081d05a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.artifact_error.__view.rs +++ /dev/null @@ -1,291 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/artifacts/v1alpha1/artifact_error.proto - -/// ArtifactError is the failure shape for the artifact read contract. -/// -/// Only failures to answer belong here. An artifact that is erased, missing, -/// corrupt, or hidden is an answer, carried as ArtifactAvailability on a -/// successful response, because it is a fact about the artifact the caller -/// asked about. Reporting it as an error would make "what happened to this -/// artifact" indistinguishable from "the read contract is broken" at exactly -/// the moment an operator needs to tell them apart. -#[derive(Clone, Debug, Default)] -pub struct ArtifactErrorView<'a> { - /// Field 1: `code` - pub code: ::buffa::EnumValue, - /// Field 2: `message` - pub message: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ArtifactErrorView<'a> { - /**Whether required field `code` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_code(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `message` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ArtifactErrorView<'a> { - type Owned = super::super::ArtifactError; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.code = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.message = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ArtifactError { - code: self.code, - message: self.message.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ArtifactErrorView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.code.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.message) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.code.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.message, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ArtifactErrorView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("code", &self.code)?; - } - { - __map.serialize_entry("message", self.message)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ArtifactErrorView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "ArtifactError"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.ArtifactError"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ArtifactError"; -} -::buffa::impl_default_view_instance!(ArtifactErrorView); -::buffa::impl_view_reborrow!(ArtifactErrorView); -/** Self-contained, `'static` owned view of a `ArtifactError` message. - - Wraps [`::buffa::OwnedView`]`<`[`ArtifactErrorView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ArtifactErrorView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ArtifactErrorOwnedView(::buffa::OwnedView>); -impl ArtifactErrorOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactErrorOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactErrorOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ArtifactError, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactErrorOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ArtifactErrorView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ArtifactErrorView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ArtifactError { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `code` - #[must_use] - pub fn code(&self) -> ::buffa::EnumValue { - self.0.reborrow().code - } - /// Field 2: `message` - #[must_use] - pub fn message(&self) -> &'_ str { - self.0.reborrow().message - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ArtifactErrorOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ArtifactErrorOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ArtifactErrorOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ArtifactErrorOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ArtifactError { - type View<'a> = ArtifactErrorView<'a>; - type ViewHandle = ArtifactErrorOwnedView; -} -impl ::serde::Serialize for ArtifactErrorOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.artifact_error.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.artifact_error.rs deleted file mode 100644 index 36b44d7e3..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.artifact_error.rs +++ /dev/null @@ -1,376 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/artifacts/v1alpha1/artifact_error.proto - -/// ArtifactErrorCode is why the request could not be answered. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ArtifactErrorCode { - ARTIFACT_ERROR_CODE_UNSPECIFIED = 0i32, - /// No such session, or the caller may not see it. Deliberately one code, and - /// deliberately not distinguished from permission denial, so that probing - /// cannot use the difference to prove a session exists. - ARTIFACT_ERROR_CODE_SESSION_NOT_FOUND = 1i32, - /// The session exists and holds no artifact under this id. This is not the - /// same as ARTIFACT_AVAILABILITY_MISSING: here the claim-check itself is - /// absent, so nothing was ever promised, whereas MISSING is a promise the log - /// made and the store did not keep. - ARTIFACT_ERROR_CODE_ARTIFACT_NOT_FOUND = 2i32, - /// The range is not addressable: an offset past the end of the artifact, or a - /// zero length. - ARTIFACT_ERROR_CODE_RANGE_NOT_SATISFIABLE = 3i32, - /// Verification was required and the artifact has no chunk manifest, so no - /// checkable range of it exists. Refusing here is the whole value of the - /// requirement: the alternative is a caller believing it verified a read - /// because it asked to. - ARTIFACT_ERROR_CODE_VERIFICATION_UNAVAILABLE = 4i32, - /// The requested length exceeds what a single response may carry. The bound is - /// deployment-specific, so it is reported rather than encoded in the schema; - /// the message carries the accepted maximum. - ARTIFACT_ERROR_CODE_RANGE_TOO_LARGE = 5i32, - /// Malformed request that is none of the above. - ARTIFACT_ERROR_CODE_INVALID_ARGUMENT = 6i32, -} -impl ArtifactErrorCode { - ///Idiomatic alias for [`Self::ARTIFACT_ERROR_CODE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::ARTIFACT_ERROR_CODE_UNSPECIFIED; - ///Idiomatic alias for [`Self::ARTIFACT_ERROR_CODE_SESSION_NOT_FOUND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SessionNotFound: Self = Self::ARTIFACT_ERROR_CODE_SESSION_NOT_FOUND; - ///Idiomatic alias for [`Self::ARTIFACT_ERROR_CODE_ARTIFACT_NOT_FOUND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ArtifactNotFound: Self = Self::ARTIFACT_ERROR_CODE_ARTIFACT_NOT_FOUND; - ///Idiomatic alias for [`Self::ARTIFACT_ERROR_CODE_RANGE_NOT_SATISFIABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const RangeNotSatisfiable: Self = Self::ARTIFACT_ERROR_CODE_RANGE_NOT_SATISFIABLE; - ///Idiomatic alias for [`Self::ARTIFACT_ERROR_CODE_VERIFICATION_UNAVAILABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const VerificationUnavailable: Self = Self::ARTIFACT_ERROR_CODE_VERIFICATION_UNAVAILABLE; - ///Idiomatic alias for [`Self::ARTIFACT_ERROR_CODE_RANGE_TOO_LARGE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const RangeTooLarge: Self = Self::ARTIFACT_ERROR_CODE_RANGE_TOO_LARGE; - ///Idiomatic alias for [`Self::ARTIFACT_ERROR_CODE_INVALID_ARGUMENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const InvalidArgument: Self = Self::ARTIFACT_ERROR_CODE_INVALID_ARGUMENT; -} -impl ::core::default::Default for ArtifactErrorCode { - fn default() -> Self { - Self::ARTIFACT_ERROR_CODE_UNSPECIFIED - } -} -impl ::serde::Serialize for ArtifactErrorCode { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ArtifactErrorCode { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ArtifactErrorCode; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(ArtifactErrorCode) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ArtifactErrorCode { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ArtifactErrorCode { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::ARTIFACT_ERROR_CODE_UNSPECIFIED), - 1i32 => { - ::core::option::Option::Some(Self::ARTIFACT_ERROR_CODE_SESSION_NOT_FOUND) - } - 2i32 => { - ::core::option::Option::Some( - Self::ARTIFACT_ERROR_CODE_ARTIFACT_NOT_FOUND, - ) - } - 3i32 => { - ::core::option::Option::Some( - Self::ARTIFACT_ERROR_CODE_RANGE_NOT_SATISFIABLE, - ) - } - 4i32 => { - ::core::option::Option::Some( - Self::ARTIFACT_ERROR_CODE_VERIFICATION_UNAVAILABLE, - ) - } - 5i32 => { - ::core::option::Option::Some(Self::ARTIFACT_ERROR_CODE_RANGE_TOO_LARGE) - } - 6i32 => { - ::core::option::Option::Some(Self::ARTIFACT_ERROR_CODE_INVALID_ARGUMENT) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::ARTIFACT_ERROR_CODE_UNSPECIFIED => "ARTIFACT_ERROR_CODE_UNSPECIFIED", - Self::ARTIFACT_ERROR_CODE_SESSION_NOT_FOUND => { - "ARTIFACT_ERROR_CODE_SESSION_NOT_FOUND" - } - Self::ARTIFACT_ERROR_CODE_ARTIFACT_NOT_FOUND => { - "ARTIFACT_ERROR_CODE_ARTIFACT_NOT_FOUND" - } - Self::ARTIFACT_ERROR_CODE_RANGE_NOT_SATISFIABLE => { - "ARTIFACT_ERROR_CODE_RANGE_NOT_SATISFIABLE" - } - Self::ARTIFACT_ERROR_CODE_VERIFICATION_UNAVAILABLE => { - "ARTIFACT_ERROR_CODE_VERIFICATION_UNAVAILABLE" - } - Self::ARTIFACT_ERROR_CODE_RANGE_TOO_LARGE => { - "ARTIFACT_ERROR_CODE_RANGE_TOO_LARGE" - } - Self::ARTIFACT_ERROR_CODE_INVALID_ARGUMENT => { - "ARTIFACT_ERROR_CODE_INVALID_ARGUMENT" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "ARTIFACT_ERROR_CODE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::ARTIFACT_ERROR_CODE_UNSPECIFIED) - } - "ARTIFACT_ERROR_CODE_SESSION_NOT_FOUND" => { - ::core::option::Option::Some(Self::ARTIFACT_ERROR_CODE_SESSION_NOT_FOUND) - } - "ARTIFACT_ERROR_CODE_ARTIFACT_NOT_FOUND" => { - ::core::option::Option::Some( - Self::ARTIFACT_ERROR_CODE_ARTIFACT_NOT_FOUND, - ) - } - "ARTIFACT_ERROR_CODE_RANGE_NOT_SATISFIABLE" => { - ::core::option::Option::Some( - Self::ARTIFACT_ERROR_CODE_RANGE_NOT_SATISFIABLE, - ) - } - "ARTIFACT_ERROR_CODE_VERIFICATION_UNAVAILABLE" => { - ::core::option::Option::Some( - Self::ARTIFACT_ERROR_CODE_VERIFICATION_UNAVAILABLE, - ) - } - "ARTIFACT_ERROR_CODE_RANGE_TOO_LARGE" => { - ::core::option::Option::Some(Self::ARTIFACT_ERROR_CODE_RANGE_TOO_LARGE) - } - "ARTIFACT_ERROR_CODE_INVALID_ARGUMENT" => { - ::core::option::Option::Some(Self::ARTIFACT_ERROR_CODE_INVALID_ARGUMENT) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::ARTIFACT_ERROR_CODE_UNSPECIFIED, - Self::ARTIFACT_ERROR_CODE_SESSION_NOT_FOUND, - Self::ARTIFACT_ERROR_CODE_ARTIFACT_NOT_FOUND, - Self::ARTIFACT_ERROR_CODE_RANGE_NOT_SATISFIABLE, - Self::ARTIFACT_ERROR_CODE_VERIFICATION_UNAVAILABLE, - Self::ARTIFACT_ERROR_CODE_RANGE_TOO_LARGE, - Self::ARTIFACT_ERROR_CODE_INVALID_ARGUMENT, - ] - } -} -/// ArtifactError is the failure shape for the artifact read contract. -/// -/// Only failures to answer belong here. An artifact that is erased, missing, -/// corrupt, or hidden is an answer, carried as ArtifactAvailability on a -/// successful response, because it is a fact about the artifact the caller -/// asked about. Reporting it as an error would make "what happened to this -/// artifact" indistinguishable from "the read contract is broken" at exactly -/// the moment an operator needs to tell them apart. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ArtifactError { - /// Field 1: `code` - #[serde(rename = "code", with = "::buffa::json_helpers::proto_enum")] - pub code: ::buffa::EnumValue, - /// Field 2: `message` - #[serde(rename = "message", with = "::buffa::json_helpers::proto_string")] - pub message: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for ArtifactError { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ArtifactError") - .field("code", &self.code) - .field("message", &self.message) - .finish() - } -} -impl ArtifactError { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ArtifactError"; -} -::buffa::impl_default_instance!(ArtifactError); -impl ::buffa::MessageName for ArtifactError { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "ArtifactError"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.ArtifactError"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ArtifactError"; -} -impl ::buffa::Message for ArtifactError { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.code.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.message) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.code.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.message, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.code = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.message, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.code = ::buffa::EnumValue::from(0); - self.message.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ArtifactError { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ARTIFACT_ERROR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ArtifactError", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.availability.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.availability.rs deleted file mode 100644 index e5371e30c..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.availability.rs +++ /dev/null @@ -1,258 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/artifacts/v1alpha1/availability.proto - -/// Value types for the Session artifact read contract. -/// -/// These are redefined here rather than imported from the write side on purpose -/// (ADR#0035 facet 3). The write side records what happened to an artifact; this -/// contract answers what a caller can get right now, and the two change for -/// different reasons and on different cadences. -/// -/// ArtifactAvailability is what a caller can expect to read, and why, when the -/// answer is not "the bytes". -/// -/// A claim-check can fail to resolve for reasons that are not interchangeable, -/// and collapsing them into a single "missing" is how deliberate destruction -/// gets reported as data loss and how a transient storage fault gets reported as -/// permanent. Every non-AVAILABLE value here is a distinct operational -/// situation with a distinct correct response. -/// -/// The vocabulary deliberately reuses the Session doctor's -/// mismatch/absent/unreadable distinction rather than inventing a second -/// taxonomy for the same three facts. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ArtifactAvailability { - ARTIFACT_AVAILABILITY_UNSPECIFIED = 0i32, - /// The bytes are readable now. - ARTIFACT_AVAILABILITY_AVAILABLE = 1i32, - /// Destroyed on purpose and recorded as such by ArtifactErased. The - /// claim-check and its provenance remain on the log; the bytes are gone and - /// are not coming back. This is a correct end state, not a fault, and a reader - /// that renders it as damage will send someone looking for a problem that was - /// the point. - ARTIFACT_AVAILABILITY_ERASED = 2i32, - /// The store reports no such object, and no erasure was ever recorded. This is - /// the one value that means something went wrong: the log says bytes exist - /// that do not. - ARTIFACT_AVAILABILITY_MISSING = 3i32, - /// The artifact was recorded as an external reference whose bytes were never - /// durably stored. There is nothing to range-read, and there never was; the - /// source location may or may not still serve them, which is not this - /// contract's claim to make. - ARTIFACT_AVAILABILITY_EXTERNAL_ONLY = 4i32, - /// The object was read and does not match the digest recorded on the log. The - /// bytes exist and are not the artifact's, so serving them silently would hand - /// a caller content under a claim-check it does not satisfy. - ARTIFACT_AVAILABILITY_CORRUPT = 5i32, - /// The object could not be read. Unlike MISSING this makes no claim about - /// whether the bytes exist: a permissions or transport fault against the - /// artifact store looks identical from here, and a retry may succeed. - ARTIFACT_AVAILABILITY_UNREADABLE = 6i32, - /// The caller may see that this artifact exists and may not read it. - /// - /// This is reported, rather than answered as MISSING, only because the caller - /// can already see the claim-check in the session's own history. Hiding the - /// bytes from someone who is looking at the reference protects the content; - /// pretending the reference is dangling would just describe the session - /// incorrectly. An artifact belonging to a session the caller cannot see is - /// never reachable to be labelled at all. - ARTIFACT_AVAILABILITY_HIDDEN = 7i32, -} -impl ArtifactAvailability { - ///Idiomatic alias for [`Self::ARTIFACT_AVAILABILITY_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::ARTIFACT_AVAILABILITY_UNSPECIFIED; - ///Idiomatic alias for [`Self::ARTIFACT_AVAILABILITY_AVAILABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Available: Self = Self::ARTIFACT_AVAILABILITY_AVAILABLE; - ///Idiomatic alias for [`Self::ARTIFACT_AVAILABILITY_ERASED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Erased: Self = Self::ARTIFACT_AVAILABILITY_ERASED; - ///Idiomatic alias for [`Self::ARTIFACT_AVAILABILITY_MISSING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Missing: Self = Self::ARTIFACT_AVAILABILITY_MISSING; - ///Idiomatic alias for [`Self::ARTIFACT_AVAILABILITY_EXTERNAL_ONLY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ExternalOnly: Self = Self::ARTIFACT_AVAILABILITY_EXTERNAL_ONLY; - ///Idiomatic alias for [`Self::ARTIFACT_AVAILABILITY_CORRUPT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Corrupt: Self = Self::ARTIFACT_AVAILABILITY_CORRUPT; - ///Idiomatic alias for [`Self::ARTIFACT_AVAILABILITY_UNREADABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unreadable: Self = Self::ARTIFACT_AVAILABILITY_UNREADABLE; - ///Idiomatic alias for [`Self::ARTIFACT_AVAILABILITY_HIDDEN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Hidden: Self = Self::ARTIFACT_AVAILABILITY_HIDDEN; -} -impl ::core::default::Default for ArtifactAvailability { - fn default() -> Self { - Self::ARTIFACT_AVAILABILITY_UNSPECIFIED - } -} -impl ::serde::Serialize for ArtifactAvailability { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ArtifactAvailability { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ArtifactAvailability; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(ArtifactAvailability) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ArtifactAvailability { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ArtifactAvailability { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_AVAILABLE), - 2i32 => ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_ERASED), - 3i32 => ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_MISSING), - 4i32 => { - ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_EXTERNAL_ONLY) - } - 5i32 => ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_CORRUPT), - 6i32 => ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_UNREADABLE), - 7i32 => ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_HIDDEN), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::ARTIFACT_AVAILABILITY_UNSPECIFIED => { - "ARTIFACT_AVAILABILITY_UNSPECIFIED" - } - Self::ARTIFACT_AVAILABILITY_AVAILABLE => "ARTIFACT_AVAILABILITY_AVAILABLE", - Self::ARTIFACT_AVAILABILITY_ERASED => "ARTIFACT_AVAILABILITY_ERASED", - Self::ARTIFACT_AVAILABILITY_MISSING => "ARTIFACT_AVAILABILITY_MISSING", - Self::ARTIFACT_AVAILABILITY_EXTERNAL_ONLY => { - "ARTIFACT_AVAILABILITY_EXTERNAL_ONLY" - } - Self::ARTIFACT_AVAILABILITY_CORRUPT => "ARTIFACT_AVAILABILITY_CORRUPT", - Self::ARTIFACT_AVAILABILITY_UNREADABLE => "ARTIFACT_AVAILABILITY_UNREADABLE", - Self::ARTIFACT_AVAILABILITY_HIDDEN => "ARTIFACT_AVAILABILITY_HIDDEN", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "ARTIFACT_AVAILABILITY_UNSPECIFIED" => { - ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_UNSPECIFIED) - } - "ARTIFACT_AVAILABILITY_AVAILABLE" => { - ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_AVAILABLE) - } - "ARTIFACT_AVAILABILITY_ERASED" => { - ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_ERASED) - } - "ARTIFACT_AVAILABILITY_MISSING" => { - ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_MISSING) - } - "ARTIFACT_AVAILABILITY_EXTERNAL_ONLY" => { - ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_EXTERNAL_ONLY) - } - "ARTIFACT_AVAILABILITY_CORRUPT" => { - ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_CORRUPT) - } - "ARTIFACT_AVAILABILITY_UNREADABLE" => { - ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_UNREADABLE) - } - "ARTIFACT_AVAILABILITY_HIDDEN" => { - ::core::option::Option::Some(Self::ARTIFACT_AVAILABILITY_HIDDEN) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::ARTIFACT_AVAILABILITY_UNSPECIFIED, - Self::ARTIFACT_AVAILABILITY_AVAILABLE, - Self::ARTIFACT_AVAILABILITY_ERASED, - Self::ARTIFACT_AVAILABILITY_MISSING, - Self::ARTIFACT_AVAILABILITY_EXTERNAL_ONLY, - Self::ARTIFACT_AVAILABILITY_CORRUPT, - Self::ARTIFACT_AVAILABILITY_UNREADABLE, - Self::ARTIFACT_AVAILABILITY_HIDDEN, - ] - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.chunk_manifest.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.chunk_manifest.__view.rs deleted file mode 100644 index a5f95fecc..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.chunk_manifest.__view.rs +++ /dev/null @@ -1,705 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/artifacts/v1alpha1/chunk_manifest.proto - -/// GetChunkManifestRequest asks for the per-chunk digests that make ranges of an -/// artifact checkable. -#[derive(Clone, Debug, Default)] -pub struct GetChunkManifestRequestView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `artifact_id` - pub artifact_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> GetChunkManifestRequestView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `artifact_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for GetChunkManifestRequestView<'a> { - type Owned = super::super::GetChunkManifestRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.artifact_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::GetChunkManifestRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::GetChunkManifestRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::GetChunkManifestRequest { - session_id: self.session_id.to_string(), - artifact_id: self.artifact_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for GetChunkManifestRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.artifact_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for GetChunkManifestRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("artifactId", self.artifact_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for GetChunkManifestRequestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "GetChunkManifestRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.GetChunkManifestRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.GetChunkManifestRequest"; -} -::buffa::impl_default_view_instance!(GetChunkManifestRequestView); -::buffa::impl_view_reborrow!(GetChunkManifestRequestView); -/** Self-contained, `'static` owned view of a `GetChunkManifestRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`GetChunkManifestRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetChunkManifestRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct GetChunkManifestRequestOwnedView( - ::buffa::OwnedView>, -); -impl GetChunkManifestRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetChunkManifestRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetChunkManifestRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::GetChunkManifestRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetChunkManifestRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`GetChunkManifestRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &GetChunkManifestRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::GetChunkManifestRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `artifact_id` - #[must_use] - pub fn artifact_id(&self) -> &'_ str { - self.0.reborrow().artifact_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for GetChunkManifestRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - GetChunkManifestRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: GetChunkManifestRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for GetChunkManifestRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::GetChunkManifestRequest { - type View<'a> = GetChunkManifestRequestView<'a>; - type ViewHandle = GetChunkManifestRequestOwnedView; -} -impl ::serde::Serialize for GetChunkManifestRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// GetChunkManifestResponse carries the ordered chunk digests. -/// -/// The manifest comes from the artifact store, so on its own it proves nothing: -/// a store serving wrong bytes can serve a manifest that agrees with them. It -/// becomes evidence only when the caller hashes it and compares the result -/// against the manifest digest recorded on the event log, which the store did -/// not supply. A caller that skips that comparison has verified nothing and -/// should say so rather than report a verified read. -#[derive(Clone, Debug, Default)] -pub struct GetChunkManifestResponseView<'a> { - /// Field 1: `artifact_id` - pub artifact_id: &'a str, - /// Hash used for each chunk digest and for the digest over their - /// concatenation, for example "sha256". - /// - /// Field 2: `algorithm` - pub algorithm: &'a str, - /// Size of every chunk but the last, which holds the remainder. - /// - /// Field 3: `chunk_size_bytes` - pub chunk_size_bytes: u64, - /// Total size of the artifact, so a caller can tell a complete manifest from a - /// truncated one before trusting any chunk in it. - /// - /// Field 4: `size_bytes` - pub size_bytes: u64, - /// Raw chunk digests in artifact order, one per chunk. The algorithm is on the - /// envelope because every entry uses the same one, and a per-entry algorithm - /// would be a per-entry opportunity for them to disagree. - /// - /// Field 5: `chunk_digests` - pub chunk_digests: ::buffa::RepeatedView<'a, &'a [u8]>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> GetChunkManifestResponseView<'a> { - /**Whether required field `artifact_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `algorithm` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_algorithm(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `chunk_size_bytes` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_chunk_size_bytes(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `size_bytes` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_size_bytes(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for GetChunkManifestResponseView<'a> { - type Owned = super::super::GetChunkManifestResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.artifact_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.algorithm = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.chunk_size_bytes = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.size_bytes = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - view.chunk_digests.push(__elem); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::GetChunkManifestResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::GetChunkManifestResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::GetChunkManifestResponse { - artifact_id: self.artifact_id.to_string(), - algorithm: self.algorithm.to_string(), - chunk_size_bytes: self.chunk_size_bytes, - size_bytes: self.size_bytes, - chunk_digests: self.chunk_digests.iter().map(|b| (b).to_vec()).collect(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for GetChunkManifestResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.algorithm) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.chunk_size_bytes) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.size_bytes) as u64; - for v in &self.chunk_digests { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.artifact_id, buf); - ::buffa::types::put_string_field(2u32, &self.algorithm, buf); - ::buffa::types::put_uint64_field(3u32, self.chunk_size_bytes, buf); - ::buffa::types::put_uint64_field(4u32, self.size_bytes, buf); - for v in &self.chunk_digests { - ::buffa::types::put_shared_bytes_field(5u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for GetChunkManifestResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("artifactId", self.artifact_id)?; - } - { - __map.serialize_entry("algorithm", self.algorithm)?; - } - { - __map - .serialize_entry( - "chunkSizeBytes", - &::buffa::json_helpers::ProtoJson(&self.chunk_size_bytes), - )?; - } - { - __map - .serialize_entry( - "sizeBytes", - &::buffa::json_helpers::ProtoJson(&self.size_bytes), - )?; - } - if !self.chunk_digests.is_empty() { - __map - .serialize_entry( - "chunkDigests", - &::buffa::json_helpers::BytesSeqJson(&self.chunk_digests), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for GetChunkManifestResponseView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "GetChunkManifestResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.GetChunkManifestResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.GetChunkManifestResponse"; -} -::buffa::impl_default_view_instance!(GetChunkManifestResponseView); -::buffa::impl_view_reborrow!(GetChunkManifestResponseView); -/** Self-contained, `'static` owned view of a `GetChunkManifestResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`GetChunkManifestResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetChunkManifestResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct GetChunkManifestResponseOwnedView( - ::buffa::OwnedView>, -); -impl GetChunkManifestResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetChunkManifestResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetChunkManifestResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::GetChunkManifestResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetChunkManifestResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`GetChunkManifestResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &GetChunkManifestResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::GetChunkManifestResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `artifact_id` - #[must_use] - pub fn artifact_id(&self) -> &'_ str { - self.0.reborrow().artifact_id - } - /// Hash used for each chunk digest and for the digest over their - /// concatenation, for example "sha256". - /// - /// Field 2: `algorithm` - #[must_use] - pub fn algorithm(&self) -> &'_ str { - self.0.reborrow().algorithm - } - /// Size of every chunk but the last, which holds the remainder. - /// - /// Field 3: `chunk_size_bytes` - #[must_use] - pub fn chunk_size_bytes(&self) -> u64 { - self.0.reborrow().chunk_size_bytes - } - /// Total size of the artifact, so a caller can tell a complete manifest from a - /// truncated one before trusting any chunk in it. - /// - /// Field 4: `size_bytes` - #[must_use] - pub fn size_bytes(&self) -> u64 { - self.0.reborrow().size_bytes - } - /// Raw chunk digests in artifact order, one per chunk. The algorithm is on the - /// envelope because every entry uses the same one, and a per-entry algorithm - /// would be a per-entry opportunity for them to disagree. - /// - /// Field 5: `chunk_digests` - #[must_use] - pub fn chunk_digests(&self) -> &::buffa::RepeatedView<'_, &'_ [u8]> { - &self.0.reborrow().chunk_digests - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for GetChunkManifestResponseOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - GetChunkManifestResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: GetChunkManifestResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for GetChunkManifestResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::GetChunkManifestResponse { - type View<'a> = GetChunkManifestResponseView<'a>; - type ViewHandle = GetChunkManifestResponseOwnedView; -} -impl ::serde::Serialize for GetChunkManifestResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.chunk_manifest.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.chunk_manifest.rs deleted file mode 100644 index eeb9bd5ce..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.chunk_manifest.rs +++ /dev/null @@ -1,332 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/artifacts/v1alpha1/chunk_manifest.proto - -/// GetChunkManifestRequest asks for the per-chunk digests that make ranges of an -/// artifact checkable. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct GetChunkManifestRequest { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `artifact_id` - #[serde( - rename = "artifactId", - alias = "artifact_id", - with = "::buffa::json_helpers::proto_string" - )] - pub artifact_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for GetChunkManifestRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("GetChunkManifestRequest") - .field("session_id", &self.session_id) - .field("artifact_id", &self.artifact_id) - .finish() - } -} -impl GetChunkManifestRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.GetChunkManifestRequest"; -} -::buffa::impl_default_instance!(GetChunkManifestRequest); -impl ::buffa::MessageName for GetChunkManifestRequest { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "GetChunkManifestRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.GetChunkManifestRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.GetChunkManifestRequest"; -} -impl ::buffa::Message for GetChunkManifestRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.artifact_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.artifact_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.artifact_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for GetChunkManifestRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __GET_CHUNK_MANIFEST_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.GetChunkManifestRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// GetChunkManifestResponse carries the ordered chunk digests. -/// -/// The manifest comes from the artifact store, so on its own it proves nothing: -/// a store serving wrong bytes can serve a manifest that agrees with them. It -/// becomes evidence only when the caller hashes it and compares the result -/// against the manifest digest recorded on the event log, which the store did -/// not supply. A caller that skips that comparison has verified nothing and -/// should say so rather than report a verified read. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct GetChunkManifestResponse { - /// Field 1: `artifact_id` - #[serde( - rename = "artifactId", - alias = "artifact_id", - with = "::buffa::json_helpers::proto_string" - )] - pub artifact_id: ::buffa::alloc::string::String, - /// Hash used for each chunk digest and for the digest over their - /// concatenation, for example "sha256". - /// - /// Field 2: `algorithm` - #[serde(rename = "algorithm", with = "::buffa::json_helpers::proto_string")] - pub algorithm: ::buffa::alloc::string::String, - /// Size of every chunk but the last, which holds the remainder. - /// - /// Field 3: `chunk_size_bytes` - #[serde( - rename = "chunkSizeBytes", - alias = "chunk_size_bytes", - with = "::buffa::json_helpers::uint64" - )] - pub chunk_size_bytes: u64, - /// Total size of the artifact, so a caller can tell a complete manifest from a - /// truncated one before trusting any chunk in it. - /// - /// Field 4: `size_bytes` - #[serde( - rename = "sizeBytes", - alias = "size_bytes", - with = "::buffa::json_helpers::uint64" - )] - pub size_bytes: u64, - /// Raw chunk digests in artifact order, one per chunk. The algorithm is on the - /// envelope because every entry uses the same one, and a per-entry algorithm - /// would be a per-entry opportunity for them to disagree. - /// - /// Field 5: `chunk_digests` - #[serde( - rename = "chunkDigests", - alias = "chunk_digests", - with = "::buffa::json_helpers::proto_seq", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec" - )] - pub chunk_digests: ::buffa::alloc::vec::Vec<::buffa::alloc::vec::Vec>, -} -impl ::core::fmt::Debug for GetChunkManifestResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("GetChunkManifestResponse") - .field("artifact_id", &self.artifact_id) - .field("algorithm", &self.algorithm) - .field("chunk_size_bytes", &self.chunk_size_bytes) - .field("size_bytes", &self.size_bytes) - .field("chunk_digests", &self.chunk_digests) - .finish() - } -} -impl GetChunkManifestResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.GetChunkManifestResponse"; -} -::buffa::impl_default_instance!(GetChunkManifestResponse); -impl ::buffa::MessageName for GetChunkManifestResponse { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "GetChunkManifestResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.GetChunkManifestResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.GetChunkManifestResponse"; -} -impl ::buffa::Message for GetChunkManifestResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.algorithm) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.chunk_size_bytes) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.size_bytes) as u64; - for v in &self.chunk_digests { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.artifact_id, buf); - ::buffa::types::put_string_field(2u32, &self.algorithm, buf); - ::buffa::types::put_uint64_field(3u32, self.chunk_size_bytes, buf); - ::buffa::types::put_uint64_field(4u32, self.size_bytes, buf); - for v in &self.chunk_digests { - ::buffa::types::put_shared_bytes_field(5u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.artifact_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.algorithm, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.chunk_size_bytes = ::buffa::types::decode_uint64(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.size_bytes = ::buffa::types::decode_uint64(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::decode_bytes(buf)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - self.chunk_digests.push(__elem); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.artifact_id.clear(); - self.algorithm.clear(); - self.chunk_size_bytes = 0u64; - self.size_bytes = 0u64; - self.chunk_digests.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for GetChunkManifestResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __GET_CHUNK_MANIFEST_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.GetChunkManifestResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.mod.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.mod.rs deleted file mode 100644 index 404cd0c93..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.mod.rs +++ /dev/null @@ -1,81 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. - -include!("trogonai.session.sessions.artifacts.v1alpha1.artifact_error.rs"); -include!("trogonai.session.sessions.artifacts.v1alpha1.availability.rs"); -include!("trogonai.session.sessions.artifacts.v1alpha1.chunk_manifest.rs"); -include!("trogonai.session.sessions.artifacts.v1alpha1.read_artifact_range.rs"); -include!("trogonai.session.sessions.artifacts.v1alpha1.stat_artifact.rs"); -#[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception -)] -pub mod __buffa { - #[allow(unused_imports)] - use super::*; - pub mod view { - #[allow(unused_imports)] - use super::*; - include!( - "trogonai.session.sessions.artifacts.v1alpha1.artifact_error.__view.rs" - ); - include!( - "trogonai.session.sessions.artifacts.v1alpha1.chunk_manifest.__view.rs" - ); - include!( - "trogonai.session.sessions.artifacts.v1alpha1.read_artifact_range.__view.rs" - ); - include!("trogonai.session.sessions.artifacts.v1alpha1.stat_artifact.__view.rs"); - } - /// Register this package's `Any` type entries and extension entries. - pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) { - reg.register_json_any(super::__ARTIFACT_ERROR_JSON_ANY); - reg.register_json_any(super::__GET_CHUNK_MANIFEST_REQUEST_JSON_ANY); - reg.register_json_any(super::__GET_CHUNK_MANIFEST_RESPONSE_JSON_ANY); - reg.register_json_any(super::__READ_ARTIFACT_RANGE_REQUEST_JSON_ANY); - reg.register_json_any(super::__READ_ARTIFACT_RANGE_RESPONSE_JSON_ANY); - reg.register_json_any(super::__STAT_ARTIFACT_REQUEST_JSON_ANY); - reg.register_json_any(super::__STAT_ARTIFACT_RESPONSE_JSON_ANY); - reg.register_json_any(super::__READABLE_CONTENT_JSON_ANY); - } -} -#[doc(inline)] -pub use self::__buffa::view::ArtifactErrorView; -#[doc(inline)] -pub use self::__buffa::view::ArtifactErrorOwnedView; -#[doc(inline)] -pub use self::__buffa::view::GetChunkManifestRequestView; -#[doc(inline)] -pub use self::__buffa::view::GetChunkManifestRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::GetChunkManifestResponseView; -#[doc(inline)] -pub use self::__buffa::view::GetChunkManifestResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReadArtifactRangeRequestView; -#[doc(inline)] -pub use self::__buffa::view::ReadArtifactRangeRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReadArtifactRangeResponseView; -#[doc(inline)] -pub use self::__buffa::view::ReadArtifactRangeResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::view::StatArtifactRequestView; -#[doc(inline)] -pub use self::__buffa::view::StatArtifactRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::StatArtifactResponseView; -#[doc(inline)] -pub use self::__buffa::view::StatArtifactResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReadableContentView; -#[doc(inline)] -pub use self::__buffa::view::ReadableContentOwnedView; -#[doc(inline)] -pub use self::__buffa::register_types; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.read_artifact_range.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.read_artifact_range.__view.rs deleted file mode 100644 index c72f8aa56..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.read_artifact_range.__view.rs +++ /dev/null @@ -1,929 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/artifacts/v1alpha1/read_artifact_range.proto - -/// ReadArtifactRangeRequest asks for a bounded window of an artifact's bytes. -/// -/// There is no request for the whole artifact and no way to express one. A -/// caller that wants all 40 MB issues successive ranges; the transport carries -/// JSON-RPC bodies over NATS (ADR#0055, ADR#0056) and has no streaming call, so -/// successive bounded reads are the streaming primitive rather than a -/// workaround for the absence of one. The practical difference is that the -/// bound is always the caller's and always visible, instead of a limit -/// discovered when a response fails to fit. -#[derive(Clone, Debug, Default)] -pub struct ReadArtifactRangeRequestView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `artifact_id` - pub artifact_id: &'a str, - /// First byte requested, counted from the start of the artifact. - /// - /// Field 3: `offset` - pub offset: u64, - /// How many bytes are wanted. The server may serve fewer at the end of the - /// artifact or under its own cap, and may serve more only to reach a chunk - /// boundary when verification was required. What was served is on the - /// response; a caller must read it rather than assume it got what it asked - /// for. - /// - /// Field 4: `length` - pub length: u64, - /// Field 5: `verification` - pub verification: ::core::option::Option< - ::buffa::EnumValue, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReadArtifactRangeRequestView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `artifact_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `offset` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_offset(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `length` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_length(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ReadArtifactRangeRequestView<'a> { - type Owned = super::super::ReadArtifactRangeRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.artifact_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.offset = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.length = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.verification = Some( - ::buffa::EnumValue::from(::buffa::types::decode_int32(&mut cur)?), - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ReadArtifactRangeRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ReadArtifactRangeRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReadArtifactRangeRequest { - session_id: self.session_id.to_string(), - artifact_id: self.artifact_id.to_string(), - offset: self.offset, - length: self.length, - verification: self.verification, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReadArtifactRangeRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.offset) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.length) as u64; - if let Some(ref v) = self.verification { - size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.artifact_id, buf); - ::buffa::types::put_uint64_field(3u32, self.offset, buf); - ::buffa::types::put_uint64_field(4u32, self.length, buf); - if let Some(ref v) = self.verification { - ::buffa::types::put_int32_field(5u32, v.to_i32(), buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReadArtifactRangeRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("artifactId", self.artifact_id)?; - } - { - __map - .serialize_entry( - "offset", - &::buffa::json_helpers::ProtoJson(&self.offset), - )?; - } - { - __map - .serialize_entry( - "length", - &::buffa::json_helpers::ProtoJson(&self.length), - )?; - } - if let ::core::option::Option::Some(ref __v) = self.verification { - __map.serialize_entry("verification", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReadArtifactRangeRequestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "ReadArtifactRangeRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.ReadArtifactRangeRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ReadArtifactRangeRequest"; -} -::buffa::impl_default_view_instance!(ReadArtifactRangeRequestView); -::buffa::impl_view_reborrow!(ReadArtifactRangeRequestView); -/** Self-contained, `'static` owned view of a `ReadArtifactRangeRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReadArtifactRangeRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReadArtifactRangeRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReadArtifactRangeRequestOwnedView( - ::buffa::OwnedView>, -); -impl ReadArtifactRangeRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReadArtifactRangeRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReadArtifactRangeRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReadArtifactRangeRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReadArtifactRangeRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReadArtifactRangeRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReadArtifactRangeRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReadArtifactRangeRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `artifact_id` - #[must_use] - pub fn artifact_id(&self) -> &'_ str { - self.0.reborrow().artifact_id - } - /// First byte requested, counted from the start of the artifact. - /// - /// Field 3: `offset` - #[must_use] - pub fn offset(&self) -> u64 { - self.0.reborrow().offset - } - /// How many bytes are wanted. The server may serve fewer at the end of the - /// artifact or under its own cap, and may serve more only to reach a chunk - /// boundary when verification was required. What was served is on the - /// response; a caller must read it rather than assume it got what it asked - /// for. - /// - /// Field 4: `length` - #[must_use] - pub fn length(&self) -> u64 { - self.0.reborrow().length - } - /// Field 5: `verification` - #[must_use] - pub fn verification( - &self, - ) -> ::core::option::Option< - ::buffa::EnumValue, - > { - self.0.reborrow().verification - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReadArtifactRangeRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReadArtifactRangeRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReadArtifactRangeRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReadArtifactRangeRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReadArtifactRangeRequest { - type View<'a> = ReadArtifactRangeRequestView<'a>; - type ViewHandle = ReadArtifactRangeRequestOwnedView; -} -impl ::serde::Serialize for ReadArtifactRangeRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ReadArtifactRangeResponse carries the served bytes and says what they are -/// worth. -#[derive(Clone, Debug, Default)] -pub struct ReadArtifactRangeResponseView<'a> { - /// Field 1: `artifact_id` - pub artifact_id: &'a str, - /// Field 2: `availability` - pub availability: ::buffa::EnumValue, - /// First byte actually served. Equal to the requested offset unless - /// verification required aligning down to a chunk boundary. - /// - /// Field 3: `offset` - pub offset: u64, - /// The served bytes. Empty for every availability except - /// ARTIFACT_AVAILABILITY_AVAILABLE. Its length is the served length; a - /// separate length field would be a second copy of a fact the bytes already - /// carry, and the copy is what a caller would trust when they disagree. - /// - /// Field 4: `content` - pub content: ::core::option::Option<&'a [u8]>, - /// Total size of the artifact. This is what makes the response - /// self-describing: with the served offset and length, a caller derives - /// reaching the end of the artifact from being cut short by the server - /// without a flag that could contradict the numbers next to it, and knows - /// where to resume without a second call. - /// - /// Field 5: `size_bytes` - pub size_bytes: u64, - /// Field 6: `verifiability` - pub verifiability: ::buffa::EnumValue, - /// Field 7: `observed_at` - pub observed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReadArtifactRangeResponseView<'a> { - /**Whether required field `artifact_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `availability` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_availability(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `offset` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_offset(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `size_bytes` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_size_bytes(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `verifiability` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_verifiability(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } - /**Whether required field `observed_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_observed_at(&self) -> bool { - self.observed_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ReadArtifactRangeResponseView<'a> { - type Owned = super::super::ReadArtifactRangeResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.artifact_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.availability = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.offset = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.content = Some(::buffa::types::borrow_bytes(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.size_bytes = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.verifiability = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 16u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ReadArtifactRangeResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ReadArtifactRangeResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReadArtifactRangeResponse { - artifact_id: self.artifact_id.to_string(), - availability: self.availability, - offset: self.offset, - content: self.content.map(|b| (b).to_vec()), - size_bytes: self.size_bytes, - verifiability: self.verifiability, - observed_at: match self.observed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReadArtifactRangeResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - { - let val = self.availability.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.offset) as u64; - if let Some(ref v) = self.content { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.size_bytes) as u64; - { - let val = self.verifiability.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.artifact_id, buf); - ::buffa::types::put_int32_field(2u32, self.availability.to_i32(), buf); - ::buffa::types::put_uint64_field(3u32, self.offset, buf); - if let Some(ref v) = self.content { - ::buffa::types::put_shared_bytes_field(4u32, v, buf); - } - ::buffa::types::put_uint64_field(5u32, self.size_bytes, buf); - ::buffa::types::put_int32_field(6u32, self.verifiability.to_i32(), buf); - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReadArtifactRangeResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("artifactId", self.artifact_id)?; - } - { - __map.serialize_entry("availability", &self.availability)?; - } - { - __map - .serialize_entry( - "offset", - &::buffa::json_helpers::ProtoJson(&self.offset), - )?; - } - if let ::core::option::Option::Some(__v) = self.content { - __map.serialize_entry("content", &::buffa::json_helpers::BytesJson(__v))?; - } - { - __map - .serialize_entry( - "sizeBytes", - &::buffa::json_helpers::ProtoJson(&self.size_bytes), - )?; - } - { - __map.serialize_entry("verifiability", &self.verifiability)?; - } - { - if let ::core::option::Option::Some(__v) = self.observed_at.as_option() { - __map.serialize_entry("observedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReadArtifactRangeResponseView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "ReadArtifactRangeResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.ReadArtifactRangeResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ReadArtifactRangeResponse"; -} -::buffa::impl_default_view_instance!(ReadArtifactRangeResponseView); -::buffa::impl_view_reborrow!(ReadArtifactRangeResponseView); -/** Self-contained, `'static` owned view of a `ReadArtifactRangeResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReadArtifactRangeResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReadArtifactRangeResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReadArtifactRangeResponseOwnedView( - ::buffa::OwnedView>, -); -impl ReadArtifactRangeResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReadArtifactRangeResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReadArtifactRangeResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReadArtifactRangeResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReadArtifactRangeResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReadArtifactRangeResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReadArtifactRangeResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReadArtifactRangeResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `artifact_id` - #[must_use] - pub fn artifact_id(&self) -> &'_ str { - self.0.reborrow().artifact_id - } - /// Field 2: `availability` - #[must_use] - pub fn availability( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().availability - } - /// First byte actually served. Equal to the requested offset unless - /// verification required aligning down to a chunk boundary. - /// - /// Field 3: `offset` - #[must_use] - pub fn offset(&self) -> u64 { - self.0.reborrow().offset - } - /// The served bytes. Empty for every availability except - /// ARTIFACT_AVAILABILITY_AVAILABLE. Its length is the served length; a - /// separate length field would be a second copy of a fact the bytes already - /// carry, and the copy is what a caller would trust when they disagree. - /// - /// Field 4: `content` - #[must_use] - pub fn content(&self) -> ::core::option::Option<&'_ [u8]> { - self.0.reborrow().content - } - /// Total size of the artifact. This is what makes the response - /// self-describing: with the served offset and length, a caller derives - /// reaching the end of the artifact from being cut short by the server - /// without a flag that could contradict the numbers next to it, and knows - /// where to resume without a second call. - /// - /// Field 5: `size_bytes` - #[must_use] - pub fn size_bytes(&self) -> u64 { - self.0.reborrow().size_bytes - } - /// Field 6: `verifiability` - #[must_use] - pub fn verifiability(&self) -> ::buffa::EnumValue { - self.0.reborrow().verifiability - } - /// Field 7: `observed_at` - #[must_use] - pub fn observed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().observed_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReadArtifactRangeResponseOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReadArtifactRangeResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReadArtifactRangeResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReadArtifactRangeResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReadArtifactRangeResponse { - type View<'a> = ReadArtifactRangeResponseView<'a>; - type ViewHandle = ReadArtifactRangeResponseOwnedView; -} -impl ::serde::Serialize for ReadArtifactRangeResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.read_artifact_range.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.read_artifact_range.rs deleted file mode 100644 index 4e2339160..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.read_artifact_range.rs +++ /dev/null @@ -1,834 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/artifacts/v1alpha1/read_artifact_range.proto - -/// VerificationRequirement is whether the caller is willing to receive bytes it -/// cannot check. -/// -/// Unspecified means required. The default has to be the strict one: a caller -/// that never thought about verification is precisely the caller that will not -/// notice unchecked bytes arriving, and a field whose omission silently weakens -/// a guarantee is a guarantee only for people who read the schema. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum VerificationRequirement { - VERIFICATION_REQUIREMENT_UNSPECIFIED = 0i32, - /// Refuse the read rather than serve a range the caller cannot check. A - /// requirement that degrades into a warning when it cannot be met is not a - /// requirement, so this fails with - /// ARTIFACT_ERROR_CODE_VERIFICATION_UNAVAILABLE instead of returning bytes - /// labelled unverifiable. - VERIFICATION_REQUIREMENT_REQUIRED = 1i32, - /// Serve the range even when it cannot be checked. Appropriate for a preview - /// pane and not for anything that will be executed, replayed, or stored - /// elsewhere as the artifact. - VERIFICATION_REQUIREMENT_NOT_REQUIRED = 2i32, -} -impl VerificationRequirement { - ///Idiomatic alias for [`Self::VERIFICATION_REQUIREMENT_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::VERIFICATION_REQUIREMENT_UNSPECIFIED; - ///Idiomatic alias for [`Self::VERIFICATION_REQUIREMENT_REQUIRED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Required: Self = Self::VERIFICATION_REQUIREMENT_REQUIRED; - ///Idiomatic alias for [`Self::VERIFICATION_REQUIREMENT_NOT_REQUIRED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NotRequired: Self = Self::VERIFICATION_REQUIREMENT_NOT_REQUIRED; -} -impl ::core::default::Default for VerificationRequirement { - fn default() -> Self { - Self::VERIFICATION_REQUIREMENT_UNSPECIFIED - } -} -impl ::serde::Serialize for VerificationRequirement { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for VerificationRequirement { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = VerificationRequirement; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(VerificationRequirement) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for VerificationRequirement { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for VerificationRequirement { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some(Self::VERIFICATION_REQUIREMENT_UNSPECIFIED) - } - 1i32 => ::core::option::Option::Some(Self::VERIFICATION_REQUIREMENT_REQUIRED), - 2i32 => { - ::core::option::Option::Some(Self::VERIFICATION_REQUIREMENT_NOT_REQUIRED) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::VERIFICATION_REQUIREMENT_UNSPECIFIED => { - "VERIFICATION_REQUIREMENT_UNSPECIFIED" - } - Self::VERIFICATION_REQUIREMENT_REQUIRED => { - "VERIFICATION_REQUIREMENT_REQUIRED" - } - Self::VERIFICATION_REQUIREMENT_NOT_REQUIRED => { - "VERIFICATION_REQUIREMENT_NOT_REQUIRED" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "VERIFICATION_REQUIREMENT_UNSPECIFIED" => { - ::core::option::Option::Some(Self::VERIFICATION_REQUIREMENT_UNSPECIFIED) - } - "VERIFICATION_REQUIREMENT_REQUIRED" => { - ::core::option::Option::Some(Self::VERIFICATION_REQUIREMENT_REQUIRED) - } - "VERIFICATION_REQUIREMENT_NOT_REQUIRED" => { - ::core::option::Option::Some(Self::VERIFICATION_REQUIREMENT_NOT_REQUIRED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::VERIFICATION_REQUIREMENT_UNSPECIFIED, - Self::VERIFICATION_REQUIREMENT_REQUIRED, - Self::VERIFICATION_REQUIREMENT_NOT_REQUIRED, - ] - } -} -/// RangeVerifiability is whether the caller can check what it just received. -/// -/// It reports what the caller can do, not what the server did, and the -/// distinction is the point. A server field reading "verified" would be the -/// party under suspicion certifying itself: the only check worth anything here -/// is one the caller performs, against a manifest digest that came from the -/// event log rather than from the artifact store. So this contract's obligation -/// is to serve ranges in a shape that can be checked, and to say plainly when it -/// has not. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum RangeVerifiability { - RANGE_VERIFIABILITY_UNSPECIFIED = 0i32, - /// The served range covers whole chunks, so every byte in it is covered by a - /// chunk digest the caller can obtain and check. - RANGE_VERIFIABILITY_VERIFIABLE = 1i32, - /// The artifact was stored without chunk hashing. Nothing about this range can - /// be checked short of reading the entire artifact and hashing it. - RANGE_VERIFIABILITY_NO_MANIFEST = 2i32, - /// A manifest exists and the served range does not align to it, because the - /// caller allowed an unverifiable read. The partial chunks at its edges are - /// not covered by any digest the caller can check. - RANGE_VERIFIABILITY_RANGE_NOT_ALIGNED = 3i32, -} -impl RangeVerifiability { - ///Idiomatic alias for [`Self::RANGE_VERIFIABILITY_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::RANGE_VERIFIABILITY_UNSPECIFIED; - ///Idiomatic alias for [`Self::RANGE_VERIFIABILITY_VERIFIABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Verifiable: Self = Self::RANGE_VERIFIABILITY_VERIFIABLE; - ///Idiomatic alias for [`Self::RANGE_VERIFIABILITY_NO_MANIFEST`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NoManifest: Self = Self::RANGE_VERIFIABILITY_NO_MANIFEST; - ///Idiomatic alias for [`Self::RANGE_VERIFIABILITY_RANGE_NOT_ALIGNED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const RangeNotAligned: Self = Self::RANGE_VERIFIABILITY_RANGE_NOT_ALIGNED; -} -impl ::core::default::Default for RangeVerifiability { - fn default() -> Self { - Self::RANGE_VERIFIABILITY_UNSPECIFIED - } -} -impl ::serde::Serialize for RangeVerifiability { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for RangeVerifiability { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = RangeVerifiability; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(RangeVerifiability) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for RangeVerifiability { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for RangeVerifiability { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::RANGE_VERIFIABILITY_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::RANGE_VERIFIABILITY_VERIFIABLE), - 2i32 => ::core::option::Option::Some(Self::RANGE_VERIFIABILITY_NO_MANIFEST), - 3i32 => { - ::core::option::Option::Some(Self::RANGE_VERIFIABILITY_RANGE_NOT_ALIGNED) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::RANGE_VERIFIABILITY_UNSPECIFIED => "RANGE_VERIFIABILITY_UNSPECIFIED", - Self::RANGE_VERIFIABILITY_VERIFIABLE => "RANGE_VERIFIABILITY_VERIFIABLE", - Self::RANGE_VERIFIABILITY_NO_MANIFEST => "RANGE_VERIFIABILITY_NO_MANIFEST", - Self::RANGE_VERIFIABILITY_RANGE_NOT_ALIGNED => { - "RANGE_VERIFIABILITY_RANGE_NOT_ALIGNED" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "RANGE_VERIFIABILITY_UNSPECIFIED" => { - ::core::option::Option::Some(Self::RANGE_VERIFIABILITY_UNSPECIFIED) - } - "RANGE_VERIFIABILITY_VERIFIABLE" => { - ::core::option::Option::Some(Self::RANGE_VERIFIABILITY_VERIFIABLE) - } - "RANGE_VERIFIABILITY_NO_MANIFEST" => { - ::core::option::Option::Some(Self::RANGE_VERIFIABILITY_NO_MANIFEST) - } - "RANGE_VERIFIABILITY_RANGE_NOT_ALIGNED" => { - ::core::option::Option::Some(Self::RANGE_VERIFIABILITY_RANGE_NOT_ALIGNED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::RANGE_VERIFIABILITY_UNSPECIFIED, - Self::RANGE_VERIFIABILITY_VERIFIABLE, - Self::RANGE_VERIFIABILITY_NO_MANIFEST, - Self::RANGE_VERIFIABILITY_RANGE_NOT_ALIGNED, - ] - } -} -/// ReadArtifactRangeRequest asks for a bounded window of an artifact's bytes. -/// -/// There is no request for the whole artifact and no way to express one. A -/// caller that wants all 40 MB issues successive ranges; the transport carries -/// JSON-RPC bodies over NATS (ADR#0055, ADR#0056) and has no streaming call, so -/// successive bounded reads are the streaming primitive rather than a -/// workaround for the absence of one. The practical difference is that the -/// bound is always the caller's and always visible, instead of a limit -/// discovered when a response fails to fit. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReadArtifactRangeRequest { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `artifact_id` - #[serde( - rename = "artifactId", - alias = "artifact_id", - with = "::buffa::json_helpers::proto_string" - )] - pub artifact_id: ::buffa::alloc::string::String, - /// First byte requested, counted from the start of the artifact. - /// - /// Field 3: `offset` - #[serde(rename = "offset", with = "::buffa::json_helpers::uint64")] - pub offset: u64, - /// How many bytes are wanted. The server may serve fewer at the end of the - /// artifact or under its own cap, and may serve more only to reach a chunk - /// boundary when verification was required. What was served is on the - /// response; a caller must read it rather than assume it got what it asked - /// for. - /// - /// Field 4: `length` - #[serde(rename = "length", with = "::buffa::json_helpers::uint64")] - pub length: u64, - /// Field 5: `verification` - #[serde( - rename = "verification", - with = "::buffa::json_helpers::opt_enum", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub verification: ::core::option::Option< - ::buffa::EnumValue, - >, -} -impl ::core::fmt::Debug for ReadArtifactRangeRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReadArtifactRangeRequest") - .field("session_id", &self.session_id) - .field("artifact_id", &self.artifact_id) - .field("offset", &self.offset) - .field("length", &self.length) - .field("verification", &self.verification) - .finish() - } -} -impl ReadArtifactRangeRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ReadArtifactRangeRequest"; -} -impl ReadArtifactRangeRequest { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::verification`] to `Some(value)`, consuming and returning `self`. - pub fn with_verification( - mut self, - value: impl Into<::buffa::EnumValue>, - ) -> Self { - self.verification = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ReadArtifactRangeRequest); -impl ::buffa::MessageName for ReadArtifactRangeRequest { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "ReadArtifactRangeRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.ReadArtifactRangeRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ReadArtifactRangeRequest"; -} -impl ::buffa::Message for ReadArtifactRangeRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.offset) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.length) as u64; - if let Some(ref v) = self.verification { - size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.artifact_id, buf); - ::buffa::types::put_uint64_field(3u32, self.offset, buf); - ::buffa::types::put_uint64_field(4u32, self.length, buf); - if let Some(ref v) = self.verification { - ::buffa::types::put_int32_field(5u32, v.to_i32(), buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.artifact_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.offset = ::buffa::types::decode_uint64(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.length = ::buffa::types::decode_uint64(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.verification = ::core::option::Option::Some( - ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?), - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.artifact_id.clear(); - self.offset = 0u64; - self.length = 0u64; - self.verification = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReadArtifactRangeRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __READ_ARTIFACT_RANGE_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ReadArtifactRangeRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ReadArtifactRangeResponse carries the served bytes and says what they are -/// worth. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReadArtifactRangeResponse { - /// Field 1: `artifact_id` - #[serde( - rename = "artifactId", - alias = "artifact_id", - with = "::buffa::json_helpers::proto_string" - )] - pub artifact_id: ::buffa::alloc::string::String, - /// Field 2: `availability` - #[serde(rename = "availability", with = "::buffa::json_helpers::proto_enum")] - pub availability: ::buffa::EnumValue, - /// First byte actually served. Equal to the requested offset unless - /// verification required aligning down to a chunk boundary. - /// - /// Field 3: `offset` - #[serde(rename = "offset", with = "::buffa::json_helpers::uint64")] - pub offset: u64, - /// The served bytes. Empty for every availability except - /// ARTIFACT_AVAILABILITY_AVAILABLE. Its length is the served length; a - /// separate length field would be a second copy of a fact the bytes already - /// carry, and the copy is what a caller would trust when they disagree. - /// - /// Field 4: `content` - #[serde( - rename = "content", - with = "::buffa::json_helpers::opt_bytes", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub content: ::core::option::Option<::buffa::alloc::vec::Vec>, - /// Total size of the artifact. This is what makes the response - /// self-describing: with the served offset and length, a caller derives - /// reaching the end of the artifact from being cut short by the server - /// without a flag that could contradict the numbers next to it, and knows - /// where to resume without a second call. - /// - /// Field 5: `size_bytes` - #[serde( - rename = "sizeBytes", - alias = "size_bytes", - with = "::buffa::json_helpers::uint64" - )] - pub size_bytes: u64, - /// Field 6: `verifiability` - #[serde(rename = "verifiability", with = "::buffa::json_helpers::proto_enum")] - pub verifiability: ::buffa::EnumValue, - /// Field 7: `observed_at` - #[serde(rename = "observedAt", alias = "observed_at")] - pub observed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for ReadArtifactRangeResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReadArtifactRangeResponse") - .field("artifact_id", &self.artifact_id) - .field("availability", &self.availability) - .field("offset", &self.offset) - .field("content", &self.content) - .field("size_bytes", &self.size_bytes) - .field("verifiability", &self.verifiability) - .field("observed_at", &self.observed_at) - .finish() - } -} -impl ReadArtifactRangeResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ReadArtifactRangeResponse"; -} -impl ReadArtifactRangeResponse { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::content`] to `Some(value)`, consuming and returning `self`. - pub fn with_content( - mut self, - value: impl Into<::buffa::alloc::vec::Vec>, - ) -> Self { - self.content = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ReadArtifactRangeResponse); -impl ::buffa::MessageName for ReadArtifactRangeResponse { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "ReadArtifactRangeResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.ReadArtifactRangeResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ReadArtifactRangeResponse"; -} -impl ::buffa::Message for ReadArtifactRangeResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - { - let val = self.availability.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.offset) as u64; - if let Some(ref v) = self.content { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.size_bytes) as u64; - { - let val = self.verifiability.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.artifact_id, buf); - ::buffa::types::put_int32_field(2u32, self.availability.to_i32(), buf); - ::buffa::types::put_uint64_field(3u32, self.offset, buf); - if let Some(ref v) = self.content { - ::buffa::types::put_shared_bytes_field(4u32, v, buf); - } - ::buffa::types::put_uint64_field(5u32, self.size_bytes, buf); - ::buffa::types::put_int32_field(6u32, self.verifiability.to_i32(), buf); - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.artifact_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.availability = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.offset = ::buffa::types::decode_uint64(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes( - self.content.get_or_insert_with(::buffa::alloc::vec::Vec::new), - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.size_bytes = ::buffa::types::decode_uint64(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.verifiability = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.artifact_id.clear(); - self.availability = ::buffa::EnumValue::from(0); - self.offset = 0u64; - self.content = ::core::option::Option::None; - self.size_bytes = 0u64; - self.verifiability = ::buffa::EnumValue::from(0); - self.observed_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReadArtifactRangeResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __READ_ARTIFACT_RANGE_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ReadArtifactRangeResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.stat_artifact.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.stat_artifact.__view.rs deleted file mode 100644 index 62ffe6fd5..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.stat_artifact.__view.rs +++ /dev/null @@ -1,1208 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/artifacts/v1alpha1/stat_artifact.proto - -/// StatArtifactRequest asks what an artifact is, without asking for it. -/// -/// There is deliberately no field on this request that could cause bytes to be -/// returned: no range, no "include content", no size threshold under which the -/// content comes along. A caller reaching for metadata about a 40 MB artifact -/// must not be able to fetch 40 MB by setting a field wrong, and a reviewer must -/// not have to read a value to know a call was cheap. This is the same -/// structural argument that gives DiagnoseSession no repair mode. -#[derive(Clone, Debug, Default)] -pub struct StatArtifactRequestView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `artifact_id` - pub artifact_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> StatArtifactRequestView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `artifact_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for StatArtifactRequestView<'a> { - type Owned = super::super::StatArtifactRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.artifact_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::StatArtifactRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::StatArtifactRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::StatArtifactRequest { - session_id: self.session_id.to_string(), - artifact_id: self.artifact_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for StatArtifactRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.artifact_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for StatArtifactRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("artifactId", self.artifact_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for StatArtifactRequestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "StatArtifactRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.StatArtifactRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.StatArtifactRequest"; -} -::buffa::impl_default_view_instance!(StatArtifactRequestView); -::buffa::impl_view_reborrow!(StatArtifactRequestView); -/** Self-contained, `'static` owned view of a `StatArtifactRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`StatArtifactRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`StatArtifactRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct StatArtifactRequestOwnedView( - ::buffa::OwnedView>, -); -impl StatArtifactRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StatArtifactRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StatArtifactRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::StatArtifactRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StatArtifactRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`StatArtifactRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &StatArtifactRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::StatArtifactRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `artifact_id` - #[must_use] - pub fn artifact_id(&self) -> &'_ str { - self.0.reborrow().artifact_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for StatArtifactRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - StatArtifactRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: StatArtifactRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for StatArtifactRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::StatArtifactRequest { - type View<'a> = StatArtifactRequestView<'a>; - type ViewHandle = StatArtifactRequestOwnedView; -} -impl ::serde::Serialize for StatArtifactRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// StatArtifactResponse describes the artifact and what can be done with it. -#[derive(Clone, Debug, Default)] -pub struct StatArtifactResponseView<'a> { - /// Field 1: `artifact_id` - pub artifact_id: &'a str, - /// Field 2: `availability` - pub availability: ::buffa::EnumValue, - /// Short human-readable preview recorded with the artifact; empty when none - /// was produced. Present regardless of availability, because a preview is - /// recorded on the log rather than stored with the bytes and so survives their - /// erasure or loss. For many callers this is the whole answer, and the reason - /// a preview is not a range read is that it costs nothing to serve. - /// - /// Field 3: `preview` - pub preview: ::core::option::Option<&'a str>, - /// True when preview is a truncation of the full content. - /// - /// Field 4: `preview_truncated` - pub preview_truncated: bool, - /// Set only for ARTIFACT_AVAILABILITY_AVAILABLE. Every other availability has - /// no readable bytes to describe, and a size or digest reported next to one of - /// them would describe something the caller cannot obtain. - /// - /// Field 5: `content` - pub content: ::buffa::MessageFieldView< - super::super::__buffa::view::ReadableContentView<'a>, - >, - /// When availability was determined. Availability is an observation of an - /// external store at a moment, not a durable property of the artifact, and a - /// caller acting on it later is acting on a claim that has since expired. - /// - /// Field 6: `observed_at` - pub observed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> StatArtifactResponseView<'a> { - /**Whether required field `artifact_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `availability` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_availability(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `preview_truncated` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_preview_truncated(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `observed_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_observed_at(&self) -> bool { - self.observed_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for StatArtifactResponseView<'a> { - type Owned = super::super::StatArtifactResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.artifact_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.availability = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.preview = Some(::buffa::types::borrow_str(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.preview_truncated = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.content.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.content = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::StatArtifactResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::StatArtifactResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::StatArtifactResponse { - artifact_id: self.artifact_id.to_string(), - availability: self.availability, - preview: self.preview.map(|s| s.to_string()), - preview_truncated: self.preview_truncated, - content: match self.content.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ReadableContent, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - observed_at: match self.observed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for StatArtifactResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - { - let val = self.availability.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.preview { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - if self.content.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.content.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.artifact_id, buf); - ::buffa::types::put_int32_field(2u32, self.availability.to_i32(), buf); - if let Some(ref v) = self.preview { - ::buffa::types::put_string_field(3u32, v, buf); - } - ::buffa::types::put_bool_field(4u32, self.preview_truncated, buf); - if self.content.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.content.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for StatArtifactResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("artifactId", self.artifact_id)?; - } - { - __map.serialize_entry("availability", &self.availability)?; - } - if let ::core::option::Option::Some(__v) = self.preview { - __map.serialize_entry("preview", __v)?; - } - { - __map.serialize_entry("previewTruncated", &self.preview_truncated)?; - } - { - if let ::core::option::Option::Some(__v) = self.content.as_option() { - __map.serialize_entry("content", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.observed_at.as_option() { - __map.serialize_entry("observedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for StatArtifactResponseView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "StatArtifactResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.StatArtifactResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.StatArtifactResponse"; -} -::buffa::impl_default_view_instance!(StatArtifactResponseView); -::buffa::impl_view_reborrow!(StatArtifactResponseView); -/** Self-contained, `'static` owned view of a `StatArtifactResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`StatArtifactResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`StatArtifactResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct StatArtifactResponseOwnedView( - ::buffa::OwnedView>, -); -impl StatArtifactResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StatArtifactResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StatArtifactResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::StatArtifactResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StatArtifactResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`StatArtifactResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &StatArtifactResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::StatArtifactResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `artifact_id` - #[must_use] - pub fn artifact_id(&self) -> &'_ str { - self.0.reborrow().artifact_id - } - /// Field 2: `availability` - #[must_use] - pub fn availability( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().availability - } - /// Short human-readable preview recorded with the artifact; empty when none - /// was produced. Present regardless of availability, because a preview is - /// recorded on the log rather than stored with the bytes and so survives their - /// erasure or loss. For many callers this is the whole answer, and the reason - /// a preview is not a range read is that it costs nothing to serve. - /// - /// Field 3: `preview` - #[must_use] - pub fn preview(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().preview - } - /// True when preview is a truncation of the full content. - /// - /// Field 4: `preview_truncated` - #[must_use] - pub fn preview_truncated(&self) -> bool { - self.0.reborrow().preview_truncated - } - /// Set only for ARTIFACT_AVAILABILITY_AVAILABLE. Every other availability has - /// no readable bytes to describe, and a size or digest reported next to one of - /// them would describe something the caller cannot obtain. - /// - /// Field 5: `content` - #[must_use] - pub fn content( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ReadableContentView<'_>, - > { - &self.0.reborrow().content - } - /// When availability was determined. Availability is an observation of an - /// external store at a moment, not a durable property of the artifact, and a - /// caller acting on it later is acting on a claim that has since expired. - /// - /// Field 6: `observed_at` - #[must_use] - pub fn observed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().observed_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for StatArtifactResponseOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - StatArtifactResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: StatArtifactResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for StatArtifactResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::StatArtifactResponse { - type View<'a> = StatArtifactResponseView<'a>; - type ViewHandle = StatArtifactResponseOwnedView; -} -impl ::serde::Serialize for StatArtifactResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ReadableContent describes bytes a caller can actually get. -#[derive(Clone, Debug, Default)] -pub struct ReadableContentView<'a> { - /// Field 1: `size_bytes` - pub size_bytes: u64, - /// Decoded media type of the stored bytes. - /// - /// Field 2: `mime` - pub mime: &'a str, - /// Hash algorithm of `digest`, for example "sha256". - /// - /// Field 3: `digest_algorithm` - pub digest_algorithm: &'a str, - /// Content digest over the whole artifact, as recorded on the log. Checking a - /// range against this one requires reading every byte, which is what - /// `chunk_size_bytes` exists to avoid. - /// - /// Field 4: `digest` - pub digest: &'a [u8], - /// Chunk size of this artifact's manifest, when it has one. Unset means the - /// artifact was stored without chunk hashing, so no range of it can be - /// checked, and a caller that needs a checkable read should learn that here - /// rather than by having a range read refused. - /// - /// Field 5: `chunk_size_bytes` - pub chunk_size_bytes: ::core::option::Option, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReadableContentView<'a> { - /**Whether required field `size_bytes` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_size_bytes(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `mime` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_mime(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `digest_algorithm` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_digest_algorithm(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `digest` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_digest(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ReadableContentView<'a> { - type Owned = super::super::ReadableContent; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.size_bytes = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.mime = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.digest_algorithm = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.digest = ::buffa::types::borrow_bytes(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.chunk_size_bytes = Some(::buffa::types::decode_uint64(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReadableContent { - size_bytes: self.size_bytes, - mime: self.mime.to_string(), - digest_algorithm: self.digest_algorithm.to_string(), - digest: (self.digest).to_vec(), - chunk_size_bytes: self.chunk_size_bytes, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReadableContentView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.size_bytes) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.mime) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.digest_algorithm) as u64; - size += 1u64 + ::buffa::types::bytes_encoded_len(&self.digest) as u64; - if let Some(v) = self.chunk_size_bytes { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.size_bytes, buf); - ::buffa::types::put_string_field(2u32, &self.mime, buf); - ::buffa::types::put_string_field(3u32, &self.digest_algorithm, buf); - ::buffa::types::put_shared_bytes_field(4u32, &self.digest, buf); - if let Some(v) = self.chunk_size_bytes { - ::buffa::types::put_uint64_field(5u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReadableContentView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "sizeBytes", - &::buffa::json_helpers::ProtoJson(&self.size_bytes), - )?; - } - { - __map.serialize_entry("mime", self.mime)?; - } - { - __map.serialize_entry("digestAlgorithm", self.digest_algorithm)?; - } - { - __map - .serialize_entry( - "digest", - &::buffa::json_helpers::BytesJson(self.digest), - )?; - } - if let ::core::option::Option::Some(__v) = self.chunk_size_bytes { - __map - .serialize_entry( - "chunkSizeBytes", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReadableContentView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "ReadableContent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.ReadableContent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ReadableContent"; -} -::buffa::impl_default_view_instance!(ReadableContentView); -::buffa::impl_view_reborrow!(ReadableContentView); -/** Self-contained, `'static` owned view of a `ReadableContent` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReadableContentView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReadableContentView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReadableContentOwnedView(::buffa::OwnedView>); -impl ReadableContentOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReadableContentOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReadableContentOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReadableContent, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReadableContentOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReadableContentView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReadableContentView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReadableContent { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `size_bytes` - #[must_use] - pub fn size_bytes(&self) -> u64 { - self.0.reborrow().size_bytes - } - /// Decoded media type of the stored bytes. - /// - /// Field 2: `mime` - #[must_use] - pub fn mime(&self) -> &'_ str { - self.0.reborrow().mime - } - /// Hash algorithm of `digest`, for example "sha256". - /// - /// Field 3: `digest_algorithm` - #[must_use] - pub fn digest_algorithm(&self) -> &'_ str { - self.0.reborrow().digest_algorithm - } - /// Content digest over the whole artifact, as recorded on the log. Checking a - /// range against this one requires reading every byte, which is what - /// `chunk_size_bytes` exists to avoid. - /// - /// Field 4: `digest` - #[must_use] - pub fn digest(&self) -> &'_ [u8] { - self.0.reborrow().digest - } - /// Chunk size of this artifact's manifest, when it has one. Unset means the - /// artifact was stored without chunk hashing, so no range of it can be - /// checked, and a caller that needs a checkable read should learn that here - /// rather than by having a range read refused. - /// - /// Field 5: `chunk_size_bytes` - #[must_use] - pub fn chunk_size_bytes(&self) -> ::core::option::Option { - self.0.reborrow().chunk_size_bytes - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReadableContentOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReadableContentOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReadableContentOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReadableContentOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReadableContent { - type View<'a> = ReadableContentView<'a>; - type ViewHandle = ReadableContentOwnedView; -} -impl ::serde::Serialize for ReadableContentOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.stat_artifact.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.stat_artifact.rs deleted file mode 100644 index 27b1d0c39..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.artifacts.v1alpha1.stat_artifact.rs +++ /dev/null @@ -1,601 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/artifacts/v1alpha1/stat_artifact.proto - -/// StatArtifactRequest asks what an artifact is, without asking for it. -/// -/// There is deliberately no field on this request that could cause bytes to be -/// returned: no range, no "include content", no size threshold under which the -/// content comes along. A caller reaching for metadata about a 40 MB artifact -/// must not be able to fetch 40 MB by setting a field wrong, and a reviewer must -/// not have to read a value to know a call was cheap. This is the same -/// structural argument that gives DiagnoseSession no repair mode. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct StatArtifactRequest { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `artifact_id` - #[serde( - rename = "artifactId", - alias = "artifact_id", - with = "::buffa::json_helpers::proto_string" - )] - pub artifact_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for StatArtifactRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("StatArtifactRequest") - .field("session_id", &self.session_id) - .field("artifact_id", &self.artifact_id) - .finish() - } -} -impl StatArtifactRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.StatArtifactRequest"; -} -::buffa::impl_default_instance!(StatArtifactRequest); -impl ::buffa::MessageName for StatArtifactRequest { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "StatArtifactRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.StatArtifactRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.StatArtifactRequest"; -} -impl ::buffa::Message for StatArtifactRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.artifact_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.artifact_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.artifact_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for StatArtifactRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __STAT_ARTIFACT_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.StatArtifactRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// StatArtifactResponse describes the artifact and what can be done with it. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct StatArtifactResponse { - /// Field 1: `artifact_id` - #[serde( - rename = "artifactId", - alias = "artifact_id", - with = "::buffa::json_helpers::proto_string" - )] - pub artifact_id: ::buffa::alloc::string::String, - /// Field 2: `availability` - #[serde(rename = "availability", with = "::buffa::json_helpers::proto_enum")] - pub availability: ::buffa::EnumValue, - /// Short human-readable preview recorded with the artifact; empty when none - /// was produced. Present regardless of availability, because a preview is - /// recorded on the log rather than stored with the bytes and so survives their - /// erasure or loss. For many callers this is the whole answer, and the reason - /// a preview is not a range read is that it costs nothing to serve. - /// - /// Field 3: `preview` - #[serde(rename = "preview", skip_serializing_if = "::core::option::Option::is_none")] - pub preview: ::core::option::Option<::buffa::alloc::string::String>, - /// True when preview is a truncation of the full content. - /// - /// Field 4: `preview_truncated` - #[serde( - rename = "previewTruncated", - alias = "preview_truncated", - with = "::buffa::json_helpers::proto_bool" - )] - pub preview_truncated: bool, - /// Set only for ARTIFACT_AVAILABILITY_AVAILABLE. Every other availability has - /// no readable bytes to describe, and a size or digest reported next to one of - /// them would describe something the caller cannot obtain. - /// - /// Field 5: `content` - #[serde( - rename = "content", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub content: ::buffa::MessageField< - ReadableContent, - ::buffa::Inline, - >, - /// When availability was determined. Availability is an observation of an - /// external store at a moment, not a durable property of the artifact, and a - /// caller acting on it later is acting on a claim that has since expired. - /// - /// Field 6: `observed_at` - #[serde(rename = "observedAt", alias = "observed_at")] - pub observed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for StatArtifactResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("StatArtifactResponse") - .field("artifact_id", &self.artifact_id) - .field("availability", &self.availability) - .field("preview", &self.preview) - .field("preview_truncated", &self.preview_truncated) - .field("content", &self.content) - .field("observed_at", &self.observed_at) - .finish() - } -} -impl StatArtifactResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.StatArtifactResponse"; -} -impl StatArtifactResponse { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::preview`] to `Some(value)`, consuming and returning `self`. - pub fn with_preview( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.preview = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(StatArtifactResponse); -impl ::buffa::MessageName for StatArtifactResponse { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "StatArtifactResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.StatArtifactResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.StatArtifactResponse"; -} -impl ::buffa::Message for StatArtifactResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - { - let val = self.availability.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.preview { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - if self.content.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.content.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.artifact_id, buf); - ::buffa::types::put_int32_field(2u32, self.availability.to_i32(), buf); - if let Some(ref v) = self.preview { - ::buffa::types::put_string_field(3u32, v, buf); - } - ::buffa::types::put_bool_field(4u32, self.preview_truncated, buf); - if self.content.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.content.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.artifact_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.availability = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.preview.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.preview_truncated = ::buffa::types::decode_bool(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.content.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.artifact_id.clear(); - self.availability = ::buffa::EnumValue::from(0); - self.preview = ::core::option::Option::None; - self.preview_truncated = false; - self.content = ::buffa::MessageField::none(); - self.observed_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for StatArtifactResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __STAT_ARTIFACT_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.StatArtifactResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ReadableContent describes bytes a caller can actually get. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReadableContent { - /// Field 1: `size_bytes` - #[serde( - rename = "sizeBytes", - alias = "size_bytes", - with = "::buffa::json_helpers::uint64" - )] - pub size_bytes: u64, - /// Decoded media type of the stored bytes. - /// - /// Field 2: `mime` - #[serde(rename = "mime", with = "::buffa::json_helpers::proto_string")] - pub mime: ::buffa::alloc::string::String, - /// Hash algorithm of `digest`, for example "sha256". - /// - /// Field 3: `digest_algorithm` - #[serde( - rename = "digestAlgorithm", - alias = "digest_algorithm", - with = "::buffa::json_helpers::proto_string" - )] - pub digest_algorithm: ::buffa::alloc::string::String, - /// Content digest over the whole artifact, as recorded on the log. Checking a - /// range against this one requires reading every byte, which is what - /// `chunk_size_bytes` exists to avoid. - /// - /// Field 4: `digest` - #[serde(rename = "digest", with = "::buffa::json_helpers::bytes")] - pub digest: ::buffa::alloc::vec::Vec, - /// Chunk size of this artifact's manifest, when it has one. Unset means the - /// artifact was stored without chunk hashing, so no range of it can be - /// checked, and a caller that needs a checkable read should learn that here - /// rather than by having a range read refused. - /// - /// Field 5: `chunk_size_bytes` - #[serde( - rename = "chunkSizeBytes", - alias = "chunk_size_bytes", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub chunk_size_bytes: ::core::option::Option, -} -impl ::core::fmt::Debug for ReadableContent { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReadableContent") - .field("size_bytes", &self.size_bytes) - .field("mime", &self.mime) - .field("digest_algorithm", &self.digest_algorithm) - .field("digest", &self.digest) - .field("chunk_size_bytes", &self.chunk_size_bytes) - .finish() - } -} -impl ReadableContent { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ReadableContent"; -} -impl ReadableContent { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::chunk_size_bytes`] to `Some(value)`, consuming and returning `self`. - pub fn with_chunk_size_bytes(mut self, value: u64) -> Self { - self.chunk_size_bytes = Some(value); - self - } -} -::buffa::impl_default_instance!(ReadableContent); -impl ::buffa::MessageName for ReadableContent { - const PACKAGE: &'static str = "trogonai.session.sessions.artifacts.v1alpha1"; - const NAME: &'static str = "ReadableContent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.artifacts.v1alpha1.ReadableContent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ReadableContent"; -} -impl ::buffa::Message for ReadableContent { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.size_bytes) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.mime) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.digest_algorithm) as u64; - size += 1u64 + ::buffa::types::bytes_encoded_len(&self.digest) as u64; - if let Some(v) = self.chunk_size_bytes { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.size_bytes, buf); - ::buffa::types::put_string_field(2u32, &self.mime, buf); - ::buffa::types::put_string_field(3u32, &self.digest_algorithm, buf); - ::buffa::types::put_shared_bytes_field(4u32, &self.digest, buf); - if let Some(v) = self.chunk_size_bytes { - ::buffa::types::put_uint64_field(5u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.size_bytes = ::buffa::types::decode_uint64(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.mime, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.digest_algorithm, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes(&mut self.digest, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.chunk_size_bytes = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.size_bytes = 0u64; - self.mime.clear(); - self.digest_algorithm.clear(); - self.digest.clear(); - self.chunk_size_bytes = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReadableContent { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __READABLE_CONTENT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.artifacts.v1alpha1.ReadableContent", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.diff.v1alpha1.mod.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.diff.v1alpha1.mod.rs deleted file mode 100644 index 82ad94ba7..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.diff.v1alpha1.mod.rs +++ /dev/null @@ -1,43 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. - -include!("trogonai.session.sessions.diff.v1alpha1.structured_diff.rs"); -#[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception -)] -pub mod __buffa { - #[allow(unused_imports)] - use super::*; - pub mod view { - #[allow(unused_imports)] - use super::*; - include!("trogonai.session.sessions.diff.v1alpha1.structured_diff.__view.rs"); - } - /// Register this package's `Any` type entries and extension entries. - pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) { - reg.register_json_any(super::__STRUCTURED_DIFF_JSON_ANY); - reg.register_json_any(super::__DIFF_HUNK_JSON_ANY); - reg.register_json_any(super::__DIFF_LINE_JSON_ANY); - } -} -#[doc(inline)] -pub use self::__buffa::view::StructuredDiffView; -#[doc(inline)] -pub use self::__buffa::view::StructuredDiffOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DiffHunkView; -#[doc(inline)] -pub use self::__buffa::view::DiffHunkOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DiffLineView; -#[doc(inline)] -pub use self::__buffa::view::DiffLineOwnedView; -#[doc(inline)] -pub use self::__buffa::register_types; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.diff.v1alpha1.structured_diff.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.diff.v1alpha1.structured_diff.__view.rs deleted file mode 100644 index f7ae72e45..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.diff.v1alpha1.structured_diff.__view.rs +++ /dev/null @@ -1,1132 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/diff/v1alpha1/structured_diff.proto - -/// Structured diff artifact content for a recorded file change. -/// -/// This is artifact payload, not an event. It sits behind -/// `DiffSummary.rendered`, which is a claim-check like any other, and a reader -/// finds it there by the media type on `ArtifactRef.mime`. The alternative was -/// putting hunks on FileChanged, which would put a presentation shape into a log -/// that is never truncated (ADR#0035 facet 7): every review UI decision about how -/// much context to show would become permanent history. -/// -/// It is defined in its own subtree and does not import the write-side types -/// (ADR#0035 facet 3). A diff format changes for rendering reasons, on a review -/// tool's schedule, and nothing about the session domain should have to move when -/// it does. -/// -/// The counts on DiffSummary stay authoritative and are never recomputed from -/// this. `DiffSummary.truncated` exists precisely because the artifact may omit -/// hunks while the inline counts remain exact, so a reader that recounts from the -/// hunks here will get a smaller number and will be wrong. -/// -/// StructuredDiff is a parsed diff for one file change. -#[derive(Clone, Debug, Default)] -pub struct StructuredDiffView<'a> { - /// Version of this structure's semantics, incremented when the meaning of an - /// existing field changes rather than when fields are added. - /// - /// It is here and not only in the media type because an artifact outlives the - /// reference that found it. A stored diff read years later through a generic - /// artifact path has to be able to say what it is without the mime string that - /// was attached to the claim-check. - /// - /// Field 1: `format_version` - pub format_version: u32, - /// Field 2: `hunks` - pub hunks: ::buffa::RepeatedView<'a, super::super::__buffa::view::DiffHunkView<'a>>, - /// True when hunks were omitted. Mirrors DiffSummary.truncated so the artifact - /// is self-describing: a consumer holding only these bytes must be able to tell - /// a complete diff from a partial one without the summary that pointed at it. - /// - /// Field 3: `truncated` - pub truncated: bool, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> StructuredDiffView<'a> { - /**Whether required field `format_version` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_format_version(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `truncated` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_truncated(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for StructuredDiffView<'a> { - type Owned = super::super::StructuredDiff; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.format_version = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.truncated = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::(), - )?; - view.hunks - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::StructuredDiff { - format_version: self.format_version, - hunks: self - .hunks - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - truncated: self.truncated, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for StructuredDiffView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.format_version) as u64; - for v in &self.hunks { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.format_version, buf); - for v in &self.hunks { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - ::buffa::types::put_bool_field(3u32, self.truncated, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for StructuredDiffView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "formatVersion", - &::buffa::json_helpers::ProtoJson(&self.format_version), - )?; - } - if !self.hunks.is_empty() { - __map.serialize_entry("hunks", &*self.hunks)?; - } - { - __map.serialize_entry("truncated", &self.truncated)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for StructuredDiffView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.diff.v1alpha1"; - const NAME: &'static str = "StructuredDiff"; - const FULL_NAME: &'static str = "trogonai.session.sessions.diff.v1alpha1.StructuredDiff"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.diff.v1alpha1.StructuredDiff"; -} -::buffa::impl_default_view_instance!(StructuredDiffView); -::buffa::impl_view_reborrow!(StructuredDiffView); -/** Self-contained, `'static` owned view of a `StructuredDiff` message. - - Wraps [`::buffa::OwnedView`]`<`[`StructuredDiffView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`StructuredDiffView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct StructuredDiffOwnedView(::buffa::OwnedView>); -impl StructuredDiffOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StructuredDiffOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StructuredDiffOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::StructuredDiff, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StructuredDiffOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`StructuredDiffView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &StructuredDiffView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::StructuredDiff { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Version of this structure's semantics, incremented when the meaning of an - /// existing field changes rather than when fields are added. - /// - /// It is here and not only in the media type because an artifact outlives the - /// reference that found it. A stored diff read years later through a generic - /// artifact path has to be able to say what it is without the mime string that - /// was attached to the claim-check. - /// - /// Field 1: `format_version` - #[must_use] - pub fn format_version(&self) -> u32 { - self.0.reborrow().format_version - } - /// Field 2: `hunks` - #[must_use] - pub fn hunks( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::DiffHunkView<'_>> { - &self.0.reborrow().hunks - } - /// True when hunks were omitted. Mirrors DiffSummary.truncated so the artifact - /// is self-describing: a consumer holding only these bytes must be able to tell - /// a complete diff from a partial one without the summary that pointed at it. - /// - /// Field 3: `truncated` - #[must_use] - pub fn truncated(&self) -> bool { - self.0.reborrow().truncated - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for StructuredDiffOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - StructuredDiffOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: StructuredDiffOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for StructuredDiffOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::StructuredDiff { - type View<'a> = StructuredDiffView<'a>; - type ViewHandle = StructuredDiffOwnedView; -} -impl ::serde::Serialize for StructuredDiffOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// DiffHunk is one contiguous region of change with its surrounding context. -#[derive(Clone, Debug, Default)] -pub struct DiffHunkView<'a> { - /// First line of this hunk in the before-content, 1-based. Zero when the - /// before-content does not exist, which is the create case. - /// - /// Field 1: `old_start` - pub old_start: u32, - /// First line of this hunk in the after-content, 1-based. Zero when the - /// after-content does not exist, which is the delete case. - /// - /// Field 2: `new_start` - pub new_start: u32, - /// Section heading a renderer can show above the hunk, such as the enclosing - /// function. Empty when none was determined. - /// - /// Field 3: `heading` - pub heading: ::core::option::Option<&'a str>, - /// Field 4: `lines` - pub lines: ::buffa::RepeatedView<'a, super::super::__buffa::view::DiffLineView<'a>>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DiffHunkView<'a> { - /**Whether required field `old_start` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_old_start(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `new_start` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_new_start(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for DiffHunkView<'a> { - type Owned = super::super::DiffHunk; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.old_start = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.new_start = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.heading = Some(::buffa::types::borrow_str(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::(), - )?; - view.lines - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DiffHunk { - old_start: self.old_start, - new_start: self.new_start, - heading: self.heading.map(|s| s.to_string()), - lines: self - .lines - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DiffHunkView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.old_start) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.new_start) as u64; - if let Some(ref v) = self.heading { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - for v in &self.lines { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.old_start, buf); - ::buffa::types::put_uint32_field(2u32, self.new_start, buf); - if let Some(ref v) = self.heading { - ::buffa::types::put_string_field(3u32, v, buf); - } - for v in &self.lines { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DiffHunkView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "oldStart", - &::buffa::json_helpers::ProtoJson(&self.old_start), - )?; - } - { - __map - .serialize_entry( - "newStart", - &::buffa::json_helpers::ProtoJson(&self.new_start), - )?; - } - if let ::core::option::Option::Some(__v) = self.heading { - __map.serialize_entry("heading", __v)?; - } - if !self.lines.is_empty() { - __map.serialize_entry("lines", &*self.lines)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DiffHunkView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.diff.v1alpha1"; - const NAME: &'static str = "DiffHunk"; - const FULL_NAME: &'static str = "trogonai.session.sessions.diff.v1alpha1.DiffHunk"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.diff.v1alpha1.DiffHunk"; -} -::buffa::impl_default_view_instance!(DiffHunkView); -::buffa::impl_view_reborrow!(DiffHunkView); -/** Self-contained, `'static` owned view of a `DiffHunk` message. - - Wraps [`::buffa::OwnedView`]`<`[`DiffHunkView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DiffHunkView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DiffHunkOwnedView(::buffa::OwnedView>); -impl DiffHunkOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok(DiffHunkOwnedView(::buffa::OwnedView::decode(bytes)?)) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DiffHunkOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DiffHunk, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DiffHunkOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DiffHunkView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DiffHunkView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DiffHunk { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// First line of this hunk in the before-content, 1-based. Zero when the - /// before-content does not exist, which is the create case. - /// - /// Field 1: `old_start` - #[must_use] - pub fn old_start(&self) -> u32 { - self.0.reborrow().old_start - } - /// First line of this hunk in the after-content, 1-based. Zero when the - /// after-content does not exist, which is the delete case. - /// - /// Field 2: `new_start` - #[must_use] - pub fn new_start(&self) -> u32 { - self.0.reborrow().new_start - } - /// Section heading a renderer can show above the hunk, such as the enclosing - /// function. Empty when none was determined. - /// - /// Field 3: `heading` - #[must_use] - pub fn heading(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().heading - } - /// Field 4: `lines` - #[must_use] - pub fn lines( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::DiffLineView<'_>> { - &self.0.reborrow().lines - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DiffHunkOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DiffHunkOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DiffHunkOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DiffHunkOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DiffHunk { - type View<'a> = DiffHunkView<'a>; - type ViewHandle = DiffHunkOwnedView; -} -impl ::serde::Serialize for DiffHunkOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// DiffLine is one line of a hunk. -#[derive(Clone, Debug, Default)] -pub struct DiffLineView<'a> { - /// Field 1: `kind` - pub kind: ::buffa::EnumValue, - /// Line content without its trailing newline and without a leading diff marker. - /// The marker is `kind`, so a renderer never has to strip one character off the - /// front of the text and hope it was punctuation rather than content. - /// - /// Empty for LINE_KIND_ELIDED, which stands for lines that are not here. - /// - /// Field 2: `text` - pub text: ::core::option::Option<&'a str>, - /// Line number in the before-content, 1-based. Unset for an added line, which - /// has no position there. Absent rather than zero, so "this line did not exist - /// before" cannot be read as "line zero". - /// - /// Field 3: `old_line` - pub old_line: ::core::option::Option, - /// Line number in the after-content, 1-based. Unset for a removed line. - /// - /// Field 4: `new_line` - pub new_line: ::core::option::Option, - /// How many lines LINE_KIND_ELIDED stands in for. Zero for every other kind. - /// - /// Field 5: `elided_count` - pub elided_count: ::core::option::Option, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DiffLineView<'a> { - /**Whether required field `kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_kind(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for DiffLineView<'a> { - type Owned = super::super::DiffLine; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.text = Some(::buffa::types::borrow_str(&mut cur)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.old_line = Some(::buffa::types::decode_uint32(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.new_line = Some(::buffa::types::decode_uint32(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.elided_count = Some(::buffa::types::decode_uint32(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DiffLine { - kind: self.kind, - text: self.text.map(|s| s.to_string()), - old_line: self.old_line, - new_line: self.new_line, - elided_count: self.elided_count, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DiffLineView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.text { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(v) = self.old_line { - size += 1u64 + ::buffa::types::uint32_encoded_len(v) as u64; - } - if let Some(v) = self.new_line { - size += 1u64 + ::buffa::types::uint32_encoded_len(v) as u64; - } - if let Some(v) = self.elided_count { - size += 1u64 + ::buffa::types::uint32_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.kind.to_i32(), buf); - if let Some(ref v) = self.text { - ::buffa::types::put_string_field(2u32, v, buf); - } - if let Some(v) = self.old_line { - ::buffa::types::put_uint32_field(3u32, v, buf); - } - if let Some(v) = self.new_line { - ::buffa::types::put_uint32_field(4u32, v, buf); - } - if let Some(v) = self.elided_count { - ::buffa::types::put_uint32_field(5u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DiffLineView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("kind", &self.kind)?; - } - if let ::core::option::Option::Some(__v) = self.text { - __map.serialize_entry("text", __v)?; - } - if let ::core::option::Option::Some(__v) = self.old_line { - __map.serialize_entry("oldLine", &::buffa::json_helpers::ProtoJson(&__v))?; - } - if let ::core::option::Option::Some(__v) = self.new_line { - __map.serialize_entry("newLine", &::buffa::json_helpers::ProtoJson(&__v))?; - } - if let ::core::option::Option::Some(__v) = self.elided_count { - __map - .serialize_entry( - "elidedCount", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DiffLineView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.diff.v1alpha1"; - const NAME: &'static str = "DiffLine"; - const FULL_NAME: &'static str = "trogonai.session.sessions.diff.v1alpha1.DiffLine"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.diff.v1alpha1.DiffLine"; -} -::buffa::impl_default_view_instance!(DiffLineView); -::buffa::impl_view_reborrow!(DiffLineView); -/** Self-contained, `'static` owned view of a `DiffLine` message. - - Wraps [`::buffa::OwnedView`]`<`[`DiffLineView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DiffLineView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DiffLineOwnedView(::buffa::OwnedView>); -impl DiffLineOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok(DiffLineOwnedView(::buffa::OwnedView::decode(bytes)?)) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DiffLineOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DiffLine, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DiffLineOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DiffLineView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DiffLineView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DiffLine { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `kind` - #[must_use] - pub fn kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().kind - } - /// Line content without its trailing newline and without a leading diff marker. - /// The marker is `kind`, so a renderer never has to strip one character off the - /// front of the text and hope it was punctuation rather than content. - /// - /// Empty for LINE_KIND_ELIDED, which stands for lines that are not here. - /// - /// Field 2: `text` - #[must_use] - pub fn text(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().text - } - /// Line number in the before-content, 1-based. Unset for an added line, which - /// has no position there. Absent rather than zero, so "this line did not exist - /// before" cannot be read as "line zero". - /// - /// Field 3: `old_line` - #[must_use] - pub fn old_line(&self) -> ::core::option::Option { - self.0.reborrow().old_line - } - /// Line number in the after-content, 1-based. Unset for a removed line. - /// - /// Field 4: `new_line` - #[must_use] - pub fn new_line(&self) -> ::core::option::Option { - self.0.reborrow().new_line - } - /// How many lines LINE_KIND_ELIDED stands in for. Zero for every other kind. - /// - /// Field 5: `elided_count` - #[must_use] - pub fn elided_count(&self) -> ::core::option::Option { - self.0.reborrow().elided_count - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DiffLineOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DiffLineOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DiffLineOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DiffLineOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DiffLine { - type View<'a> = DiffLineView<'a>; - type ViewHandle = DiffLineOwnedView; -} -impl ::serde::Serialize for DiffLineOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.diff.v1alpha1.structured_diff.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.diff.v1alpha1.structured_diff.rs deleted file mode 100644 index 0de9648ed..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.diff.v1alpha1.structured_diff.rs +++ /dev/null @@ -1,812 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/diff/v1alpha1/structured_diff.proto - -/// LineKind is what a line represents in the change. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum LineKind { - LINE_KIND_UNSPECIFIED = 0i32, - /// Unchanged, present for context. - LINE_KIND_CONTEXT = 1i32, - LINE_KIND_ADDED = 2i32, - LINE_KIND_REMOVED = 3i32, - /// A run of lines omitted from this artifact. It carries a count instead of - /// text, so a renderer can show that content is missing rather than joining two - /// distant regions into what looks like adjacent code. - LINE_KIND_ELIDED = 4i32, -} -impl LineKind { - ///Idiomatic alias for [`Self::LINE_KIND_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::LINE_KIND_UNSPECIFIED; - ///Idiomatic alias for [`Self::LINE_KIND_CONTEXT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Context: Self = Self::LINE_KIND_CONTEXT; - ///Idiomatic alias for [`Self::LINE_KIND_ADDED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Added: Self = Self::LINE_KIND_ADDED; - ///Idiomatic alias for [`Self::LINE_KIND_REMOVED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Removed: Self = Self::LINE_KIND_REMOVED; - ///Idiomatic alias for [`Self::LINE_KIND_ELIDED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Elided: Self = Self::LINE_KIND_ELIDED; -} -impl ::core::default::Default for LineKind { - fn default() -> Self { - Self::LINE_KIND_UNSPECIFIED - } -} -impl ::serde::Serialize for LineKind { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for LineKind { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = LineKind; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(LineKind)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for LineKind { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for LineKind { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::LINE_KIND_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::LINE_KIND_CONTEXT), - 2i32 => ::core::option::Option::Some(Self::LINE_KIND_ADDED), - 3i32 => ::core::option::Option::Some(Self::LINE_KIND_REMOVED), - 4i32 => ::core::option::Option::Some(Self::LINE_KIND_ELIDED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::LINE_KIND_UNSPECIFIED => "LINE_KIND_UNSPECIFIED", - Self::LINE_KIND_CONTEXT => "LINE_KIND_CONTEXT", - Self::LINE_KIND_ADDED => "LINE_KIND_ADDED", - Self::LINE_KIND_REMOVED => "LINE_KIND_REMOVED", - Self::LINE_KIND_ELIDED => "LINE_KIND_ELIDED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "LINE_KIND_UNSPECIFIED" => { - ::core::option::Option::Some(Self::LINE_KIND_UNSPECIFIED) - } - "LINE_KIND_CONTEXT" => ::core::option::Option::Some(Self::LINE_KIND_CONTEXT), - "LINE_KIND_ADDED" => ::core::option::Option::Some(Self::LINE_KIND_ADDED), - "LINE_KIND_REMOVED" => ::core::option::Option::Some(Self::LINE_KIND_REMOVED), - "LINE_KIND_ELIDED" => ::core::option::Option::Some(Self::LINE_KIND_ELIDED), - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::LINE_KIND_UNSPECIFIED, - Self::LINE_KIND_CONTEXT, - Self::LINE_KIND_ADDED, - Self::LINE_KIND_REMOVED, - Self::LINE_KIND_ELIDED, - ] - } -} -/// Structured diff artifact content for a recorded file change. -/// -/// This is artifact payload, not an event. It sits behind -/// `DiffSummary.rendered`, which is a claim-check like any other, and a reader -/// finds it there by the media type on `ArtifactRef.mime`. The alternative was -/// putting hunks on FileChanged, which would put a presentation shape into a log -/// that is never truncated (ADR#0035 facet 7): every review UI decision about how -/// much context to show would become permanent history. -/// -/// It is defined in its own subtree and does not import the write-side types -/// (ADR#0035 facet 3). A diff format changes for rendering reasons, on a review -/// tool's schedule, and nothing about the session domain should have to move when -/// it does. -/// -/// The counts on DiffSummary stay authoritative and are never recomputed from -/// this. `DiffSummary.truncated` exists precisely because the artifact may omit -/// hunks while the inline counts remain exact, so a reader that recounts from the -/// hunks here will get a smaller number and will be wrong. -/// -/// StructuredDiff is a parsed diff for one file change. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct StructuredDiff { - /// Version of this structure's semantics, incremented when the meaning of an - /// existing field changes rather than when fields are added. - /// - /// It is here and not only in the media type because an artifact outlives the - /// reference that found it. A stored diff read years later through a generic - /// artifact path has to be able to say what it is without the mime string that - /// was attached to the claim-check. - /// - /// Field 1: `format_version` - #[serde( - rename = "formatVersion", - alias = "format_version", - with = "::buffa::json_helpers::uint32" - )] - pub format_version: u32, - /// Field 2: `hunks` - #[serde( - rename = "hunks", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub hunks: ::buffa::alloc::vec::Vec, - /// True when hunks were omitted. Mirrors DiffSummary.truncated so the artifact - /// is self-describing: a consumer holding only these bytes must be able to tell - /// a complete diff from a partial one without the summary that pointed at it. - /// - /// Field 3: `truncated` - #[serde(rename = "truncated", with = "::buffa::json_helpers::proto_bool")] - pub truncated: bool, -} -impl ::core::fmt::Debug for StructuredDiff { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("StructuredDiff") - .field("format_version", &self.format_version) - .field("hunks", &self.hunks) - .field("truncated", &self.truncated) - .finish() - } -} -impl StructuredDiff { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.diff.v1alpha1.StructuredDiff"; -} -::buffa::impl_default_instance!(StructuredDiff); -impl ::buffa::MessageName for StructuredDiff { - const PACKAGE: &'static str = "trogonai.session.sessions.diff.v1alpha1"; - const NAME: &'static str = "StructuredDiff"; - const FULL_NAME: &'static str = "trogonai.session.sessions.diff.v1alpha1.StructuredDiff"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.diff.v1alpha1.StructuredDiff"; -} -impl ::buffa::Message for StructuredDiff { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.format_version) as u64; - for v in &self.hunks { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.format_version, buf); - for v in &self.hunks { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - ::buffa::types::put_bool_field(3u32, self.truncated, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.format_version = ::buffa::types::decode_uint32(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.hunks.push(elem); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.truncated = ::buffa::types::decode_bool(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.format_version = 0u32; - self.hunks.clear(); - self.truncated = false; - } -} -impl ::buffa::json_helpers::ProtoElemJson for StructuredDiff { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __STRUCTURED_DIFF_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.diff.v1alpha1.StructuredDiff", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// DiffHunk is one contiguous region of change with its surrounding context. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DiffHunk { - /// First line of this hunk in the before-content, 1-based. Zero when the - /// before-content does not exist, which is the create case. - /// - /// Field 1: `old_start` - #[serde( - rename = "oldStart", - alias = "old_start", - with = "::buffa::json_helpers::uint32" - )] - pub old_start: u32, - /// First line of this hunk in the after-content, 1-based. Zero when the - /// after-content does not exist, which is the delete case. - /// - /// Field 2: `new_start` - #[serde( - rename = "newStart", - alias = "new_start", - with = "::buffa::json_helpers::uint32" - )] - pub new_start: u32, - /// Section heading a renderer can show above the hunk, such as the enclosing - /// function. Empty when none was determined. - /// - /// Field 3: `heading` - #[serde(rename = "heading", skip_serializing_if = "::core::option::Option::is_none")] - pub heading: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 4: `lines` - #[serde( - rename = "lines", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub lines: ::buffa::alloc::vec::Vec, -} -impl ::core::fmt::Debug for DiffHunk { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DiffHunk") - .field("old_start", &self.old_start) - .field("new_start", &self.new_start) - .field("heading", &self.heading) - .field("lines", &self.lines) - .finish() - } -} -impl DiffHunk { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.diff.v1alpha1.DiffHunk"; -} -impl DiffHunk { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::heading`] to `Some(value)`, consuming and returning `self`. - pub fn with_heading( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.heading = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(DiffHunk); -impl ::buffa::MessageName for DiffHunk { - const PACKAGE: &'static str = "trogonai.session.sessions.diff.v1alpha1"; - const NAME: &'static str = "DiffHunk"; - const FULL_NAME: &'static str = "trogonai.session.sessions.diff.v1alpha1.DiffHunk"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.diff.v1alpha1.DiffHunk"; -} -impl ::buffa::Message for DiffHunk { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.old_start) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.new_start) as u64; - if let Some(ref v) = self.heading { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - for v in &self.lines { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.old_start, buf); - ::buffa::types::put_uint32_field(2u32, self.new_start, buf); - if let Some(ref v) = self.heading { - ::buffa::types::put_string_field(3u32, v, buf); - } - for v in &self.lines { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.old_start = ::buffa::types::decode_uint32(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.new_start = ::buffa::types::decode_uint32(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.heading.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.lines.push(elem); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.old_start = 0u32; - self.new_start = 0u32; - self.heading = ::core::option::Option::None; - self.lines.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for DiffHunk { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DIFF_HUNK_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.diff.v1alpha1.DiffHunk", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// DiffLine is one line of a hunk. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DiffLine { - /// Field 1: `kind` - #[serde(rename = "kind", with = "::buffa::json_helpers::proto_enum")] - pub kind: ::buffa::EnumValue, - /// Line content without its trailing newline and without a leading diff marker. - /// The marker is `kind`, so a renderer never has to strip one character off the - /// front of the text and hope it was punctuation rather than content. - /// - /// Empty for LINE_KIND_ELIDED, which stands for lines that are not here. - /// - /// Field 2: `text` - #[serde(rename = "text", skip_serializing_if = "::core::option::Option::is_none")] - pub text: ::core::option::Option<::buffa::alloc::string::String>, - /// Line number in the before-content, 1-based. Unset for an added line, which - /// has no position there. Absent rather than zero, so "this line did not exist - /// before" cannot be read as "line zero". - /// - /// Field 3: `old_line` - #[serde( - rename = "oldLine", - alias = "old_line", - with = "::buffa::json_helpers::opt_uint32", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub old_line: ::core::option::Option, - /// Line number in the after-content, 1-based. Unset for a removed line. - /// - /// Field 4: `new_line` - #[serde( - rename = "newLine", - alias = "new_line", - with = "::buffa::json_helpers::opt_uint32", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub new_line: ::core::option::Option, - /// How many lines LINE_KIND_ELIDED stands in for. Zero for every other kind. - /// - /// Field 5: `elided_count` - #[serde( - rename = "elidedCount", - alias = "elided_count", - with = "::buffa::json_helpers::opt_uint32", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub elided_count: ::core::option::Option, -} -impl ::core::fmt::Debug for DiffLine { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DiffLine") - .field("kind", &self.kind) - .field("text", &self.text) - .field("old_line", &self.old_line) - .field("new_line", &self.new_line) - .field("elided_count", &self.elided_count) - .finish() - } -} -impl DiffLine { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.diff.v1alpha1.DiffLine"; -} -impl DiffLine { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::text`] to `Some(value)`, consuming and returning `self`. - pub fn with_text( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.text = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::old_line`] to `Some(value)`, consuming and returning `self`. - pub fn with_old_line(mut self, value: u32) -> Self { - self.old_line = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::new_line`] to `Some(value)`, consuming and returning `self`. - pub fn with_new_line(mut self, value: u32) -> Self { - self.new_line = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::elided_count`] to `Some(value)`, consuming and returning `self`. - pub fn with_elided_count(mut self, value: u32) -> Self { - self.elided_count = Some(value); - self - } -} -::buffa::impl_default_instance!(DiffLine); -impl ::buffa::MessageName for DiffLine { - const PACKAGE: &'static str = "trogonai.session.sessions.diff.v1alpha1"; - const NAME: &'static str = "DiffLine"; - const FULL_NAME: &'static str = "trogonai.session.sessions.diff.v1alpha1.DiffLine"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.diff.v1alpha1.DiffLine"; -} -impl ::buffa::Message for DiffLine { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.text { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(v) = self.old_line { - size += 1u64 + ::buffa::types::uint32_encoded_len(v) as u64; - } - if let Some(v) = self.new_line { - size += 1u64 + ::buffa::types::uint32_encoded_len(v) as u64; - } - if let Some(v) = self.elided_count { - size += 1u64 + ::buffa::types::uint32_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.kind.to_i32(), buf); - if let Some(ref v) = self.text { - ::buffa::types::put_string_field(2u32, v, buf); - } - if let Some(v) = self.old_line { - ::buffa::types::put_uint32_field(3u32, v, buf); - } - if let Some(v) = self.new_line { - ::buffa::types::put_uint32_field(4u32, v, buf); - } - if let Some(v) = self.elided_count { - ::buffa::types::put_uint32_field(5u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.kind = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.text.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.old_line = ::core::option::Option::Some( - ::buffa::types::decode_uint32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.new_line = ::core::option::Option::Some( - ::buffa::types::decode_uint32(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.elided_count = ::core::option::Option::Some( - ::buffa::types::decode_uint32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.kind = ::buffa::EnumValue::from(0); - self.text = ::core::option::Option::None; - self.old_line = ::core::option::Option::None; - self.new_line = ::core::option::Option::None; - self.elided_count = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for DiffLine { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DIFF_LINE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.diff.v1alpha1.DiffLine", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.diagnose_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.diagnose_session.__view.rs deleted file mode 100644 index 136035f50..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.diagnose_session.__view.rs +++ /dev/null @@ -1,1579 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/doctor/v1alpha1/diagnose_session.proto - -/// DiagnoseSessionRequest inspects one session and reports what disagrees. -/// -/// This operation mutates nothing. It is not a mode of a repair operation and it -/// has no flag that would make it one, because a report-only default that lives -/// in a field is one typo away from not being the default. -#[derive(Clone, Debug, Default)] -pub struct DiagnoseSessionRequestView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Checks to run. Empty runs the default set, which excludes the checks whose - /// cost scales with artifact storage rather than with the stream. - /// - /// Field 2: `checks` - pub checks: ::buffa::RepeatedView<'a, ::buffa::EnumValue>, - /// Field 3: `budget` - pub budget: ::buffa::MessageFieldView< - super::super::__buffa::view::InspectionBudgetView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DiagnoseSessionRequestView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for DiagnoseSessionRequestView<'a> { - type Owned = super::super::DiagnoseSessionRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.budget.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.budget = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { - let payload = ::buffa::types::borrow_bytes(&mut cur)?; - view.checks.reserve(::buffa::encoding::count_varints(payload)); - let mut pcur: &[u8] = payload; - while !pcur.is_empty() { - view.checks - .push( - ::buffa::EnumValue::from( - ::buffa::types::decode_int32_packed(&mut pcur)?, - ), - ); - } - } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { - view.checks - .push( - ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ), - ); - } else { - return Err( - ::buffa::encoding::wire_type_mismatch( - tag, - ::buffa::encoding::WireType::LengthDelimited, - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::DiagnoseSessionRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::DiagnoseSessionRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DiagnoseSessionRequest { - session_id: self.session_id.to_string(), - checks: self.checks.to_vec(), - budget: match self.budget.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::InspectionBudget, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DiagnoseSessionRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if !self.checks.is_empty() { - let payload: u64 = self - .checks - .iter() - .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u64) - .sum::(); - size += 1u64 + ::buffa::encoding::varint_len(payload) as u64 + payload; - } - if self.budget.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.budget.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if !self.checks.is_empty() { - let payload: u64 = self - .checks - .iter() - .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u64) - .sum::(); - ::buffa::types::put_len_delimited_header(2u32, payload, buf); - for v in &self.checks { - ::buffa::types::encode_int32(v.to_i32(), buf); - } - } - if self.budget.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.budget.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DiagnoseSessionRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - if !self.checks.is_empty() { - __map - .serialize_entry( - "checks", - &::buffa::json_helpers::EnumSeqJson(&self.checks), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.budget.as_option() { - __map.serialize_entry("budget", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DiagnoseSessionRequestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "DiagnoseSessionRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.DiagnoseSessionRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.DiagnoseSessionRequest"; -} -::buffa::impl_default_view_instance!(DiagnoseSessionRequestView); -::buffa::impl_view_reborrow!(DiagnoseSessionRequestView); -/** Self-contained, `'static` owned view of a `DiagnoseSessionRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`DiagnoseSessionRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DiagnoseSessionRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DiagnoseSessionRequestOwnedView( - ::buffa::OwnedView>, -); -impl DiagnoseSessionRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DiagnoseSessionRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DiagnoseSessionRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DiagnoseSessionRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DiagnoseSessionRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DiagnoseSessionRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DiagnoseSessionRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DiagnoseSessionRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Checks to run. Empty runs the default set, which excludes the checks whose - /// cost scales with artifact storage rather than with the stream. - /// - /// Field 2: `checks` - #[must_use] - pub fn checks( - &self, - ) -> &::buffa::RepeatedView<'_, ::buffa::EnumValue> { - &self.0.reborrow().checks - } - /// Field 3: `budget` - #[must_use] - pub fn budget( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::InspectionBudgetView<'_>, - > { - &self.0.reborrow().budget - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DiagnoseSessionRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DiagnoseSessionRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DiagnoseSessionRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DiagnoseSessionRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DiagnoseSessionRequest { - type View<'a> = DiagnoseSessionRequestView<'a>; - type ViewHandle = DiagnoseSessionRequestOwnedView; -} -impl ::serde::Serialize for DiagnoseSessionRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// InspectionBudget bounds the work a diagnosis may do. -/// -/// Inspection is unbounded by nature: verifying every artifact digest on a long -/// session means reading every artifact. Without a budget the doctor becomes a -/// load generator that operators learn not to run, and a diagnostic nobody dares -/// use is worth nothing. -/// -/// Unset fields mean the server's default, not unlimited. -#[derive(Clone, Debug, Default)] -pub struct InspectionBudgetView<'a> { - /// Field 1: `max_events_scanned` - pub max_events_scanned: ::core::option::Option, - /// Field 2: `max_artifacts_verified` - pub max_artifacts_verified: ::core::option::Option, - /// Field 3: `max_duration` - pub max_duration: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, -} -impl<'a> ::buffa::MessageView<'a> for InspectionBudgetView<'a> { - type Owned = super::super::InspectionBudget; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.max_events_scanned = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.max_artifacts_verified = Some( - ::buffa::types::decode_uint64(&mut cur)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.max_duration.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.max_duration = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::InspectionBudget { - max_events_scanned: self.max_events_scanned, - max_artifacts_verified: self.max_artifacts_verified, - max_duration: match self.max_duration.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for InspectionBudgetView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(v) = self.max_events_scanned { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.max_artifacts_verified { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.max_duration.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.max_duration.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(v) = self.max_events_scanned { - ::buffa::types::put_uint64_field(1u32, v, buf); - } - if let Some(v) = self.max_artifacts_verified { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if self.max_duration.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.max_duration.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for InspectionBudgetView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - if let ::core::option::Option::Some(__v) = self.max_events_scanned { - __map - .serialize_entry( - "maxEventsScanned", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.max_artifacts_verified { - __map - .serialize_entry( - "maxArtifactsVerified", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.max_duration.as_option() { - __map.serialize_entry("maxDuration", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for InspectionBudgetView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "InspectionBudget"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.InspectionBudget"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.InspectionBudget"; -} -::buffa::impl_default_view_instance!(InspectionBudgetView); -::buffa::impl_view_reborrow!(InspectionBudgetView); -/** Self-contained, `'static` owned view of a `InspectionBudget` message. - - Wraps [`::buffa::OwnedView`]`<`[`InspectionBudgetView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`InspectionBudgetView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct InspectionBudgetOwnedView(::buffa::OwnedView>); -impl InspectionBudgetOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - InspectionBudgetOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - InspectionBudgetOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::InspectionBudget, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - InspectionBudgetOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`InspectionBudgetView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &InspectionBudgetView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::InspectionBudget { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `max_events_scanned` - #[must_use] - pub fn max_events_scanned(&self) -> ::core::option::Option { - self.0.reborrow().max_events_scanned - } - /// Field 2: `max_artifacts_verified` - #[must_use] - pub fn max_artifacts_verified(&self) -> ::core::option::Option { - self.0.reborrow().max_artifacts_verified - } - /// Field 3: `max_duration` - #[must_use] - pub fn max_duration( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().max_duration - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for InspectionBudgetOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - InspectionBudgetOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: InspectionBudgetOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for InspectionBudgetOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::InspectionBudget { - type View<'a> = InspectionBudgetView<'a>; - type ViewHandle = InspectionBudgetOwnedView; -} -impl ::serde::Serialize for InspectionBudgetOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// DiagnoseSessionResponse is what the inspection found and, as importantly, -/// what it did not look at. -/// -/// An empty `findings` list means the session is healthy only when every entry -/// in `checks` reports CHECK_STATUS_COMPLETED. A doctor that ran out of budget -/// halfway produces the same empty list as a clean session, and an operator -/// reading only `findings` cannot tell those apart. Which checks ran is -/// therefore part of the answer, not metadata about it. -#[derive(Clone, Debug, Default)] -pub struct DiagnoseSessionResponseView<'a> { - /// Identifies this diagnosis. A repair must name it, so every mutation is - /// traceable to the report that justified it. - /// - /// Field 1: `diagnosis_id` - pub diagnosis_id: &'a str, - /// Field 2: `findings` - pub findings: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::FindingView<'a>, - >, - /// One entry per check the server considered, including checks it skipped. - /// - /// Field 3: `checks` - pub checks: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::CheckOutcomeView<'a>, - >, - /// Field 4: `observed_at` - pub observed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DiagnoseSessionResponseView<'a> { - /**Whether required field `diagnosis_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_diagnosis_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `observed_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_observed_at(&self) -> bool { - self.observed_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for DiagnoseSessionResponseView<'a> { - type Owned = super::super::DiagnoseSessionResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.diagnosis_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::(), - )?; - view.findings - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::CheckOutcomeView, - >(), - )?; - view.checks - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::DiagnoseSessionResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::DiagnoseSessionResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DiagnoseSessionResponse { - diagnosis_id: self.diagnosis_id.to_string(), - findings: self - .findings - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - checks: self - .checks - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - observed_at: match self.observed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DiagnoseSessionResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.diagnosis_id) as u64; - for v in &self.findings { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.checks { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.diagnosis_id, buf); - for v in &self.findings { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.checks { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DiagnoseSessionResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("diagnosisId", self.diagnosis_id)?; - } - if !self.findings.is_empty() { - __map.serialize_entry("findings", &*self.findings)?; - } - if !self.checks.is_empty() { - __map.serialize_entry("checks", &*self.checks)?; - } - { - if let ::core::option::Option::Some(__v) = self.observed_at.as_option() { - __map.serialize_entry("observedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DiagnoseSessionResponseView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "DiagnoseSessionResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.DiagnoseSessionResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.DiagnoseSessionResponse"; -} -::buffa::impl_default_view_instance!(DiagnoseSessionResponseView); -::buffa::impl_view_reborrow!(DiagnoseSessionResponseView); -/** Self-contained, `'static` owned view of a `DiagnoseSessionResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`DiagnoseSessionResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DiagnoseSessionResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DiagnoseSessionResponseOwnedView( - ::buffa::OwnedView>, -); -impl DiagnoseSessionResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DiagnoseSessionResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DiagnoseSessionResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DiagnoseSessionResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DiagnoseSessionResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DiagnoseSessionResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DiagnoseSessionResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DiagnoseSessionResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Identifies this diagnosis. A repair must name it, so every mutation is - /// traceable to the report that justified it. - /// - /// Field 1: `diagnosis_id` - #[must_use] - pub fn diagnosis_id(&self) -> &'_ str { - self.0.reborrow().diagnosis_id - } - /// Field 2: `findings` - #[must_use] - pub fn findings( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::FindingView<'_>> { - &self.0.reborrow().findings - } - /// One entry per check the server considered, including checks it skipped. - /// - /// Field 3: `checks` - #[must_use] - pub fn checks( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::CheckOutcomeView<'_>> { - &self.0.reborrow().checks - } - /// Field 4: `observed_at` - #[must_use] - pub fn observed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().observed_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DiagnoseSessionResponseOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DiagnoseSessionResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DiagnoseSessionResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DiagnoseSessionResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DiagnoseSessionResponse { - type View<'a> = DiagnoseSessionResponseView<'a>; - type ViewHandle = DiagnoseSessionResponseOwnedView; -} -impl ::serde::Serialize for DiagnoseSessionResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// CheckOutcome is whether a check actually ran. -#[derive(Clone, Debug, Default)] -pub struct CheckOutcomeView<'a> { - /// Field 1: `check` - pub check: ::buffa::EnumValue, - /// Field 2: `status` - pub status: ::buffa::EnumValue, - /// Field 3: `findings_produced` - pub findings_produced: u32, - /// How far the check got before stopping, in whatever unit it consumes. Only - /// meaningful with BUDGET_EXHAUSTED, where it tells an operator how much - /// larger a budget would need to be. - /// - /// Field 4: `progress` - pub progress: ::core::option::Option, - /// Why a check was skipped or failed. Human-readable, never parsed. - /// - /// Field 5: `reason` - pub reason: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CheckOutcomeView<'a> { - /**Whether required field `check` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_check(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `status` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_status(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `findings_produced` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_findings_produced(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for CheckOutcomeView<'a> { - type Owned = super::super::CheckOutcome; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.check = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.status = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.findings_produced = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.progress = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CheckOutcome { - check: self.check, - status: self.status, - findings_produced: self.findings_produced, - progress: self.progress, - reason: self.reason.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CheckOutcomeView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.check.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - { - let val = self.status.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.findings_produced) as u64; - if let Some(v) = self.progress { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.check.to_i32(), buf); - ::buffa::types::put_int32_field(2u32, self.status.to_i32(), buf); - ::buffa::types::put_uint32_field(3u32, self.findings_produced, buf); - if let Some(v) = self.progress { - ::buffa::types::put_uint64_field(4u32, v, buf); - } - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(5u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CheckOutcomeView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("check", &self.check)?; - } - { - __map.serialize_entry("status", &self.status)?; - } - { - __map - .serialize_entry( - "findingsProduced", - &::buffa::json_helpers::ProtoJson(&self.findings_produced), - )?; - } - if let ::core::option::Option::Some(__v) = self.progress { - __map.serialize_entry("progress", &::buffa::json_helpers::ProtoJson(&__v))?; - } - if let ::core::option::Option::Some(__v) = self.reason { - __map.serialize_entry("reason", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CheckOutcomeView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "CheckOutcome"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.CheckOutcome"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.CheckOutcome"; -} -::buffa::impl_default_view_instance!(CheckOutcomeView); -::buffa::impl_view_reborrow!(CheckOutcomeView); -/** Self-contained, `'static` owned view of a `CheckOutcome` message. - - Wraps [`::buffa::OwnedView`]`<`[`CheckOutcomeView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CheckOutcomeView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CheckOutcomeOwnedView(::buffa::OwnedView>); -impl CheckOutcomeOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckOutcomeOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckOutcomeOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CheckOutcome, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckOutcomeOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CheckOutcomeView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CheckOutcomeView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CheckOutcome { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `check` - #[must_use] - pub fn check(&self) -> ::buffa::EnumValue { - self.0.reborrow().check - } - /// Field 2: `status` - #[must_use] - pub fn status(&self) -> ::buffa::EnumValue { - self.0.reborrow().status - } - /// Field 3: `findings_produced` - #[must_use] - pub fn findings_produced(&self) -> u32 { - self.0.reborrow().findings_produced - } - /// How far the check got before stopping, in whatever unit it consumes. Only - /// meaningful with BUDGET_EXHAUSTED, where it tells an operator how much - /// larger a budget would need to be. - /// - /// Field 4: `progress` - #[must_use] - pub fn progress(&self) -> ::core::option::Option { - self.0.reborrow().progress - } - /// Why a check was skipped or failed. Human-readable, never parsed. - /// - /// Field 5: `reason` - #[must_use] - pub fn reason(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CheckOutcomeOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CheckOutcomeOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CheckOutcomeOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CheckOutcomeOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CheckOutcome { - type View<'a> = CheckOutcomeView<'a>; - type ViewHandle = CheckOutcomeOwnedView; -} -impl ::serde::Serialize for CheckOutcomeOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.diagnose_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.diagnose_session.rs deleted file mode 100644 index 77a571f42..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.diagnose_session.rs +++ /dev/null @@ -1,1299 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/doctor/v1alpha1/diagnose_session.proto - -/// CheckKind is one family of inspection. Checks are the unit a budget is spent -/// on and the unit completeness is reported against. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum CheckKind { - CHECK_KIND_UNSPECIFIED = 0i32, - /// Stream presence and creation-batch completeness. - CHECK_KIND_STREAM_INTEGRITY = 1i32, - /// Decode every event in range and report the ones that fail. - CHECK_KIND_EVENT_DECODE = 2i32, - /// Fold the stream and confirm it produces a state. - CHECK_KIND_AGGREGATE_REPLAY = 3i32, - /// Compare snapshots against a replay of the events they claim to cover. - CHECK_KIND_SNAPSHOT = 4i32, - /// Projection lag, validity, and checkpoint agreement with the view. - CHECK_KIND_PROJECTION = 5i32, - /// Read artifact content and recompute digests. Not in the default set: its - /// cost is bounded by storage, not by the stream. - CHECK_KIND_ARTIFACT_DIGEST = 6i32, - /// Reserved operations with indeterminate or overdue outcomes. - CHECK_KIND_OPERATION_LEDGER = 7i32, - /// Delegation, detach, and cascade sequences that never terminated, and tool - /// calls stranded in flight. - CHECK_KIND_UNRECONCILED_WORK = 8i32, - /// Recovery checkpoints and their attestations. - CHECK_KIND_CHECKPOINT_ATTESTATION = 9i32, - /// Claims and uploads with no durable owner. Not in the default set: deciding - /// an orphan requires tracing ownership and projector watermarks, which is - /// expensive and must never be approximated by a reference search. - CHECK_KIND_ORPHAN = 10i32, - /// Retention and cold-tier watermarks against what is actually retained. - CHECK_KIND_RETENTION = 11i32, -} -impl CheckKind { - ///Idiomatic alias for [`Self::CHECK_KIND_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::CHECK_KIND_UNSPECIFIED; - ///Idiomatic alias for [`Self::CHECK_KIND_STREAM_INTEGRITY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const StreamIntegrity: Self = Self::CHECK_KIND_STREAM_INTEGRITY; - ///Idiomatic alias for [`Self::CHECK_KIND_EVENT_DECODE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const EventDecode: Self = Self::CHECK_KIND_EVENT_DECODE; - ///Idiomatic alias for [`Self::CHECK_KIND_AGGREGATE_REPLAY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const AggregateReplay: Self = Self::CHECK_KIND_AGGREGATE_REPLAY; - ///Idiomatic alias for [`Self::CHECK_KIND_SNAPSHOT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Snapshot: Self = Self::CHECK_KIND_SNAPSHOT; - ///Idiomatic alias for [`Self::CHECK_KIND_PROJECTION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Projection: Self = Self::CHECK_KIND_PROJECTION; - ///Idiomatic alias for [`Self::CHECK_KIND_ARTIFACT_DIGEST`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ArtifactDigest: Self = Self::CHECK_KIND_ARTIFACT_DIGEST; - ///Idiomatic alias for [`Self::CHECK_KIND_OPERATION_LEDGER`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const OperationLedger: Self = Self::CHECK_KIND_OPERATION_LEDGER; - ///Idiomatic alias for [`Self::CHECK_KIND_UNRECONCILED_WORK`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const UnreconciledWork: Self = Self::CHECK_KIND_UNRECONCILED_WORK; - ///Idiomatic alias for [`Self::CHECK_KIND_CHECKPOINT_ATTESTATION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const CheckpointAttestation: Self = Self::CHECK_KIND_CHECKPOINT_ATTESTATION; - ///Idiomatic alias for [`Self::CHECK_KIND_ORPHAN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Orphan: Self = Self::CHECK_KIND_ORPHAN; - ///Idiomatic alias for [`Self::CHECK_KIND_RETENTION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Retention: Self = Self::CHECK_KIND_RETENTION; -} -impl ::core::default::Default for CheckKind { - fn default() -> Self { - Self::CHECK_KIND_UNSPECIFIED - } -} -impl ::serde::Serialize for CheckKind { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for CheckKind { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = CheckKind; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(CheckKind)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for CheckKind { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for CheckKind { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::CHECK_KIND_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::CHECK_KIND_STREAM_INTEGRITY), - 2i32 => ::core::option::Option::Some(Self::CHECK_KIND_EVENT_DECODE), - 3i32 => ::core::option::Option::Some(Self::CHECK_KIND_AGGREGATE_REPLAY), - 4i32 => ::core::option::Option::Some(Self::CHECK_KIND_SNAPSHOT), - 5i32 => ::core::option::Option::Some(Self::CHECK_KIND_PROJECTION), - 6i32 => ::core::option::Option::Some(Self::CHECK_KIND_ARTIFACT_DIGEST), - 7i32 => ::core::option::Option::Some(Self::CHECK_KIND_OPERATION_LEDGER), - 8i32 => ::core::option::Option::Some(Self::CHECK_KIND_UNRECONCILED_WORK), - 9i32 => ::core::option::Option::Some(Self::CHECK_KIND_CHECKPOINT_ATTESTATION), - 10i32 => ::core::option::Option::Some(Self::CHECK_KIND_ORPHAN), - 11i32 => ::core::option::Option::Some(Self::CHECK_KIND_RETENTION), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::CHECK_KIND_UNSPECIFIED => "CHECK_KIND_UNSPECIFIED", - Self::CHECK_KIND_STREAM_INTEGRITY => "CHECK_KIND_STREAM_INTEGRITY", - Self::CHECK_KIND_EVENT_DECODE => "CHECK_KIND_EVENT_DECODE", - Self::CHECK_KIND_AGGREGATE_REPLAY => "CHECK_KIND_AGGREGATE_REPLAY", - Self::CHECK_KIND_SNAPSHOT => "CHECK_KIND_SNAPSHOT", - Self::CHECK_KIND_PROJECTION => "CHECK_KIND_PROJECTION", - Self::CHECK_KIND_ARTIFACT_DIGEST => "CHECK_KIND_ARTIFACT_DIGEST", - Self::CHECK_KIND_OPERATION_LEDGER => "CHECK_KIND_OPERATION_LEDGER", - Self::CHECK_KIND_UNRECONCILED_WORK => "CHECK_KIND_UNRECONCILED_WORK", - Self::CHECK_KIND_CHECKPOINT_ATTESTATION => { - "CHECK_KIND_CHECKPOINT_ATTESTATION" - } - Self::CHECK_KIND_ORPHAN => "CHECK_KIND_ORPHAN", - Self::CHECK_KIND_RETENTION => "CHECK_KIND_RETENTION", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "CHECK_KIND_UNSPECIFIED" => { - ::core::option::Option::Some(Self::CHECK_KIND_UNSPECIFIED) - } - "CHECK_KIND_STREAM_INTEGRITY" => { - ::core::option::Option::Some(Self::CHECK_KIND_STREAM_INTEGRITY) - } - "CHECK_KIND_EVENT_DECODE" => { - ::core::option::Option::Some(Self::CHECK_KIND_EVENT_DECODE) - } - "CHECK_KIND_AGGREGATE_REPLAY" => { - ::core::option::Option::Some(Self::CHECK_KIND_AGGREGATE_REPLAY) - } - "CHECK_KIND_SNAPSHOT" => { - ::core::option::Option::Some(Self::CHECK_KIND_SNAPSHOT) - } - "CHECK_KIND_PROJECTION" => { - ::core::option::Option::Some(Self::CHECK_KIND_PROJECTION) - } - "CHECK_KIND_ARTIFACT_DIGEST" => { - ::core::option::Option::Some(Self::CHECK_KIND_ARTIFACT_DIGEST) - } - "CHECK_KIND_OPERATION_LEDGER" => { - ::core::option::Option::Some(Self::CHECK_KIND_OPERATION_LEDGER) - } - "CHECK_KIND_UNRECONCILED_WORK" => { - ::core::option::Option::Some(Self::CHECK_KIND_UNRECONCILED_WORK) - } - "CHECK_KIND_CHECKPOINT_ATTESTATION" => { - ::core::option::Option::Some(Self::CHECK_KIND_CHECKPOINT_ATTESTATION) - } - "CHECK_KIND_ORPHAN" => ::core::option::Option::Some(Self::CHECK_KIND_ORPHAN), - "CHECK_KIND_RETENTION" => { - ::core::option::Option::Some(Self::CHECK_KIND_RETENTION) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::CHECK_KIND_UNSPECIFIED, - Self::CHECK_KIND_STREAM_INTEGRITY, - Self::CHECK_KIND_EVENT_DECODE, - Self::CHECK_KIND_AGGREGATE_REPLAY, - Self::CHECK_KIND_SNAPSHOT, - Self::CHECK_KIND_PROJECTION, - Self::CHECK_KIND_ARTIFACT_DIGEST, - Self::CHECK_KIND_OPERATION_LEDGER, - Self::CHECK_KIND_UNRECONCILED_WORK, - Self::CHECK_KIND_CHECKPOINT_ATTESTATION, - Self::CHECK_KIND_ORPHAN, - Self::CHECK_KIND_RETENTION, - ] - } -} -/// CheckStatus is how a check ended. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum CheckStatus { - CHECK_STATUS_UNSPECIFIED = 0i32, - /// Ran to completion. Its findings, including none, are conclusive. - CHECK_STATUS_COMPLETED = 1i32, - /// Ran and stopped early against the budget. Its findings are real; their - /// absence proves nothing. - CHECK_STATUS_BUDGET_EXHAUSTED = 2i32, - /// Not requested, or not applicable to this session. - CHECK_STATUS_SKIPPED = 3i32, - /// The check itself failed. Reported rather than swallowed: a diagnostic that - /// hides its own failures is worse than no diagnostic, because it is trusted. - CHECK_STATUS_FAILED = 4i32, -} -impl CheckStatus { - ///Idiomatic alias for [`Self::CHECK_STATUS_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::CHECK_STATUS_UNSPECIFIED; - ///Idiomatic alias for [`Self::CHECK_STATUS_COMPLETED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Completed: Self = Self::CHECK_STATUS_COMPLETED; - ///Idiomatic alias for [`Self::CHECK_STATUS_BUDGET_EXHAUSTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const BudgetExhausted: Self = Self::CHECK_STATUS_BUDGET_EXHAUSTED; - ///Idiomatic alias for [`Self::CHECK_STATUS_SKIPPED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Skipped: Self = Self::CHECK_STATUS_SKIPPED; - ///Idiomatic alias for [`Self::CHECK_STATUS_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Failed: Self = Self::CHECK_STATUS_FAILED; -} -impl ::core::default::Default for CheckStatus { - fn default() -> Self { - Self::CHECK_STATUS_UNSPECIFIED - } -} -impl ::serde::Serialize for CheckStatus { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for CheckStatus { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = CheckStatus; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(CheckStatus)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for CheckStatus { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for CheckStatus { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::CHECK_STATUS_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::CHECK_STATUS_COMPLETED), - 2i32 => ::core::option::Option::Some(Self::CHECK_STATUS_BUDGET_EXHAUSTED), - 3i32 => ::core::option::Option::Some(Self::CHECK_STATUS_SKIPPED), - 4i32 => ::core::option::Option::Some(Self::CHECK_STATUS_FAILED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::CHECK_STATUS_UNSPECIFIED => "CHECK_STATUS_UNSPECIFIED", - Self::CHECK_STATUS_COMPLETED => "CHECK_STATUS_COMPLETED", - Self::CHECK_STATUS_BUDGET_EXHAUSTED => "CHECK_STATUS_BUDGET_EXHAUSTED", - Self::CHECK_STATUS_SKIPPED => "CHECK_STATUS_SKIPPED", - Self::CHECK_STATUS_FAILED => "CHECK_STATUS_FAILED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "CHECK_STATUS_UNSPECIFIED" => { - ::core::option::Option::Some(Self::CHECK_STATUS_UNSPECIFIED) - } - "CHECK_STATUS_COMPLETED" => { - ::core::option::Option::Some(Self::CHECK_STATUS_COMPLETED) - } - "CHECK_STATUS_BUDGET_EXHAUSTED" => { - ::core::option::Option::Some(Self::CHECK_STATUS_BUDGET_EXHAUSTED) - } - "CHECK_STATUS_SKIPPED" => { - ::core::option::Option::Some(Self::CHECK_STATUS_SKIPPED) - } - "CHECK_STATUS_FAILED" => { - ::core::option::Option::Some(Self::CHECK_STATUS_FAILED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::CHECK_STATUS_UNSPECIFIED, - Self::CHECK_STATUS_COMPLETED, - Self::CHECK_STATUS_BUDGET_EXHAUSTED, - Self::CHECK_STATUS_SKIPPED, - Self::CHECK_STATUS_FAILED, - ] - } -} -/// DiagnoseSessionRequest inspects one session and reports what disagrees. -/// -/// This operation mutates nothing. It is not a mode of a repair operation and it -/// has no flag that would make it one, because a report-only default that lives -/// in a field is one typo away from not being the default. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DiagnoseSessionRequest { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Checks to run. Empty runs the default set, which excludes the checks whose - /// cost scales with artifact storage rather than with the stream. - /// - /// Field 2: `checks` - #[serde( - rename = "checks", - with = "::buffa::json_helpers::repeated_enum", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec" - )] - pub checks: ::buffa::alloc::vec::Vec<::buffa::EnumValue>, - /// Field 3: `budget` - #[serde( - rename = "budget", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub budget: ::buffa::MessageField< - InspectionBudget, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for DiagnoseSessionRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DiagnoseSessionRequest") - .field("session_id", &self.session_id) - .field("checks", &self.checks) - .field("budget", &self.budget) - .finish() - } -} -impl DiagnoseSessionRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.DiagnoseSessionRequest"; -} -::buffa::impl_default_instance!(DiagnoseSessionRequest); -impl ::buffa::MessageName for DiagnoseSessionRequest { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "DiagnoseSessionRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.DiagnoseSessionRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.DiagnoseSessionRequest"; -} -impl ::buffa::Message for DiagnoseSessionRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if !self.checks.is_empty() { - let payload: u64 = self - .checks - .iter() - .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u64) - .sum::(); - size += 1u64 + ::buffa::encoding::varint_len(payload) as u64 + payload; - } - if self.budget.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.budget.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if !self.checks.is_empty() { - let payload: u64 = self - .checks - .iter() - .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u64) - .sum::(); - ::buffa::types::put_len_delimited_header(2u32, payload, buf); - for v in &self.checks { - ::buffa::types::encode_int32(v.to_i32(), buf); - } - } - if self.budget.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.budget.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { - let len = ::buffa::encoding::decode_varint(buf)?; - let len = usize::try_from(len) - .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; - if buf.remaining() < len { - return ::core::result::Result::Err( - ::buffa::DecodeError::UnexpectedEof, - ); - } - self.checks.reserve(len); - let mut limited = buf.take(len); - while limited.has_remaining() { - self.checks - .push( - ::buffa::EnumValue::from( - ::buffa::types::decode_int32_packed(&mut limited)?, - ), - ); - } - let leftover = limited.remaining(); - if leftover > 0 { - limited.advance(leftover); - } - } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { - self.checks - .push( - ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?), - ); - } else { - return ::core::result::Result::Err( - ::buffa::encoding::wire_type_mismatch( - tag, - ::buffa::encoding::WireType::LengthDelimited, - ), - ); - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.budget.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.checks.clear(); - self.budget = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for DiagnoseSessionRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DIAGNOSE_SESSION_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.DiagnoseSessionRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// InspectionBudget bounds the work a diagnosis may do. -/// -/// Inspection is unbounded by nature: verifying every artifact digest on a long -/// session means reading every artifact. Without a budget the doctor becomes a -/// load generator that operators learn not to run, and a diagnostic nobody dares -/// use is worth nothing. -/// -/// Unset fields mean the server's default, not unlimited. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct InspectionBudget { - /// Field 1: `max_events_scanned` - #[serde( - rename = "maxEventsScanned", - alias = "max_events_scanned", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub max_events_scanned: ::core::option::Option, - /// Field 2: `max_artifacts_verified` - #[serde( - rename = "maxArtifactsVerified", - alias = "max_artifacts_verified", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub max_artifacts_verified: ::core::option::Option, - /// Field 3: `max_duration` - #[serde( - rename = "maxDuration", - alias = "max_duration", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub max_duration: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, -} -impl ::core::fmt::Debug for InspectionBudget { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("InspectionBudget") - .field("max_events_scanned", &self.max_events_scanned) - .field("max_artifacts_verified", &self.max_artifacts_verified) - .field("max_duration", &self.max_duration) - .finish() - } -} -impl InspectionBudget { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.InspectionBudget"; -} -impl InspectionBudget { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::max_events_scanned`] to `Some(value)`, consuming and returning `self`. - pub fn with_max_events_scanned(mut self, value: u64) -> Self { - self.max_events_scanned = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::max_artifacts_verified`] to `Some(value)`, consuming and returning `self`. - pub fn with_max_artifacts_verified(mut self, value: u64) -> Self { - self.max_artifacts_verified = Some(value); - self - } -} -::buffa::impl_default_instance!(InspectionBudget); -impl ::buffa::MessageName for InspectionBudget { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "InspectionBudget"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.InspectionBudget"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.InspectionBudget"; -} -impl ::buffa::Message for InspectionBudget { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(v) = self.max_events_scanned { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.max_artifacts_verified { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.max_duration.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.max_duration.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(v) = self.max_events_scanned { - ::buffa::types::put_uint64_field(1u32, v, buf); - } - if let Some(v) = self.max_artifacts_verified { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if self.max_duration.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.max_duration.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.max_events_scanned = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.max_artifacts_verified = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.max_duration.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.max_events_scanned = ::core::option::Option::None; - self.max_artifacts_verified = ::core::option::Option::None; - self.max_duration = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for InspectionBudget { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __INSPECTION_BUDGET_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.InspectionBudget", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// DiagnoseSessionResponse is what the inspection found and, as importantly, -/// what it did not look at. -/// -/// An empty `findings` list means the session is healthy only when every entry -/// in `checks` reports CHECK_STATUS_COMPLETED. A doctor that ran out of budget -/// halfway produces the same empty list as a clean session, and an operator -/// reading only `findings` cannot tell those apart. Which checks ran is -/// therefore part of the answer, not metadata about it. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DiagnoseSessionResponse { - /// Identifies this diagnosis. A repair must name it, so every mutation is - /// traceable to the report that justified it. - /// - /// Field 1: `diagnosis_id` - #[serde( - rename = "diagnosisId", - alias = "diagnosis_id", - with = "::buffa::json_helpers::proto_string" - )] - pub diagnosis_id: ::buffa::alloc::string::String, - /// Field 2: `findings` - #[serde( - rename = "findings", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub findings: ::buffa::alloc::vec::Vec, - /// One entry per check the server considered, including checks it skipped. - /// - /// Field 3: `checks` - #[serde( - rename = "checks", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub checks: ::buffa::alloc::vec::Vec, - /// Field 4: `observed_at` - #[serde(rename = "observedAt", alias = "observed_at")] - pub observed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for DiagnoseSessionResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DiagnoseSessionResponse") - .field("diagnosis_id", &self.diagnosis_id) - .field("findings", &self.findings) - .field("checks", &self.checks) - .field("observed_at", &self.observed_at) - .finish() - } -} -impl DiagnoseSessionResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.DiagnoseSessionResponse"; -} -::buffa::impl_default_instance!(DiagnoseSessionResponse); -impl ::buffa::MessageName for DiagnoseSessionResponse { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "DiagnoseSessionResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.DiagnoseSessionResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.DiagnoseSessionResponse"; -} -impl ::buffa::Message for DiagnoseSessionResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.diagnosis_id) as u64; - for v in &self.findings { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.checks { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.diagnosis_id, buf); - for v in &self.findings { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.checks { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.diagnosis_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.findings.push(elem); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.checks.push(elem); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.diagnosis_id.clear(); - self.findings.clear(); - self.checks.clear(); - self.observed_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for DiagnoseSessionResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DIAGNOSE_SESSION_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.DiagnoseSessionResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// CheckOutcome is whether a check actually ran. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CheckOutcome { - /// Field 1: `check` - #[serde(rename = "check", with = "::buffa::json_helpers::proto_enum")] - pub check: ::buffa::EnumValue, - /// Field 2: `status` - #[serde(rename = "status", with = "::buffa::json_helpers::proto_enum")] - pub status: ::buffa::EnumValue, - /// Field 3: `findings_produced` - #[serde( - rename = "findingsProduced", - alias = "findings_produced", - with = "::buffa::json_helpers::uint32" - )] - pub findings_produced: u32, - /// How far the check got before stopping, in whatever unit it consumes. Only - /// meaningful with BUDGET_EXHAUSTED, where it tells an operator how much - /// larger a budget would need to be. - /// - /// Field 4: `progress` - #[serde( - rename = "progress", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub progress: ::core::option::Option, - /// Why a check was skipped or failed. Human-readable, never parsed. - /// - /// Field 5: `reason` - #[serde(rename = "reason", skip_serializing_if = "::core::option::Option::is_none")] - pub reason: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for CheckOutcome { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CheckOutcome") - .field("check", &self.check) - .field("status", &self.status) - .field("findings_produced", &self.findings_produced) - .field("progress", &self.progress) - .field("reason", &self.reason) - .finish() - } -} -impl CheckOutcome { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.CheckOutcome"; -} -impl CheckOutcome { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::progress`] to `Some(value)`, consuming and returning `self`. - pub fn with_progress(mut self, value: u64) -> Self { - self.progress = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::reason`] to `Some(value)`, consuming and returning `self`. - pub fn with_reason( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.reason = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(CheckOutcome); -impl ::buffa::MessageName for CheckOutcome { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "CheckOutcome"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.CheckOutcome"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.CheckOutcome"; -} -impl ::buffa::Message for CheckOutcome { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.check.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - { - let val = self.status.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.findings_produced) as u64; - if let Some(v) = self.progress { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.check.to_i32(), buf); - ::buffa::types::put_int32_field(2u32, self.status.to_i32(), buf); - ::buffa::types::put_uint32_field(3u32, self.findings_produced, buf); - if let Some(v) = self.progress { - ::buffa::types::put_uint64_field(4u32, v, buf); - } - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(5u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.check = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.status = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.findings_produced = ::buffa::types::decode_uint32(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.progress = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.reason.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.check = ::buffa::EnumValue::from(0); - self.status = ::buffa::EnumValue::from(0); - self.findings_produced = 0u32; - self.progress = ::core::option::Option::None; - self.reason = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for CheckOutcome { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CHECK_OUTCOME_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.CheckOutcome", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.doctor_error.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.doctor_error.__view.rs deleted file mode 100644 index 529a8554d..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.doctor_error.__view.rs +++ /dev/null @@ -1,323 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/doctor/v1alpha1/doctor_error.proto - -/// DoctorError is the typed failure payload for the doctor surface. -/// -/// Defined here rather than shared with the query contract's QueryError. The -/// doctor is an operator surface with its own audience and its own release -/// cadence, and pinning its failure vocabulary to a client-facing contract would -/// mean every new operator diagnostic is a client-visible change. That is the -/// same reasoning the query contract applies to projection value types, one -/// subtree further out. -#[derive(Clone, Debug, Default)] -pub struct DoctorErrorView<'a> { - /// Field 1: `code` - pub code: ::buffa::EnumValue, - /// Human-readable, non-contractual. Never parse it. - /// - /// Field 2: `message` - pub message: &'a str, - /// Dotted path into the request for INVALID_ARGUMENT. - /// - /// Field 3: `field_path` - pub field_path: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DoctorErrorView<'a> { - /**Whether required field `code` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_code(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `message` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for DoctorErrorView<'a> { - type Owned = super::super::DoctorError; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.code = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.message = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.field_path = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DoctorError { - code: self.code, - message: self.message.to_string(), - field_path: self.field_path.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DoctorErrorView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.code.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.message) as u64; - if let Some(ref v) = self.field_path { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.code.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.message, buf); - if let Some(ref v) = self.field_path { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DoctorErrorView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("code", &self.code)?; - } - { - __map.serialize_entry("message", self.message)?; - } - if let ::core::option::Option::Some(__v) = self.field_path { - __map.serialize_entry("fieldPath", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DoctorErrorView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "DoctorError"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.DoctorError"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.DoctorError"; -} -::buffa::impl_default_view_instance!(DoctorErrorView); -::buffa::impl_view_reborrow!(DoctorErrorView); -/** Self-contained, `'static` owned view of a `DoctorError` message. - - Wraps [`::buffa::OwnedView`]`<`[`DoctorErrorView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DoctorErrorView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DoctorErrorOwnedView(::buffa::OwnedView>); -impl DoctorErrorOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DoctorErrorOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DoctorErrorOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DoctorError, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DoctorErrorOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DoctorErrorView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DoctorErrorView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DoctorError { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `code` - #[must_use] - pub fn code(&self) -> ::buffa::EnumValue { - self.0.reborrow().code - } - /// Human-readable, non-contractual. Never parse it. - /// - /// Field 2: `message` - #[must_use] - pub fn message(&self) -> &'_ str { - self.0.reborrow().message - } - /// Dotted path into the request for INVALID_ARGUMENT. - /// - /// Field 3: `field_path` - #[must_use] - pub fn field_path(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().field_path - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DoctorErrorOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DoctorErrorOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DoctorErrorOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DoctorErrorOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DoctorError { - type View<'a> = DoctorErrorView<'a>; - type ViewHandle = DoctorErrorOwnedView; -} -impl ::serde::Serialize for DoctorErrorOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.doctor_error.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.doctor_error.rs deleted file mode 100644 index 90e91c8c9..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.doctor_error.rs +++ /dev/null @@ -1,430 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/doctor/v1alpha1/doctor_error.proto - -/// DoctorErrorCode is why a diagnosis or repair could not be served. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum DoctorErrorCode { - DOCTOR_ERROR_CODE_UNSPECIFIED = 0i32, - DOCTOR_ERROR_CODE_SESSION_NOT_FOUND = 1i32, - DOCTOR_ERROR_CODE_INVALID_ARGUMENT = 2i32, - /// The repair names a diagnosis this server does not have. Repairs are bound - /// to a report, so an unknown one is refused rather than treated as an - /// unprovenanced repair. - DOCTOR_ERROR_CODE_DIAGNOSIS_NOT_FOUND = 3i32, - /// The diagnosis is known and too old to authorize a mutation. A report ages - /// into a description of a session that no longer exists, and re-verification - /// catches most of that but should not be the only thing standing between a - /// stale report and a destructive action. - DOCTOR_ERROR_CODE_DIAGNOSIS_EXPIRED = 4i32, - /// The repair names findings from a different session than it targets. - DOCTOR_ERROR_CODE_DIAGNOSIS_SESSION_MISMATCH = 5i32, - /// The caller may not inspect or repair this session. Diagnosis and repair are - /// authorized separately: read access to a report does not carry the right to - /// act on it. - DOCTOR_ERROR_CODE_PERMISSION_DENIED = 6i32, - /// The requested inspection is too expensive to admit even with a budget. - DOCTOR_ERROR_CODE_RESOURCE_EXHAUSTED = 7i32, - DOCTOR_ERROR_CODE_INTERNAL = 8i32, -} -impl DoctorErrorCode { - ///Idiomatic alias for [`Self::DOCTOR_ERROR_CODE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::DOCTOR_ERROR_CODE_UNSPECIFIED; - ///Idiomatic alias for [`Self::DOCTOR_ERROR_CODE_SESSION_NOT_FOUND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SessionNotFound: Self = Self::DOCTOR_ERROR_CODE_SESSION_NOT_FOUND; - ///Idiomatic alias for [`Self::DOCTOR_ERROR_CODE_INVALID_ARGUMENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const InvalidArgument: Self = Self::DOCTOR_ERROR_CODE_INVALID_ARGUMENT; - ///Idiomatic alias for [`Self::DOCTOR_ERROR_CODE_DIAGNOSIS_NOT_FOUND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const DiagnosisNotFound: Self = Self::DOCTOR_ERROR_CODE_DIAGNOSIS_NOT_FOUND; - ///Idiomatic alias for [`Self::DOCTOR_ERROR_CODE_DIAGNOSIS_EXPIRED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const DiagnosisExpired: Self = Self::DOCTOR_ERROR_CODE_DIAGNOSIS_EXPIRED; - ///Idiomatic alias for [`Self::DOCTOR_ERROR_CODE_DIAGNOSIS_SESSION_MISMATCH`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const DiagnosisSessionMismatch: Self = Self::DOCTOR_ERROR_CODE_DIAGNOSIS_SESSION_MISMATCH; - ///Idiomatic alias for [`Self::DOCTOR_ERROR_CODE_PERMISSION_DENIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const PermissionDenied: Self = Self::DOCTOR_ERROR_CODE_PERMISSION_DENIED; - ///Idiomatic alias for [`Self::DOCTOR_ERROR_CODE_RESOURCE_EXHAUSTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ResourceExhausted: Self = Self::DOCTOR_ERROR_CODE_RESOURCE_EXHAUSTED; - ///Idiomatic alias for [`Self::DOCTOR_ERROR_CODE_INTERNAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Internal: Self = Self::DOCTOR_ERROR_CODE_INTERNAL; -} -impl ::core::default::Default for DoctorErrorCode { - fn default() -> Self { - Self::DOCTOR_ERROR_CODE_UNSPECIFIED - } -} -impl ::serde::Serialize for DoctorErrorCode { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for DoctorErrorCode { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = DoctorErrorCode; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(DoctorErrorCode) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for DoctorErrorCode { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for DoctorErrorCode { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_UNSPECIFIED), - 1i32 => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_SESSION_NOT_FOUND) - } - 2i32 => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_INVALID_ARGUMENT) - } - 3i32 => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_DIAGNOSIS_NOT_FOUND) - } - 4i32 => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_DIAGNOSIS_EXPIRED) - } - 5i32 => { - ::core::option::Option::Some( - Self::DOCTOR_ERROR_CODE_DIAGNOSIS_SESSION_MISMATCH, - ) - } - 6i32 => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_PERMISSION_DENIED) - } - 7i32 => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_RESOURCE_EXHAUSTED) - } - 8i32 => ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_INTERNAL), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::DOCTOR_ERROR_CODE_UNSPECIFIED => "DOCTOR_ERROR_CODE_UNSPECIFIED", - Self::DOCTOR_ERROR_CODE_SESSION_NOT_FOUND => { - "DOCTOR_ERROR_CODE_SESSION_NOT_FOUND" - } - Self::DOCTOR_ERROR_CODE_INVALID_ARGUMENT => { - "DOCTOR_ERROR_CODE_INVALID_ARGUMENT" - } - Self::DOCTOR_ERROR_CODE_DIAGNOSIS_NOT_FOUND => { - "DOCTOR_ERROR_CODE_DIAGNOSIS_NOT_FOUND" - } - Self::DOCTOR_ERROR_CODE_DIAGNOSIS_EXPIRED => { - "DOCTOR_ERROR_CODE_DIAGNOSIS_EXPIRED" - } - Self::DOCTOR_ERROR_CODE_DIAGNOSIS_SESSION_MISMATCH => { - "DOCTOR_ERROR_CODE_DIAGNOSIS_SESSION_MISMATCH" - } - Self::DOCTOR_ERROR_CODE_PERMISSION_DENIED => { - "DOCTOR_ERROR_CODE_PERMISSION_DENIED" - } - Self::DOCTOR_ERROR_CODE_RESOURCE_EXHAUSTED => { - "DOCTOR_ERROR_CODE_RESOURCE_EXHAUSTED" - } - Self::DOCTOR_ERROR_CODE_INTERNAL => "DOCTOR_ERROR_CODE_INTERNAL", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "DOCTOR_ERROR_CODE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_UNSPECIFIED) - } - "DOCTOR_ERROR_CODE_SESSION_NOT_FOUND" => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_SESSION_NOT_FOUND) - } - "DOCTOR_ERROR_CODE_INVALID_ARGUMENT" => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_INVALID_ARGUMENT) - } - "DOCTOR_ERROR_CODE_DIAGNOSIS_NOT_FOUND" => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_DIAGNOSIS_NOT_FOUND) - } - "DOCTOR_ERROR_CODE_DIAGNOSIS_EXPIRED" => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_DIAGNOSIS_EXPIRED) - } - "DOCTOR_ERROR_CODE_DIAGNOSIS_SESSION_MISMATCH" => { - ::core::option::Option::Some( - Self::DOCTOR_ERROR_CODE_DIAGNOSIS_SESSION_MISMATCH, - ) - } - "DOCTOR_ERROR_CODE_PERMISSION_DENIED" => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_PERMISSION_DENIED) - } - "DOCTOR_ERROR_CODE_RESOURCE_EXHAUSTED" => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_RESOURCE_EXHAUSTED) - } - "DOCTOR_ERROR_CODE_INTERNAL" => { - ::core::option::Option::Some(Self::DOCTOR_ERROR_CODE_INTERNAL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::DOCTOR_ERROR_CODE_UNSPECIFIED, - Self::DOCTOR_ERROR_CODE_SESSION_NOT_FOUND, - Self::DOCTOR_ERROR_CODE_INVALID_ARGUMENT, - Self::DOCTOR_ERROR_CODE_DIAGNOSIS_NOT_FOUND, - Self::DOCTOR_ERROR_CODE_DIAGNOSIS_EXPIRED, - Self::DOCTOR_ERROR_CODE_DIAGNOSIS_SESSION_MISMATCH, - Self::DOCTOR_ERROR_CODE_PERMISSION_DENIED, - Self::DOCTOR_ERROR_CODE_RESOURCE_EXHAUSTED, - Self::DOCTOR_ERROR_CODE_INTERNAL, - ] - } -} -/// DoctorError is the typed failure payload for the doctor surface. -/// -/// Defined here rather than shared with the query contract's QueryError. The -/// doctor is an operator surface with its own audience and its own release -/// cadence, and pinning its failure vocabulary to a client-facing contract would -/// mean every new operator diagnostic is a client-visible change. That is the -/// same reasoning the query contract applies to projection value types, one -/// subtree further out. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DoctorError { - /// Field 1: `code` - #[serde(rename = "code", with = "::buffa::json_helpers::proto_enum")] - pub code: ::buffa::EnumValue, - /// Human-readable, non-contractual. Never parse it. - /// - /// Field 2: `message` - #[serde(rename = "message", with = "::buffa::json_helpers::proto_string")] - pub message: ::buffa::alloc::string::String, - /// Dotted path into the request for INVALID_ARGUMENT. - /// - /// Field 3: `field_path` - #[serde( - rename = "fieldPath", - alias = "field_path", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub field_path: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for DoctorError { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DoctorError") - .field("code", &self.code) - .field("message", &self.message) - .field("field_path", &self.field_path) - .finish() - } -} -impl DoctorError { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.DoctorError"; -} -impl DoctorError { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::field_path`] to `Some(value)`, consuming and returning `self`. - pub fn with_field_path( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.field_path = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(DoctorError); -impl ::buffa::MessageName for DoctorError { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "DoctorError"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.DoctorError"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.DoctorError"; -} -impl ::buffa::Message for DoctorError { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.code.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.message) as u64; - if let Some(ref v) = self.field_path { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.code.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.message, buf); - if let Some(ref v) = self.field_path { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.code = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.message, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .field_path - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.code = ::buffa::EnumValue::from(0); - self.message.clear(); - self.field_path = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for DoctorError { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DOCTOR_ERROR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.DoctorError", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.finding.__oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.finding.__oneof.rs deleted file mode 100644 index f332fcd07..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.finding.__oneof.rs +++ /dev/null @@ -1,123 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/doctor/v1alpha1/finding.proto - -pub mod finding { - #[allow(unused_imports)] - use super::*; - /// Machine-readable specifics. `kind` sits outside this union on purpose: an - /// unset oneof and a variant added after the reader was built are - /// indistinguishable, so the kind is what stays readable either way. - #[derive(Clone, PartialEq, Debug)] - pub enum Detail { - EventDecode(::buffa::alloc::boxed::Box), - ProjectionCheckpoint( - ::buffa::alloc::boxed::Box, - ), - ArtifactDigest( - ::buffa::alloc::boxed::Box, - ), - OperationLedger( - ::buffa::alloc::boxed::Box, - ), - UnreconciledWork( - ::buffa::alloc::boxed::Box, - ), - Orphan(::buffa::alloc::boxed::Box), - } - impl ::buffa::Oneof for Detail {} - impl From for Detail { - fn from(v: super::super::super::EventDecodeDetail) -> Self { - Self::EventDecode(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::EventDecodeDetail) -> Self { - Self::Some(Detail::from(v)) - } - } - impl From for Detail { - fn from(v: super::super::super::ProjectionCheckpointDetail) -> Self { - Self::ProjectionCheckpoint(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::ProjectionCheckpointDetail) -> Self { - Self::Some(Detail::from(v)) - } - } - impl From for Detail { - fn from(v: super::super::super::ArtifactDigestDetail) -> Self { - Self::ArtifactDigest(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::ArtifactDigestDetail) -> Self { - Self::Some(Detail::from(v)) - } - } - impl From for Detail { - fn from(v: super::super::super::OperationLedgerDetail) -> Self { - Self::OperationLedger(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::OperationLedgerDetail) -> Self { - Self::Some(Detail::from(v)) - } - } - impl From for Detail { - fn from(v: super::super::super::UnreconciledWorkDetail) -> Self { - Self::UnreconciledWork(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::UnreconciledWorkDetail) -> Self { - Self::Some(Detail::from(v)) - } - } - impl From for Detail { - fn from(v: super::super::super::OrphanDetail) -> Self { - Self::Orphan(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::OrphanDetail) -> Self { - Self::Some(Detail::from(v)) - } - } - impl serde::Serialize for Detail { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::EventDecode(v) => { - map.serialize_entry("eventDecode", v)?; - } - Self::ProjectionCheckpoint(v) => { - map.serialize_entry("projectionCheckpoint", v)?; - } - Self::ArtifactDigest(v) => { - map.serialize_entry("artifactDigest", v)?; - } - Self::OperationLedger(v) => { - map.serialize_entry("operationLedger", v)?; - } - Self::UnreconciledWork(v) => { - map.serialize_entry("unreconciledWork", v)?; - } - Self::Orphan(v) => { - map.serialize_entry("orphan", v)?; - } - } - map.end() - } - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.finding.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.finding.__view.rs deleted file mode 100644 index 3d9475cb1..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.finding.__view.rs +++ /dev/null @@ -1,3240 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/doctor/v1alpha1/finding.proto - -/// Finding is one inconsistency the doctor observed. -/// -/// A finding is an observation, never an instruction. It says what disagrees -/// with what, and it names the repairs that could address it, but producing one -/// mutates nothing. That separation is the whole design: diagnosis and repair are -/// different operations with different messages, so a caller cannot reach a -/// mutation by filling in one more field on a read. -#[derive(Clone, Debug, Default)] -pub struct FindingView<'a> { - /// Stable identity for this problem: a digest over `kind` and `subject`. - /// - /// Deliberately not a digest over the observed values. A projection that falls - /// further behind between diagnosis and repair is still the same finding, and - /// an id that changed with every observed byte would make repairs impossible on - /// a busy session. Staleness is caught by re-verifying the finding at repair - /// time, not by comparing ids. - /// - /// Field 1: `finding_id` - pub finding_id: &'a str, - /// Field 2: `kind` - pub kind: ::buffa::EnumValue, - /// Field 3: `severity` - pub severity: ::buffa::EnumValue, - /// Field 4: `subject` - pub subject: ::buffa::MessageFieldView< - super::super::__buffa::view::SubjectRefView<'a>, - >, - /// Human-readable, non-contractual, safe to log. Never parse it. - /// - /// Field 5: `summary` - pub summary: &'a str, - /// Repairs that could address this finding, and the only actions a - /// RepairSessionRequest may name for it. An empty list means nothing the - /// doctor can do will help, which is the normal case for a CORRUPT finding. - /// - /// Field 6: `available_repairs` - pub available_repairs: ::buffa::RepeatedView< - 'a, - ::buffa::EnumValue, - >, - /// Field 7: `observed_at` - pub observed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - pub detail: ::core::option::Option< - super::super::__buffa::view::oneof::finding::Detail<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> FindingView<'a> { - /**Whether required field `finding_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_finding_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_kind(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `severity` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_severity(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `subject` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_subject(&self) -> bool { - self.subject.is_set() - } - /**Whether required field `summary` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_summary(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `observed_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_observed_at(&self) -> bool { - self.observed_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for FindingView<'a> { - type Owned = super::super::Finding; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.finding_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.severity = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.subject.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.subject = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.summary = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { - let payload = ::buffa::types::borrow_bytes(&mut cur)?; - view.available_repairs - .reserve(::buffa::encoding::count_varints(payload)); - let mut pcur: &[u8] = payload; - while !pcur.is_empty() { - view.available_repairs - .push( - ::buffa::EnumValue::from( - ::buffa::types::decode_int32_packed(&mut pcur)?, - ), - ); - } - } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { - view.available_repairs - .push( - ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ), - ); - } else { - return Err( - ::buffa::encoding::wire_type_mismatch( - tag, - ::buffa::encoding::WireType::LengthDelimited, - ), - ); - } - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::finding::Detail::EventDecode( - ref mut existing, - ), - ) = view.detail - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.detail = Some( - super::super::__buffa::view::oneof::finding::Detail::EventDecode( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::finding::Detail::ProjectionCheckpoint( - ref mut existing, - ), - ) = view.detail - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.detail = Some( - super::super::__buffa::view::oneof::finding::Detail::ProjectionCheckpoint( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::finding::Detail::ArtifactDigest( - ref mut existing, - ), - ) = view.detail - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.detail = Some( - super::super::__buffa::view::oneof::finding::Detail::ArtifactDigest( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::finding::Detail::OperationLedger( - ref mut existing, - ), - ) = view.detail - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.detail = Some( - super::super::__buffa::view::oneof::finding::Detail::OperationLedger( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::finding::Detail::UnreconciledWork( - ref mut existing, - ), - ) = view.detail - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.detail = Some( - super::super::__buffa::view::oneof::finding::Detail::UnreconciledWork( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::finding::Detail::Orphan( - ref mut existing, - ), - ) = view.detail - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.detail = Some( - super::super::__buffa::view::oneof::finding::Detail::Orphan( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::Finding { - finding_id: self.finding_id.to_string(), - kind: self.kind, - severity: self.severity, - subject: match self.subject.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SubjectRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - summary: self.summary.to_string(), - available_repairs: self.available_repairs.to_vec(), - observed_at: match self.observed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - detail: match self.detail.as_ref() { - ::core::option::Option::Some(v) => { - ::core::option::Option::Some( - match v { - super::super::__buffa::view::oneof::finding::Detail::EventDecode( - v, - ) => { - super::super::__buffa::oneof::finding::Detail::EventDecode( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::finding::Detail::ProjectionCheckpoint( - v, - ) => { - super::super::__buffa::oneof::finding::Detail::ProjectionCheckpoint( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::finding::Detail::ArtifactDigest( - v, - ) => { - super::super::__buffa::oneof::finding::Detail::ArtifactDigest( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::finding::Detail::OperationLedger( - v, - ) => { - super::super::__buffa::oneof::finding::Detail::OperationLedger( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::finding::Detail::UnreconciledWork( - v, - ) => { - super::super::__buffa::oneof::finding::Detail::UnreconciledWork( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::finding::Detail::Orphan( - v, - ) => { - super::super::__buffa::oneof::finding::Detail::Orphan( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - }, - ) - } - ::core::option::Option::None => ::core::option::Option::None, - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for FindingView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.finding_id) as u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - { - let val = self.severity.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.subject.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.subject.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary) as u64; - if !self.available_repairs.is_empty() { - let payload: u64 = self - .available_repairs - .iter() - .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u64) - .sum::(); - size += 1u64 + ::buffa::encoding::varint_len(payload) as u64 + payload; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let ::core::option::Option::Some(ref v) = self.detail { - match v { - super::super::__buffa::view::oneof::finding::Detail::EventDecode(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::finding::Detail::ProjectionCheckpoint( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::finding::Detail::ArtifactDigest( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::finding::Detail::OperationLedger( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::finding::Detail::UnreconciledWork( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::finding::Detail::Orphan(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.finding_id, buf); - ::buffa::types::put_int32_field(2u32, self.kind.to_i32(), buf); - ::buffa::types::put_int32_field(3u32, self.severity.to_i32(), buf); - if self.subject.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.subject.write_to(__cache, buf); - } - ::buffa::types::put_string_field(5u32, &self.summary, buf); - if !self.available_repairs.is_empty() { - let payload: u64 = self - .available_repairs - .iter() - .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u64) - .sum::(); - ::buffa::types::put_len_delimited_header(6u32, payload, buf); - for v in &self.available_repairs { - ::buffa::types::encode_int32(v.to_i32(), buf); - } - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - if let ::core::option::Option::Some(ref v) = self.detail { - match v { - super::super::__buffa::view::oneof::finding::Detail::EventDecode(x) => { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::finding::Detail::ProjectionCheckpoint( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::finding::Detail::ArtifactDigest( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::finding::Detail::OperationLedger( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::finding::Detail::UnreconciledWork( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::finding::Detail::Orphan(x) => { - ::buffa::types::put_len_delimited_header( - 13u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for FindingView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("findingId", self.finding_id)?; - } - { - __map.serialize_entry("kind", &self.kind)?; - } - { - __map.serialize_entry("severity", &self.severity)?; - } - { - if let ::core::option::Option::Some(__v) = self.subject.as_option() { - __map.serialize_entry("subject", __v)?; - } - } - { - __map.serialize_entry("summary", self.summary)?; - } - if !self.available_repairs.is_empty() { - __map - .serialize_entry( - "availableRepairs", - &::buffa::json_helpers::EnumSeqJson(&self.available_repairs), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.observed_at.as_option() { - __map.serialize_entry("observedAt", __v)?; - } - } - if let ::core::option::Option::Some(ref __ov) = self.detail { - match __ov { - super::super::__buffa::view::oneof::finding::Detail::EventDecode(v) => { - __map.serialize_entry("eventDecode", v)?; - } - super::super::__buffa::view::oneof::finding::Detail::ProjectionCheckpoint( - v, - ) => { - __map.serialize_entry("projectionCheckpoint", v)?; - } - super::super::__buffa::view::oneof::finding::Detail::ArtifactDigest( - v, - ) => { - __map.serialize_entry("artifactDigest", v)?; - } - super::super::__buffa::view::oneof::finding::Detail::OperationLedger( - v, - ) => { - __map.serialize_entry("operationLedger", v)?; - } - super::super::__buffa::view::oneof::finding::Detail::UnreconciledWork( - v, - ) => { - __map.serialize_entry("unreconciledWork", v)?; - } - super::super::__buffa::view::oneof::finding::Detail::Orphan(v) => { - __map.serialize_entry("orphan", v)?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for FindingView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "Finding"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.Finding"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.Finding"; -} -::buffa::impl_default_view_instance!(FindingView); -::buffa::impl_view_reborrow!(FindingView); -/** Self-contained, `'static` owned view of a `Finding` message. - - Wraps [`::buffa::OwnedView`]`<`[`FindingView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`FindingView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct FindingOwnedView(::buffa::OwnedView>); -impl FindingOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok(FindingOwnedView(::buffa::OwnedView::decode(bytes)?)) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FindingOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::Finding, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FindingOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`FindingView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &FindingView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::Finding { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Stable identity for this problem: a digest over `kind` and `subject`. - /// - /// Deliberately not a digest over the observed values. A projection that falls - /// further behind between diagnosis and repair is still the same finding, and - /// an id that changed with every observed byte would make repairs impossible on - /// a busy session. Staleness is caught by re-verifying the finding at repair - /// time, not by comparing ids. - /// - /// Field 1: `finding_id` - #[must_use] - pub fn finding_id(&self) -> &'_ str { - self.0.reborrow().finding_id - } - /// Field 2: `kind` - #[must_use] - pub fn kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().kind - } - /// Field 3: `severity` - #[must_use] - pub fn severity(&self) -> ::buffa::EnumValue { - self.0.reborrow().severity - } - /// Field 4: `subject` - #[must_use] - pub fn subject( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().subject - } - /// Human-readable, non-contractual, safe to log. Never parse it. - /// - /// Field 5: `summary` - #[must_use] - pub fn summary(&self) -> &'_ str { - self.0.reborrow().summary - } - /// Repairs that could address this finding, and the only actions a - /// RepairSessionRequest may name for it. An empty list means nothing the - /// doctor can do will help, which is the normal case for a CORRUPT finding. - /// - /// Field 6: `available_repairs` - #[must_use] - pub fn available_repairs( - &self, - ) -> &::buffa::RepeatedView<'_, ::buffa::EnumValue> { - &self.0.reborrow().available_repairs - } - /// Field 7: `observed_at` - #[must_use] - pub fn observed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().observed_at - } - /// Oneof `detail`. - #[must_use] - pub fn detail( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::finding::Detail<'_>, - > { - self.0.reborrow().detail.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for FindingOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - FindingOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: FindingOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for FindingOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::Finding { - type View<'a> = FindingView<'a>; - type ViewHandle = FindingOwnedView; -} -impl ::serde::Serialize for FindingOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// SubjectRef says what a finding is about. -/// -/// `kind` is what gives `entity_id` meaning, and the pair travels together for -/// that reason: an id with no idea what it identifies is not a reference. -#[derive(Clone, Debug, Default)] -pub struct SubjectRefView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `kind` - pub kind: ::buffa::EnumValue, - /// Interpreted according to `kind`: an artifact id, an operation id, a tool - /// execution id, a projection name. Unset when `kind` is STREAM, which needs - /// no further identity than the session. - /// - /// Field 3: `entity_id` - pub entity_id: ::core::option::Option<&'a str>, - /// The SessionOrdinal the finding is anchored at. Unset when the finding is - /// not ordinal-scoped, which is not the same as ordinal zero. - /// - /// Field 4: `ordinal` - pub ordinal: ::core::option::Option, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SubjectRefView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_kind(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SubjectRefView<'a> { - type Owned = super::super::SubjectRef; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.entity_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.ordinal = Some(::buffa::types::decode_uint64(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SubjectRef { - session_id: self.session_id.to_string(), - kind: self.kind, - entity_id: self.entity_id.map(|s| s.to_string()), - ordinal: self.ordinal, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SubjectRefView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.entity_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(v) = self.ordinal { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.kind.to_i32(), buf); - if let Some(ref v) = self.entity_id { - ::buffa::types::put_string_field(3u32, v, buf); - } - if let Some(v) = self.ordinal { - ::buffa::types::put_uint64_field(4u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SubjectRefView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("kind", &self.kind)?; - } - if let ::core::option::Option::Some(__v) = self.entity_id { - __map.serialize_entry("entityId", __v)?; - } - if let ::core::option::Option::Some(__v) = self.ordinal { - __map.serialize_entry("ordinal", &::buffa::json_helpers::ProtoJson(&__v))?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SubjectRefView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "SubjectRef"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.SubjectRef"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.SubjectRef"; -} -::buffa::impl_default_view_instance!(SubjectRefView); -::buffa::impl_view_reborrow!(SubjectRefView); -/** Self-contained, `'static` owned view of a `SubjectRef` message. - - Wraps [`::buffa::OwnedView`]`<`[`SubjectRefView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SubjectRefView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SubjectRefOwnedView(::buffa::OwnedView>); -impl SubjectRefOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SubjectRefOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SubjectRefOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SubjectRef, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SubjectRefOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SubjectRefView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SubjectRefView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SubjectRef { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `kind` - #[must_use] - pub fn kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().kind - } - /// Interpreted according to `kind`: an artifact id, an operation id, a tool - /// execution id, a projection name. Unset when `kind` is STREAM, which needs - /// no further identity than the session. - /// - /// Field 3: `entity_id` - #[must_use] - pub fn entity_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().entity_id - } - /// The SessionOrdinal the finding is anchored at. Unset when the finding is - /// not ordinal-scoped, which is not the same as ordinal zero. - /// - /// Field 4: `ordinal` - #[must_use] - pub fn ordinal(&self) -> ::core::option::Option { - self.0.reborrow().ordinal - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SubjectRefOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SubjectRefOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SubjectRefOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SubjectRefOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SubjectRef { - type View<'a> = SubjectRefView<'a>; - type ViewHandle = SubjectRefOwnedView; -} -impl ::serde::Serialize for SubjectRefOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// EventDecodeDetail is enough to find the offending event without re-running -/// the scan. -#[derive(Clone, Debug, Default)] -pub struct EventDecodeDetailView<'a> { - /// Field 1: `ordinal` - pub ordinal: u64, - /// Field 2: `type_url` - pub type_url: &'a str, - /// Decoder error text. Diagnostic only, never parsed. - /// - /// Field 3: `decoder_error` - pub decoder_error: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> EventDecodeDetailView<'a> { - /**Whether required field `ordinal` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ordinal(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `type_url` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_type_url(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `decoder_error` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_decoder_error(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for EventDecodeDetailView<'a> { - type Owned = super::super::EventDecodeDetail; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.ordinal = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.type_url = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.decoder_error = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::EventDecodeDetail { - ordinal: self.ordinal, - type_url: self.type_url.to_string(), - decoder_error: self.decoder_error.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for EventDecodeDetailView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.ordinal) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.type_url) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.decoder_error) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.ordinal, buf); - ::buffa::types::put_string_field(2u32, &self.type_url, buf); - ::buffa::types::put_string_field(3u32, &self.decoder_error, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for EventDecodeDetailView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "ordinal", - &::buffa::json_helpers::ProtoJson(&self.ordinal), - )?; - } - { - __map.serialize_entry("typeUrl", self.type_url)?; - } - { - __map.serialize_entry("decoderError", self.decoder_error)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for EventDecodeDetailView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "EventDecodeDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.EventDecodeDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.EventDecodeDetail"; -} -::buffa::impl_default_view_instance!(EventDecodeDetailView); -::buffa::impl_view_reborrow!(EventDecodeDetailView); -/** Self-contained, `'static` owned view of a `EventDecodeDetail` message. - - Wraps [`::buffa::OwnedView`]`<`[`EventDecodeDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`EventDecodeDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct EventDecodeDetailOwnedView( - ::buffa::OwnedView>, -); -impl EventDecodeDetailOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - EventDecodeDetailOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - EventDecodeDetailOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::EventDecodeDetail, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - EventDecodeDetailOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`EventDecodeDetailView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &EventDecodeDetailView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::EventDecodeDetail { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `ordinal` - #[must_use] - pub fn ordinal(&self) -> u64 { - self.0.reborrow().ordinal - } - /// Field 2: `type_url` - #[must_use] - pub fn type_url(&self) -> &'_ str { - self.0.reborrow().type_url - } - /// Decoder error text. Diagnostic only, never parsed. - /// - /// Field 3: `decoder_error` - #[must_use] - pub fn decoder_error(&self) -> &'_ str { - self.0.reborrow().decoder_error - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for EventDecodeDetailOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - EventDecodeDetailOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: EventDecodeDetailOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for EventDecodeDetailOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::EventDecodeDetail { - type View<'a> = EventDecodeDetailView<'a>; - type ViewHandle = EventDecodeDetailOwnedView; -} -impl ::serde::Serialize for EventDecodeDetailOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ProjectionCheckpointDetail carries the three positions whose disagreement is -/// the finding, because a checkpoint inconsistency is unreadable without all -/// three. -#[derive(Clone, Debug, Default)] -pub struct ProjectionCheckpointDetailView<'a> { - /// Field 1: `projection_name` - pub projection_name: &'a str, - /// Field 2: `projection_generation` - pub projection_generation: &'a str, - /// What the checkpoint claims was applied. - /// - /// Field 3: `checkpoint_watermark` - pub checkpoint_watermark: u64, - /// What the materialized view actually reflects. Below the checkpoint means - /// the checkpoint is lying about work the view never received. - /// - /// Field 4: `view_applied_through` - pub view_applied_through: u64, - /// The source head. Below the checkpoint means the checkpoint refers to - /// history this stream does not have. - /// - /// Field 5: `source_high_watermark` - pub source_high_watermark: u64, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ProjectionCheckpointDetailView<'a> { - /**Whether required field `projection_name` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_projection_name(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `projection_generation` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_projection_generation(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `checkpoint_watermark` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_checkpoint_watermark(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `view_applied_through` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_view_applied_through(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `source_high_watermark` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_high_watermark(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ProjectionCheckpointDetailView<'a> { - type Owned = super::super::ProjectionCheckpointDetail; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.projection_name = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.projection_generation = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.checkpoint_watermark = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.view_applied_through = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.source_high_watermark = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ProjectionCheckpointDetail, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ProjectionCheckpointDetail, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ProjectionCheckpointDetail { - projection_name: self.projection_name.to_string(), - projection_generation: self.projection_generation.to_string(), - checkpoint_watermark: self.checkpoint_watermark, - view_applied_through: self.view_applied_through, - source_high_watermark: self.source_high_watermark, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ProjectionCheckpointDetailView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.projection_name) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.projection_generation) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.checkpoint_watermark) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.view_applied_through) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.source_high_watermark) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.projection_name, buf); - ::buffa::types::put_string_field(2u32, &self.projection_generation, buf); - ::buffa::types::put_uint64_field(3u32, self.checkpoint_watermark, buf); - ::buffa::types::put_uint64_field(4u32, self.view_applied_through, buf); - ::buffa::types::put_uint64_field(5u32, self.source_high_watermark, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ProjectionCheckpointDetailView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("projectionName", self.projection_name)?; - } - { - __map.serialize_entry("projectionGeneration", self.projection_generation)?; - } - { - __map - .serialize_entry( - "checkpointWatermark", - &::buffa::json_helpers::ProtoJson(&self.checkpoint_watermark), - )?; - } - { - __map - .serialize_entry( - "viewAppliedThrough", - &::buffa::json_helpers::ProtoJson(&self.view_applied_through), - )?; - } - { - __map - .serialize_entry( - "sourceHighWatermark", - &::buffa::json_helpers::ProtoJson(&self.source_high_watermark), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ProjectionCheckpointDetailView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "ProjectionCheckpointDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.ProjectionCheckpointDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.ProjectionCheckpointDetail"; -} -::buffa::impl_default_view_instance!(ProjectionCheckpointDetailView); -::buffa::impl_view_reborrow!(ProjectionCheckpointDetailView); -/** Self-contained, `'static` owned view of a `ProjectionCheckpointDetail` message. - - Wraps [`::buffa::OwnedView`]`<`[`ProjectionCheckpointDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ProjectionCheckpointDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ProjectionCheckpointDetailOwnedView( - ::buffa::OwnedView>, -); -impl ProjectionCheckpointDetailOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProjectionCheckpointDetailOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProjectionCheckpointDetailOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ProjectionCheckpointDetail, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProjectionCheckpointDetailOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ProjectionCheckpointDetailView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ProjectionCheckpointDetailView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ProjectionCheckpointDetail { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `projection_name` - #[must_use] - pub fn projection_name(&self) -> &'_ str { - self.0.reborrow().projection_name - } - /// Field 2: `projection_generation` - #[must_use] - pub fn projection_generation(&self) -> &'_ str { - self.0.reborrow().projection_generation - } - /// What the checkpoint claims was applied. - /// - /// Field 3: `checkpoint_watermark` - #[must_use] - pub fn checkpoint_watermark(&self) -> u64 { - self.0.reborrow().checkpoint_watermark - } - /// What the materialized view actually reflects. Below the checkpoint means - /// the checkpoint is lying about work the view never received. - /// - /// Field 4: `view_applied_through` - #[must_use] - pub fn view_applied_through(&self) -> u64 { - self.0.reborrow().view_applied_through - } - /// The source head. Below the checkpoint means the checkpoint refers to - /// history this stream does not have. - /// - /// Field 5: `source_high_watermark` - #[must_use] - pub fn source_high_watermark(&self) -> u64 { - self.0.reborrow().source_high_watermark - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ProjectionCheckpointDetailOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ProjectionCheckpointDetailOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ProjectionCheckpointDetailOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ProjectionCheckpointDetailOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ProjectionCheckpointDetail { - type View<'a> = ProjectionCheckpointDetailView<'a>; - type ViewHandle = ProjectionCheckpointDetailOwnedView; -} -impl ::serde::Serialize for ProjectionCheckpointDetailOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ArtifactDigestDetail distinguishes the three ways an artifact fails -/// verification, which the digests alone cannot express. -#[derive(Clone, Debug, Default)] -pub struct ArtifactDigestDetailView<'a> { - /// Field 1: `artifact_id` - pub artifact_id: &'a str, - /// Field 2: `observation` - pub observation: ::buffa::EnumValue, - /// The digest recorded when the artifact was stored. - /// - /// Field 3: `expected_digest` - pub expected_digest: &'a str, - /// The digest computed during this check. Unset when the content could not be - /// read at all, which is why this is not simply compared to the expected one. - /// - /// Field 4: `observed_digest` - pub observed_digest: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ArtifactDigestDetailView<'a> { - /**Whether required field `artifact_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `observation` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_observation(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `expected_digest` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_expected_digest(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ArtifactDigestDetailView<'a> { - type Owned = super::super::ArtifactDigestDetail; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.artifact_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.observation = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.expected_digest = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.observed_digest = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ArtifactDigestDetail, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ArtifactDigestDetail, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ArtifactDigestDetail { - artifact_id: self.artifact_id.to_string(), - observation: self.observation, - expected_digest: self.expected_digest.to_string(), - observed_digest: self.observed_digest.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ArtifactDigestDetailView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - { - let val = self.observation.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.expected_digest) as u64; - if let Some(ref v) = self.observed_digest { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.artifact_id, buf); - ::buffa::types::put_int32_field(2u32, self.observation.to_i32(), buf); - ::buffa::types::put_string_field(3u32, &self.expected_digest, buf); - if let Some(ref v) = self.observed_digest { - ::buffa::types::put_string_field(4u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ArtifactDigestDetailView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("artifactId", self.artifact_id)?; - } - { - __map.serialize_entry("observation", &self.observation)?; - } - { - __map.serialize_entry("expectedDigest", self.expected_digest)?; - } - if let ::core::option::Option::Some(__v) = self.observed_digest { - __map.serialize_entry("observedDigest", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ArtifactDigestDetailView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "ArtifactDigestDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.ArtifactDigestDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.ArtifactDigestDetail"; -} -::buffa::impl_default_view_instance!(ArtifactDigestDetailView); -::buffa::impl_view_reborrow!(ArtifactDigestDetailView); -/** Self-contained, `'static` owned view of a `ArtifactDigestDetail` message. - - Wraps [`::buffa::OwnedView`]`<`[`ArtifactDigestDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ArtifactDigestDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ArtifactDigestDetailOwnedView( - ::buffa::OwnedView>, -); -impl ArtifactDigestDetailOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactDigestDetailOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactDigestDetailOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ArtifactDigestDetail, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactDigestDetailOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ArtifactDigestDetailView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ArtifactDigestDetailView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ArtifactDigestDetail { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `artifact_id` - #[must_use] - pub fn artifact_id(&self) -> &'_ str { - self.0.reborrow().artifact_id - } - /// Field 2: `observation` - #[must_use] - pub fn observation( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().observation - } - /// The digest recorded when the artifact was stored. - /// - /// Field 3: `expected_digest` - #[must_use] - pub fn expected_digest(&self) -> &'_ str { - self.0.reborrow().expected_digest - } - /// The digest computed during this check. Unset when the content could not be - /// read at all, which is why this is not simply compared to the expected one. - /// - /// Field 4: `observed_digest` - #[must_use] - pub fn observed_digest(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().observed_digest - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ArtifactDigestDetailOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ArtifactDigestDetailOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ArtifactDigestDetailOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ArtifactDigestDetailOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ArtifactDigestDetail { - type View<'a> = ArtifactDigestDetailView<'a>; - type ViewHandle = ArtifactDigestDetailOwnedView; -} -impl ::serde::Serialize for ArtifactDigestDetailOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// OperationLedgerDetail describes a side effect that never settled. -#[derive(Clone, Debug, Default)] -pub struct OperationLedgerDetailView<'a> { - /// Field 1: `operation_id` - pub operation_id: &'a str, - /// Field 2: `reserved_at` - pub reserved_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// How far past its expected settlement window the operation is. Unset when no - /// window applies. - /// - /// Field 3: `overdue_by` - pub overdue_by: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, - /// True when an indeterminate outcome was recorded, meaning the side effect - /// may or may not have run. An operator must not assume either. - /// - /// Field 4: `outcome_indeterminate` - pub outcome_indeterminate: bool, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> OperationLedgerDetailView<'a> { - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `reserved_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reserved_at(&self) -> bool { - self.reserved_at.is_set() - } - /**Whether required field `outcome_indeterminate` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_outcome_indeterminate(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for OperationLedgerDetailView<'a> { - type Owned = super::super::OperationLedgerDetail; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.reserved_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.reserved_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.overdue_by.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.overdue_by = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.outcome_indeterminate = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::OperationLedgerDetail, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::OperationLedgerDetail, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::OperationLedgerDetail { - operation_id: self.operation_id.to_string(), - reserved_at: match self.reserved_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - overdue_by: match self.overdue_by.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - outcome_indeterminate: self.outcome_indeterminate, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for OperationLedgerDetailView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if self.reserved_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.reserved_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.overdue_by.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.overdue_by.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.operation_id, buf); - if self.reserved_at.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.reserved_at.write_to(__cache, buf); - } - if self.overdue_by.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.overdue_by.write_to(__cache, buf); - } - ::buffa::types::put_bool_field(4u32, self.outcome_indeterminate, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for OperationLedgerDetailView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("operationId", self.operation_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.reserved_at.as_option() { - __map.serialize_entry("reservedAt", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.overdue_by.as_option() { - __map.serialize_entry("overdueBy", __v)?; - } - } - { - __map.serialize_entry("outcomeIndeterminate", &self.outcome_indeterminate)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for OperationLedgerDetailView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "OperationLedgerDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.OperationLedgerDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.OperationLedgerDetail"; -} -::buffa::impl_default_view_instance!(OperationLedgerDetailView); -::buffa::impl_view_reborrow!(OperationLedgerDetailView); -/** Self-contained, `'static` owned view of a `OperationLedgerDetail` message. - - Wraps [`::buffa::OwnedView`]`<`[`OperationLedgerDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`OperationLedgerDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct OperationLedgerDetailOwnedView( - ::buffa::OwnedView>, -); -impl OperationLedgerDetailOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationLedgerDetailOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationLedgerDetailOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::OperationLedgerDetail, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationLedgerDetailOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`OperationLedgerDetailView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &OperationLedgerDetailView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::OperationLedgerDetail { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Field 2: `reserved_at` - #[must_use] - pub fn reserved_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().reserved_at - } - /// How far past its expected settlement window the operation is. Unset when no - /// window applies. - /// - /// Field 3: `overdue_by` - #[must_use] - pub fn overdue_by( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().overdue_by - } - /// True when an indeterminate outcome was recorded, meaning the side effect - /// may or may not have run. An operator must not assume either. - /// - /// Field 4: `outcome_indeterminate` - #[must_use] - pub fn outcome_indeterminate(&self) -> bool { - self.0.reborrow().outcome_indeterminate - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for OperationLedgerDetailOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - OperationLedgerDetailOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: OperationLedgerDetailOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for OperationLedgerDetailOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::OperationLedgerDetail { - type View<'a> = OperationLedgerDetailView<'a>; - type ViewHandle = OperationLedgerDetailOwnedView; -} -impl ::serde::Serialize for OperationLedgerDetailOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// UnreconciledWorkDetail describes work the fold shows as started and never -/// finished. -#[derive(Clone, Debug, Default)] -pub struct UnreconciledWorkDetailView<'a> { - /// Tool execution id, delegation id, or saga id, per the subject kind. - /// - /// Field 1: `entity_id` - pub entity_id: &'a str, - /// Field 2: `started_at` - pub started_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// True when the session has already reached a terminal marker. A session can - /// be terminally successful and still have work stranded in flight, and that - /// combination is exactly what a reader treating terminal as complete will - /// miss. - /// - /// Field 3: `session_terminal` - pub session_terminal: bool, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> UnreconciledWorkDetailView<'a> { - /**Whether required field `entity_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_entity_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `started_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_started_at(&self) -> bool { - self.started_at.is_set() - } - /**Whether required field `session_terminal` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_terminal(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for UnreconciledWorkDetailView<'a> { - type Owned = super::super::UnreconciledWorkDetail; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.entity_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.started_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.started_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.session_terminal = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::UnreconciledWorkDetail, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::UnreconciledWorkDetail, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::UnreconciledWorkDetail { - entity_id: self.entity_id.to_string(), - started_at: match self.started_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - session_terminal: self.session_terminal, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for UnreconciledWorkDetailView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.entity_id) as u64; - if self.started_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.started_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.entity_id, buf); - if self.started_at.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.started_at.write_to(__cache, buf); - } - ::buffa::types::put_bool_field(3u32, self.session_terminal, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for UnreconciledWorkDetailView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("entityId", self.entity_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.started_at.as_option() { - __map.serialize_entry("startedAt", __v)?; - } - } - { - __map.serialize_entry("sessionTerminal", &self.session_terminal)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for UnreconciledWorkDetailView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "UnreconciledWorkDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.UnreconciledWorkDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.UnreconciledWorkDetail"; -} -::buffa::impl_default_view_instance!(UnreconciledWorkDetailView); -::buffa::impl_view_reborrow!(UnreconciledWorkDetailView); -/** Self-contained, `'static` owned view of a `UnreconciledWorkDetail` message. - - Wraps [`::buffa::OwnedView`]`<`[`UnreconciledWorkDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`UnreconciledWorkDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct UnreconciledWorkDetailOwnedView( - ::buffa::OwnedView>, -); -impl UnreconciledWorkDetailOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UnreconciledWorkDetailOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UnreconciledWorkDetailOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::UnreconciledWorkDetail, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UnreconciledWorkDetailOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`UnreconciledWorkDetailView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &UnreconciledWorkDetailView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::UnreconciledWorkDetail { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Tool execution id, delegation id, or saga id, per the subject kind. - /// - /// Field 1: `entity_id` - #[must_use] - pub fn entity_id(&self) -> &'_ str { - self.0.reborrow().entity_id - } - /// Field 2: `started_at` - #[must_use] - pub fn started_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().started_at - } - /// True when the session has already reached a terminal marker. A session can - /// be terminally successful and still have work stranded in flight, and that - /// combination is exactly what a reader treating terminal as complete will - /// miss. - /// - /// Field 3: `session_terminal` - #[must_use] - pub fn session_terminal(&self) -> bool { - self.0.reborrow().session_terminal - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for UnreconciledWorkDetailOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - UnreconciledWorkDetailOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: UnreconciledWorkDetailOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for UnreconciledWorkDetailOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::UnreconciledWorkDetail { - type View<'a> = UnreconciledWorkDetailView<'a>; - type ViewHandle = UnreconciledWorkDetailOwnedView; -} -impl ::serde::Serialize for UnreconciledWorkDetailOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.finding.__view_oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.finding.__view_oneof.rs deleted file mode 100644 index 2bf85bcfc..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.finding.__view_oneof.rs +++ /dev/null @@ -1,42 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/doctor/v1alpha1/finding.proto - -pub mod finding { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Detail<'a> { - EventDecode( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::EventDecodeDetailView<'a>, - >, - ), - ProjectionCheckpoint( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ProjectionCheckpointDetailView< - 'a, - >, - >, - ), - ArtifactDigest( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ArtifactDigestDetailView<'a>, - >, - ), - OperationLedger( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::OperationLedgerDetailView<'a>, - >, - ), - UnreconciledWork( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::UnreconciledWorkDetailView<'a>, - >, - ), - Orphan( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::OrphanDetailView<'a>, - >, - ), - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.finding.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.finding.rs deleted file mode 100644 index 29c131ceb..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.finding.rs +++ /dev/null @@ -1,3049 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/doctor/v1alpha1/finding.proto - -/// FindingSeverity is what an operator has to decide, not a feelings scale. -/// -/// The question a severity answers here is whether rebuilding derived state can -/// fix this. That is the only distinction that changes what an operator does -/// next, so it is the one the enum encodes. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum FindingSeverity { - FINDING_SEVERITY_UNSPECIFIED = 0i32, - /// Worth knowing, nothing is wrong. A projection a few events behind a busy - /// stream is the normal state of a projection, not a defect. - FINDING_SEVERITY_INFO = 1i32, - /// Derived state disagrees with the stream. Reads may be wrong, the stream is - /// intact, and rebuilding from it is expected to resolve the finding. - FINDING_SEVERITY_DEGRADED = 2i32, - /// The stream itself cannot be fully interpreted. No amount of rebuilding - /// helps, because the thing that would be rebuilt from is the problem. These - /// findings usually carry no available repairs, and that is the honest answer - /// rather than a gap. - FINDING_SEVERITY_CORRUPT = 3i32, -} -impl FindingSeverity { - ///Idiomatic alias for [`Self::FINDING_SEVERITY_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::FINDING_SEVERITY_UNSPECIFIED; - ///Idiomatic alias for [`Self::FINDING_SEVERITY_INFO`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Info: Self = Self::FINDING_SEVERITY_INFO; - ///Idiomatic alias for [`Self::FINDING_SEVERITY_DEGRADED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Degraded: Self = Self::FINDING_SEVERITY_DEGRADED; - ///Idiomatic alias for [`Self::FINDING_SEVERITY_CORRUPT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Corrupt: Self = Self::FINDING_SEVERITY_CORRUPT; -} -impl ::core::default::Default for FindingSeverity { - fn default() -> Self { - Self::FINDING_SEVERITY_UNSPECIFIED - } -} -impl ::serde::Serialize for FindingSeverity { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for FindingSeverity { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = FindingSeverity; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(FindingSeverity) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for FindingSeverity { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for FindingSeverity { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::FINDING_SEVERITY_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::FINDING_SEVERITY_INFO), - 2i32 => ::core::option::Option::Some(Self::FINDING_SEVERITY_DEGRADED), - 3i32 => ::core::option::Option::Some(Self::FINDING_SEVERITY_CORRUPT), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::FINDING_SEVERITY_UNSPECIFIED => "FINDING_SEVERITY_UNSPECIFIED", - Self::FINDING_SEVERITY_INFO => "FINDING_SEVERITY_INFO", - Self::FINDING_SEVERITY_DEGRADED => "FINDING_SEVERITY_DEGRADED", - Self::FINDING_SEVERITY_CORRUPT => "FINDING_SEVERITY_CORRUPT", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "FINDING_SEVERITY_UNSPECIFIED" => { - ::core::option::Option::Some(Self::FINDING_SEVERITY_UNSPECIFIED) - } - "FINDING_SEVERITY_INFO" => { - ::core::option::Option::Some(Self::FINDING_SEVERITY_INFO) - } - "FINDING_SEVERITY_DEGRADED" => { - ::core::option::Option::Some(Self::FINDING_SEVERITY_DEGRADED) - } - "FINDING_SEVERITY_CORRUPT" => { - ::core::option::Option::Some(Self::FINDING_SEVERITY_CORRUPT) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::FINDING_SEVERITY_UNSPECIFIED, - Self::FINDING_SEVERITY_INFO, - Self::FINDING_SEVERITY_DEGRADED, - Self::FINDING_SEVERITY_CORRUPT, - ] - } -} -/// FindingKind is what was observed. -/// -/// Open by protobuf's rules and treated as open here: a reader that meets an -/// unrecognized kind has reached a newer doctor and must surface it as an -/// unknown finding rather than drop it. A dropped finding reads as health. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum FindingKind { - FINDING_KIND_UNSPECIFIED = 0i32, - /// The session's stream does not exist. - FINDING_KIND_STREAM_MISSING = 1i32, - /// A creation batch landed partially. The session exists but its opening - /// invariants were never completed. - FINDING_KIND_CREATION_BATCH_INCOMPLETE = 2i32, - /// An event at a known ordinal could not be decoded. - FINDING_KIND_EVENT_DECODE_FAILED = 3i32, - /// An event carries a type this build does not know. Distinct from a decode - /// failure: the bytes may be fine and this reader is simply older. - FINDING_KIND_UNSUPPORTED_EVENT_TYPE = 4i32, - /// Folding the stream did not produce a state. Usually downstream of a decode - /// failure, reported separately because a replay can also fail on events that - /// each decode cleanly. - FINDING_KIND_AGGREGATE_REPLAY_FAILED = 5i32, - /// A snapshot does not match a replay of the events it claims to cover. - FINDING_KIND_SNAPSHOT_INVALID = 6i32, - /// A snapshot is valid but far enough behind to have stopped being useful. - FINDING_KIND_SNAPSHOT_BEHIND = 7i32, - /// A projection is behind its source beyond the configured tolerance. - FINDING_KIND_PROJECTION_BEHIND = 8i32, - /// A projection failed its own validity checks. - FINDING_KIND_PROJECTION_INVALID = 9i32, - /// A projection checkpoint claims a position the source stream does not have. - /// Nothing legitimate produces this; it means the checkpoint and the stream - /// come from different histories. - FINDING_KIND_PROJECTION_CHECKPOINT_AHEAD_OF_SOURCE = 10i32, - /// A projection checkpoint claims to have applied an event that is absent from - /// the materialized view. The checkpoint and the view disagree about the same - /// projection. - FINDING_KIND_PROJECTION_CHECKPOINT_INCONSISTENT = 11i32, - /// An artifact referenced by the session is not present in storage. - FINDING_KIND_ARTIFACT_MISSING = 12i32, - /// An artifact is present and its content no longer matches its recorded - /// digest. - FINDING_KIND_ARTIFACT_DIGEST_MISMATCH = 13i32, - /// An artifact claim or multipart upload references nothing durable. - FINDING_KIND_ORPHANED_ARTIFACT_CLAIM = 14i32, - /// A recovery checkpoint or its attestation failed verification. - FINDING_KIND_CHECKPOINT_ATTESTATION_INVALID = 15i32, - /// A delegation, detach, or cascade sequence started and never reached a - /// terminal step. - FINDING_KIND_SAGA_INCOMPLETE = 16i32, - /// A reserved operation recorded an indeterminate outcome. Non-terminal by - /// design, so this is a finding only once it is also overdue. - FINDING_KIND_OPERATION_OUTCOME_UNKNOWN = 17i32, - /// A reserved operation has recorded no outcome past its expected settlement - /// window. - FINDING_KIND_OPERATION_OUTCOME_OVERDUE = 18i32, - /// A tool call reached a started state and never recorded a terminal outcome, - /// in a session that is already terminal. This is the crash-recovery case the - /// aggregate's fold exists to expose. - FINDING_KIND_TOOL_CALL_UNRECONCILED = 19i32, - /// A retention or cold-tier watermark disagrees with what is actually - /// retained. - FINDING_KIND_RETENTION_WATERMARK_INCONSISTENT = 20i32, - /// Derived state left behind by a computation that no longer runs: an - /// abandoned projection generation, staging from a finished migration, a - /// reconciliation lease whose holder never came back. - /// - /// Separate from ORPHANED_ARTIFACT_CLAIM because releasing it destroys - /// something the stream can regenerate, and that difference is the whole basis - /// on which an operator decides how carefully to look first. - FINDING_KIND_ORPHANED_DERIVED_STATE = 21i32, -} -impl FindingKind { - ///Idiomatic alias for [`Self::FINDING_KIND_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::FINDING_KIND_UNSPECIFIED; - ///Idiomatic alias for [`Self::FINDING_KIND_STREAM_MISSING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const StreamMissing: Self = Self::FINDING_KIND_STREAM_MISSING; - ///Idiomatic alias for [`Self::FINDING_KIND_CREATION_BATCH_INCOMPLETE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const CreationBatchIncomplete: Self = Self::FINDING_KIND_CREATION_BATCH_INCOMPLETE; - ///Idiomatic alias for [`Self::FINDING_KIND_EVENT_DECODE_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const EventDecodeFailed: Self = Self::FINDING_KIND_EVENT_DECODE_FAILED; - ///Idiomatic alias for [`Self::FINDING_KIND_UNSUPPORTED_EVENT_TYPE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const UnsupportedEventType: Self = Self::FINDING_KIND_UNSUPPORTED_EVENT_TYPE; - ///Idiomatic alias for [`Self::FINDING_KIND_AGGREGATE_REPLAY_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const AggregateReplayFailed: Self = Self::FINDING_KIND_AGGREGATE_REPLAY_FAILED; - ///Idiomatic alias for [`Self::FINDING_KIND_SNAPSHOT_INVALID`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SnapshotInvalid: Self = Self::FINDING_KIND_SNAPSHOT_INVALID; - ///Idiomatic alias for [`Self::FINDING_KIND_SNAPSHOT_BEHIND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SnapshotBehind: Self = Self::FINDING_KIND_SNAPSHOT_BEHIND; - ///Idiomatic alias for [`Self::FINDING_KIND_PROJECTION_BEHIND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ProjectionBehind: Self = Self::FINDING_KIND_PROJECTION_BEHIND; - ///Idiomatic alias for [`Self::FINDING_KIND_PROJECTION_INVALID`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ProjectionInvalid: Self = Self::FINDING_KIND_PROJECTION_INVALID; - ///Idiomatic alias for [`Self::FINDING_KIND_PROJECTION_CHECKPOINT_AHEAD_OF_SOURCE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ProjectionCheckpointAheadOfSource: Self = Self::FINDING_KIND_PROJECTION_CHECKPOINT_AHEAD_OF_SOURCE; - ///Idiomatic alias for [`Self::FINDING_KIND_PROJECTION_CHECKPOINT_INCONSISTENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ProjectionCheckpointInconsistent: Self = Self::FINDING_KIND_PROJECTION_CHECKPOINT_INCONSISTENT; - ///Idiomatic alias for [`Self::FINDING_KIND_ARTIFACT_MISSING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ArtifactMissing: Self = Self::FINDING_KIND_ARTIFACT_MISSING; - ///Idiomatic alias for [`Self::FINDING_KIND_ARTIFACT_DIGEST_MISMATCH`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ArtifactDigestMismatch: Self = Self::FINDING_KIND_ARTIFACT_DIGEST_MISMATCH; - ///Idiomatic alias for [`Self::FINDING_KIND_ORPHANED_ARTIFACT_CLAIM`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const OrphanedArtifactClaim: Self = Self::FINDING_KIND_ORPHANED_ARTIFACT_CLAIM; - ///Idiomatic alias for [`Self::FINDING_KIND_CHECKPOINT_ATTESTATION_INVALID`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const CheckpointAttestationInvalid: Self = Self::FINDING_KIND_CHECKPOINT_ATTESTATION_INVALID; - ///Idiomatic alias for [`Self::FINDING_KIND_SAGA_INCOMPLETE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SagaIncomplete: Self = Self::FINDING_KIND_SAGA_INCOMPLETE; - ///Idiomatic alias for [`Self::FINDING_KIND_OPERATION_OUTCOME_UNKNOWN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const OperationOutcomeUnknown: Self = Self::FINDING_KIND_OPERATION_OUTCOME_UNKNOWN; - ///Idiomatic alias for [`Self::FINDING_KIND_OPERATION_OUTCOME_OVERDUE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const OperationOutcomeOverdue: Self = Self::FINDING_KIND_OPERATION_OUTCOME_OVERDUE; - ///Idiomatic alias for [`Self::FINDING_KIND_TOOL_CALL_UNRECONCILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ToolCallUnreconciled: Self = Self::FINDING_KIND_TOOL_CALL_UNRECONCILED; - ///Idiomatic alias for [`Self::FINDING_KIND_RETENTION_WATERMARK_INCONSISTENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const RetentionWatermarkInconsistent: Self = Self::FINDING_KIND_RETENTION_WATERMARK_INCONSISTENT; - ///Idiomatic alias for [`Self::FINDING_KIND_ORPHANED_DERIVED_STATE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const OrphanedDerivedState: Self = Self::FINDING_KIND_ORPHANED_DERIVED_STATE; -} -impl ::core::default::Default for FindingKind { - fn default() -> Self { - Self::FINDING_KIND_UNSPECIFIED - } -} -impl ::serde::Serialize for FindingKind { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for FindingKind { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = FindingKind; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(FindingKind)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for FindingKind { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for FindingKind { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::FINDING_KIND_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::FINDING_KIND_STREAM_MISSING), - 2i32 => { - ::core::option::Option::Some( - Self::FINDING_KIND_CREATION_BATCH_INCOMPLETE, - ) - } - 3i32 => ::core::option::Option::Some(Self::FINDING_KIND_EVENT_DECODE_FAILED), - 4i32 => { - ::core::option::Option::Some(Self::FINDING_KIND_UNSUPPORTED_EVENT_TYPE) - } - 5i32 => { - ::core::option::Option::Some(Self::FINDING_KIND_AGGREGATE_REPLAY_FAILED) - } - 6i32 => ::core::option::Option::Some(Self::FINDING_KIND_SNAPSHOT_INVALID), - 7i32 => ::core::option::Option::Some(Self::FINDING_KIND_SNAPSHOT_BEHIND), - 8i32 => ::core::option::Option::Some(Self::FINDING_KIND_PROJECTION_BEHIND), - 9i32 => ::core::option::Option::Some(Self::FINDING_KIND_PROJECTION_INVALID), - 10i32 => { - ::core::option::Option::Some( - Self::FINDING_KIND_PROJECTION_CHECKPOINT_AHEAD_OF_SOURCE, - ) - } - 11i32 => { - ::core::option::Option::Some( - Self::FINDING_KIND_PROJECTION_CHECKPOINT_INCONSISTENT, - ) - } - 12i32 => ::core::option::Option::Some(Self::FINDING_KIND_ARTIFACT_MISSING), - 13i32 => { - ::core::option::Option::Some(Self::FINDING_KIND_ARTIFACT_DIGEST_MISMATCH) - } - 14i32 => { - ::core::option::Option::Some(Self::FINDING_KIND_ORPHANED_ARTIFACT_CLAIM) - } - 15i32 => { - ::core::option::Option::Some( - Self::FINDING_KIND_CHECKPOINT_ATTESTATION_INVALID, - ) - } - 16i32 => ::core::option::Option::Some(Self::FINDING_KIND_SAGA_INCOMPLETE), - 17i32 => { - ::core::option::Option::Some( - Self::FINDING_KIND_OPERATION_OUTCOME_UNKNOWN, - ) - } - 18i32 => { - ::core::option::Option::Some( - Self::FINDING_KIND_OPERATION_OUTCOME_OVERDUE, - ) - } - 19i32 => { - ::core::option::Option::Some(Self::FINDING_KIND_TOOL_CALL_UNRECONCILED) - } - 20i32 => { - ::core::option::Option::Some( - Self::FINDING_KIND_RETENTION_WATERMARK_INCONSISTENT, - ) - } - 21i32 => { - ::core::option::Option::Some(Self::FINDING_KIND_ORPHANED_DERIVED_STATE) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::FINDING_KIND_UNSPECIFIED => "FINDING_KIND_UNSPECIFIED", - Self::FINDING_KIND_STREAM_MISSING => "FINDING_KIND_STREAM_MISSING", - Self::FINDING_KIND_CREATION_BATCH_INCOMPLETE => { - "FINDING_KIND_CREATION_BATCH_INCOMPLETE" - } - Self::FINDING_KIND_EVENT_DECODE_FAILED => "FINDING_KIND_EVENT_DECODE_FAILED", - Self::FINDING_KIND_UNSUPPORTED_EVENT_TYPE => { - "FINDING_KIND_UNSUPPORTED_EVENT_TYPE" - } - Self::FINDING_KIND_AGGREGATE_REPLAY_FAILED => { - "FINDING_KIND_AGGREGATE_REPLAY_FAILED" - } - Self::FINDING_KIND_SNAPSHOT_INVALID => "FINDING_KIND_SNAPSHOT_INVALID", - Self::FINDING_KIND_SNAPSHOT_BEHIND => "FINDING_KIND_SNAPSHOT_BEHIND", - Self::FINDING_KIND_PROJECTION_BEHIND => "FINDING_KIND_PROJECTION_BEHIND", - Self::FINDING_KIND_PROJECTION_INVALID => "FINDING_KIND_PROJECTION_INVALID", - Self::FINDING_KIND_PROJECTION_CHECKPOINT_AHEAD_OF_SOURCE => { - "FINDING_KIND_PROJECTION_CHECKPOINT_AHEAD_OF_SOURCE" - } - Self::FINDING_KIND_PROJECTION_CHECKPOINT_INCONSISTENT => { - "FINDING_KIND_PROJECTION_CHECKPOINT_INCONSISTENT" - } - Self::FINDING_KIND_ARTIFACT_MISSING => "FINDING_KIND_ARTIFACT_MISSING", - Self::FINDING_KIND_ARTIFACT_DIGEST_MISMATCH => { - "FINDING_KIND_ARTIFACT_DIGEST_MISMATCH" - } - Self::FINDING_KIND_ORPHANED_ARTIFACT_CLAIM => { - "FINDING_KIND_ORPHANED_ARTIFACT_CLAIM" - } - Self::FINDING_KIND_CHECKPOINT_ATTESTATION_INVALID => { - "FINDING_KIND_CHECKPOINT_ATTESTATION_INVALID" - } - Self::FINDING_KIND_SAGA_INCOMPLETE => "FINDING_KIND_SAGA_INCOMPLETE", - Self::FINDING_KIND_OPERATION_OUTCOME_UNKNOWN => { - "FINDING_KIND_OPERATION_OUTCOME_UNKNOWN" - } - Self::FINDING_KIND_OPERATION_OUTCOME_OVERDUE => { - "FINDING_KIND_OPERATION_OUTCOME_OVERDUE" - } - Self::FINDING_KIND_TOOL_CALL_UNRECONCILED => { - "FINDING_KIND_TOOL_CALL_UNRECONCILED" - } - Self::FINDING_KIND_RETENTION_WATERMARK_INCONSISTENT => { - "FINDING_KIND_RETENTION_WATERMARK_INCONSISTENT" - } - Self::FINDING_KIND_ORPHANED_DERIVED_STATE => { - "FINDING_KIND_ORPHANED_DERIVED_STATE" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "FINDING_KIND_UNSPECIFIED" => { - ::core::option::Option::Some(Self::FINDING_KIND_UNSPECIFIED) - } - "FINDING_KIND_STREAM_MISSING" => { - ::core::option::Option::Some(Self::FINDING_KIND_STREAM_MISSING) - } - "FINDING_KIND_CREATION_BATCH_INCOMPLETE" => { - ::core::option::Option::Some( - Self::FINDING_KIND_CREATION_BATCH_INCOMPLETE, - ) - } - "FINDING_KIND_EVENT_DECODE_FAILED" => { - ::core::option::Option::Some(Self::FINDING_KIND_EVENT_DECODE_FAILED) - } - "FINDING_KIND_UNSUPPORTED_EVENT_TYPE" => { - ::core::option::Option::Some(Self::FINDING_KIND_UNSUPPORTED_EVENT_TYPE) - } - "FINDING_KIND_AGGREGATE_REPLAY_FAILED" => { - ::core::option::Option::Some(Self::FINDING_KIND_AGGREGATE_REPLAY_FAILED) - } - "FINDING_KIND_SNAPSHOT_INVALID" => { - ::core::option::Option::Some(Self::FINDING_KIND_SNAPSHOT_INVALID) - } - "FINDING_KIND_SNAPSHOT_BEHIND" => { - ::core::option::Option::Some(Self::FINDING_KIND_SNAPSHOT_BEHIND) - } - "FINDING_KIND_PROJECTION_BEHIND" => { - ::core::option::Option::Some(Self::FINDING_KIND_PROJECTION_BEHIND) - } - "FINDING_KIND_PROJECTION_INVALID" => { - ::core::option::Option::Some(Self::FINDING_KIND_PROJECTION_INVALID) - } - "FINDING_KIND_PROJECTION_CHECKPOINT_AHEAD_OF_SOURCE" => { - ::core::option::Option::Some( - Self::FINDING_KIND_PROJECTION_CHECKPOINT_AHEAD_OF_SOURCE, - ) - } - "FINDING_KIND_PROJECTION_CHECKPOINT_INCONSISTENT" => { - ::core::option::Option::Some( - Self::FINDING_KIND_PROJECTION_CHECKPOINT_INCONSISTENT, - ) - } - "FINDING_KIND_ARTIFACT_MISSING" => { - ::core::option::Option::Some(Self::FINDING_KIND_ARTIFACT_MISSING) - } - "FINDING_KIND_ARTIFACT_DIGEST_MISMATCH" => { - ::core::option::Option::Some(Self::FINDING_KIND_ARTIFACT_DIGEST_MISMATCH) - } - "FINDING_KIND_ORPHANED_ARTIFACT_CLAIM" => { - ::core::option::Option::Some(Self::FINDING_KIND_ORPHANED_ARTIFACT_CLAIM) - } - "FINDING_KIND_CHECKPOINT_ATTESTATION_INVALID" => { - ::core::option::Option::Some( - Self::FINDING_KIND_CHECKPOINT_ATTESTATION_INVALID, - ) - } - "FINDING_KIND_SAGA_INCOMPLETE" => { - ::core::option::Option::Some(Self::FINDING_KIND_SAGA_INCOMPLETE) - } - "FINDING_KIND_OPERATION_OUTCOME_UNKNOWN" => { - ::core::option::Option::Some( - Self::FINDING_KIND_OPERATION_OUTCOME_UNKNOWN, - ) - } - "FINDING_KIND_OPERATION_OUTCOME_OVERDUE" => { - ::core::option::Option::Some( - Self::FINDING_KIND_OPERATION_OUTCOME_OVERDUE, - ) - } - "FINDING_KIND_TOOL_CALL_UNRECONCILED" => { - ::core::option::Option::Some(Self::FINDING_KIND_TOOL_CALL_UNRECONCILED) - } - "FINDING_KIND_RETENTION_WATERMARK_INCONSISTENT" => { - ::core::option::Option::Some( - Self::FINDING_KIND_RETENTION_WATERMARK_INCONSISTENT, - ) - } - "FINDING_KIND_ORPHANED_DERIVED_STATE" => { - ::core::option::Option::Some(Self::FINDING_KIND_ORPHANED_DERIVED_STATE) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::FINDING_KIND_UNSPECIFIED, - Self::FINDING_KIND_STREAM_MISSING, - Self::FINDING_KIND_CREATION_BATCH_INCOMPLETE, - Self::FINDING_KIND_EVENT_DECODE_FAILED, - Self::FINDING_KIND_UNSUPPORTED_EVENT_TYPE, - Self::FINDING_KIND_AGGREGATE_REPLAY_FAILED, - Self::FINDING_KIND_SNAPSHOT_INVALID, - Self::FINDING_KIND_SNAPSHOT_BEHIND, - Self::FINDING_KIND_PROJECTION_BEHIND, - Self::FINDING_KIND_PROJECTION_INVALID, - Self::FINDING_KIND_PROJECTION_CHECKPOINT_AHEAD_OF_SOURCE, - Self::FINDING_KIND_PROJECTION_CHECKPOINT_INCONSISTENT, - Self::FINDING_KIND_ARTIFACT_MISSING, - Self::FINDING_KIND_ARTIFACT_DIGEST_MISMATCH, - Self::FINDING_KIND_ORPHANED_ARTIFACT_CLAIM, - Self::FINDING_KIND_CHECKPOINT_ATTESTATION_INVALID, - Self::FINDING_KIND_SAGA_INCOMPLETE, - Self::FINDING_KIND_OPERATION_OUTCOME_UNKNOWN, - Self::FINDING_KIND_OPERATION_OUTCOME_OVERDUE, - Self::FINDING_KIND_TOOL_CALL_UNRECONCILED, - Self::FINDING_KIND_RETENTION_WATERMARK_INCONSISTENT, - Self::FINDING_KIND_ORPHANED_DERIVED_STATE, - ] - } -} -/// SubjectKind is which part of a session a finding concerns. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum SubjectKind { - SUBJECT_KIND_UNSPECIFIED = 0i32, - SUBJECT_KIND_STREAM = 1i32, - SUBJECT_KIND_EVENT = 2i32, - SUBJECT_KIND_SNAPSHOT = 3i32, - SUBJECT_KIND_PROJECTION = 4i32, - SUBJECT_KIND_ARTIFACT = 5i32, - SUBJECT_KIND_OPERATION = 6i32, - SUBJECT_KIND_TOOL_CALL = 7i32, - SUBJECT_KIND_DELEGATION = 8i32, - SUBJECT_KIND_CHECKPOINT = 9i32, -} -impl SubjectKind { - ///Idiomatic alias for [`Self::SUBJECT_KIND_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::SUBJECT_KIND_UNSPECIFIED; - ///Idiomatic alias for [`Self::SUBJECT_KIND_STREAM`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Stream: Self = Self::SUBJECT_KIND_STREAM; - ///Idiomatic alias for [`Self::SUBJECT_KIND_EVENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Event: Self = Self::SUBJECT_KIND_EVENT; - ///Idiomatic alias for [`Self::SUBJECT_KIND_SNAPSHOT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Snapshot: Self = Self::SUBJECT_KIND_SNAPSHOT; - ///Idiomatic alias for [`Self::SUBJECT_KIND_PROJECTION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Projection: Self = Self::SUBJECT_KIND_PROJECTION; - ///Idiomatic alias for [`Self::SUBJECT_KIND_ARTIFACT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Artifact: Self = Self::SUBJECT_KIND_ARTIFACT; - ///Idiomatic alias for [`Self::SUBJECT_KIND_OPERATION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Operation: Self = Self::SUBJECT_KIND_OPERATION; - ///Idiomatic alias for [`Self::SUBJECT_KIND_TOOL_CALL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ToolCall: Self = Self::SUBJECT_KIND_TOOL_CALL; - ///Idiomatic alias for [`Self::SUBJECT_KIND_DELEGATION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Delegation: Self = Self::SUBJECT_KIND_DELEGATION; - ///Idiomatic alias for [`Self::SUBJECT_KIND_CHECKPOINT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Checkpoint: Self = Self::SUBJECT_KIND_CHECKPOINT; -} -impl ::core::default::Default for SubjectKind { - fn default() -> Self { - Self::SUBJECT_KIND_UNSPECIFIED - } -} -impl ::serde::Serialize for SubjectKind { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for SubjectKind { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = SubjectKind; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(SubjectKind)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for SubjectKind { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for SubjectKind { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::SUBJECT_KIND_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::SUBJECT_KIND_STREAM), - 2i32 => ::core::option::Option::Some(Self::SUBJECT_KIND_EVENT), - 3i32 => ::core::option::Option::Some(Self::SUBJECT_KIND_SNAPSHOT), - 4i32 => ::core::option::Option::Some(Self::SUBJECT_KIND_PROJECTION), - 5i32 => ::core::option::Option::Some(Self::SUBJECT_KIND_ARTIFACT), - 6i32 => ::core::option::Option::Some(Self::SUBJECT_KIND_OPERATION), - 7i32 => ::core::option::Option::Some(Self::SUBJECT_KIND_TOOL_CALL), - 8i32 => ::core::option::Option::Some(Self::SUBJECT_KIND_DELEGATION), - 9i32 => ::core::option::Option::Some(Self::SUBJECT_KIND_CHECKPOINT), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::SUBJECT_KIND_UNSPECIFIED => "SUBJECT_KIND_UNSPECIFIED", - Self::SUBJECT_KIND_STREAM => "SUBJECT_KIND_STREAM", - Self::SUBJECT_KIND_EVENT => "SUBJECT_KIND_EVENT", - Self::SUBJECT_KIND_SNAPSHOT => "SUBJECT_KIND_SNAPSHOT", - Self::SUBJECT_KIND_PROJECTION => "SUBJECT_KIND_PROJECTION", - Self::SUBJECT_KIND_ARTIFACT => "SUBJECT_KIND_ARTIFACT", - Self::SUBJECT_KIND_OPERATION => "SUBJECT_KIND_OPERATION", - Self::SUBJECT_KIND_TOOL_CALL => "SUBJECT_KIND_TOOL_CALL", - Self::SUBJECT_KIND_DELEGATION => "SUBJECT_KIND_DELEGATION", - Self::SUBJECT_KIND_CHECKPOINT => "SUBJECT_KIND_CHECKPOINT", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "SUBJECT_KIND_UNSPECIFIED" => { - ::core::option::Option::Some(Self::SUBJECT_KIND_UNSPECIFIED) - } - "SUBJECT_KIND_STREAM" => { - ::core::option::Option::Some(Self::SUBJECT_KIND_STREAM) - } - "SUBJECT_KIND_EVENT" => { - ::core::option::Option::Some(Self::SUBJECT_KIND_EVENT) - } - "SUBJECT_KIND_SNAPSHOT" => { - ::core::option::Option::Some(Self::SUBJECT_KIND_SNAPSHOT) - } - "SUBJECT_KIND_PROJECTION" => { - ::core::option::Option::Some(Self::SUBJECT_KIND_PROJECTION) - } - "SUBJECT_KIND_ARTIFACT" => { - ::core::option::Option::Some(Self::SUBJECT_KIND_ARTIFACT) - } - "SUBJECT_KIND_OPERATION" => { - ::core::option::Option::Some(Self::SUBJECT_KIND_OPERATION) - } - "SUBJECT_KIND_TOOL_CALL" => { - ::core::option::Option::Some(Self::SUBJECT_KIND_TOOL_CALL) - } - "SUBJECT_KIND_DELEGATION" => { - ::core::option::Option::Some(Self::SUBJECT_KIND_DELEGATION) - } - "SUBJECT_KIND_CHECKPOINT" => { - ::core::option::Option::Some(Self::SUBJECT_KIND_CHECKPOINT) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::SUBJECT_KIND_UNSPECIFIED, - Self::SUBJECT_KIND_STREAM, - Self::SUBJECT_KIND_EVENT, - Self::SUBJECT_KIND_SNAPSHOT, - Self::SUBJECT_KIND_PROJECTION, - Self::SUBJECT_KIND_ARTIFACT, - Self::SUBJECT_KIND_OPERATION, - Self::SUBJECT_KIND_TOOL_CALL, - Self::SUBJECT_KIND_DELEGATION, - Self::SUBJECT_KIND_CHECKPOINT, - ] - } -} -/// ArtifactDigestObservation is what the verification attempt found. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ArtifactDigestObservation { - ARTIFACT_DIGEST_OBSERVATION_UNSPECIFIED = 0i32, - /// Content read, digest computed, digests differ. - ARTIFACT_DIGEST_OBSERVATION_MISMATCH = 1i32, - /// Content is not present in storage. - ARTIFACT_DIGEST_OBSERVATION_ABSENT = 2i32, - /// Content is present and could not be read. Distinct from absent: an - /// unreadable artifact may be a permissions or transport problem rather than - /// data loss, and treating it as loss invites a destructive repair. - ARTIFACT_DIGEST_OBSERVATION_UNREADABLE = 3i32, -} -impl ArtifactDigestObservation { - ///Idiomatic alias for [`Self::ARTIFACT_DIGEST_OBSERVATION_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::ARTIFACT_DIGEST_OBSERVATION_UNSPECIFIED; - ///Idiomatic alias for [`Self::ARTIFACT_DIGEST_OBSERVATION_MISMATCH`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Mismatch: Self = Self::ARTIFACT_DIGEST_OBSERVATION_MISMATCH; - ///Idiomatic alias for [`Self::ARTIFACT_DIGEST_OBSERVATION_ABSENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Absent: Self = Self::ARTIFACT_DIGEST_OBSERVATION_ABSENT; - ///Idiomatic alias for [`Self::ARTIFACT_DIGEST_OBSERVATION_UNREADABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unreadable: Self = Self::ARTIFACT_DIGEST_OBSERVATION_UNREADABLE; -} -impl ::core::default::Default for ArtifactDigestObservation { - fn default() -> Self { - Self::ARTIFACT_DIGEST_OBSERVATION_UNSPECIFIED - } -} -impl ::serde::Serialize for ArtifactDigestObservation { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ArtifactDigestObservation { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ArtifactDigestObservation; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(ArtifactDigestObservation) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ArtifactDigestObservation { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ArtifactDigestObservation { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some( - Self::ARTIFACT_DIGEST_OBSERVATION_UNSPECIFIED, - ) - } - 1i32 => { - ::core::option::Option::Some(Self::ARTIFACT_DIGEST_OBSERVATION_MISMATCH) - } - 2i32 => { - ::core::option::Option::Some(Self::ARTIFACT_DIGEST_OBSERVATION_ABSENT) - } - 3i32 => { - ::core::option::Option::Some( - Self::ARTIFACT_DIGEST_OBSERVATION_UNREADABLE, - ) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::ARTIFACT_DIGEST_OBSERVATION_UNSPECIFIED => { - "ARTIFACT_DIGEST_OBSERVATION_UNSPECIFIED" - } - Self::ARTIFACT_DIGEST_OBSERVATION_MISMATCH => { - "ARTIFACT_DIGEST_OBSERVATION_MISMATCH" - } - Self::ARTIFACT_DIGEST_OBSERVATION_ABSENT => { - "ARTIFACT_DIGEST_OBSERVATION_ABSENT" - } - Self::ARTIFACT_DIGEST_OBSERVATION_UNREADABLE => { - "ARTIFACT_DIGEST_OBSERVATION_UNREADABLE" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "ARTIFACT_DIGEST_OBSERVATION_UNSPECIFIED" => { - ::core::option::Option::Some( - Self::ARTIFACT_DIGEST_OBSERVATION_UNSPECIFIED, - ) - } - "ARTIFACT_DIGEST_OBSERVATION_MISMATCH" => { - ::core::option::Option::Some(Self::ARTIFACT_DIGEST_OBSERVATION_MISMATCH) - } - "ARTIFACT_DIGEST_OBSERVATION_ABSENT" => { - ::core::option::Option::Some(Self::ARTIFACT_DIGEST_OBSERVATION_ABSENT) - } - "ARTIFACT_DIGEST_OBSERVATION_UNREADABLE" => { - ::core::option::Option::Some( - Self::ARTIFACT_DIGEST_OBSERVATION_UNREADABLE, - ) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::ARTIFACT_DIGEST_OBSERVATION_UNSPECIFIED, - Self::ARTIFACT_DIGEST_OBSERVATION_MISMATCH, - Self::ARTIFACT_DIGEST_OBSERVATION_ABSENT, - Self::ARTIFACT_DIGEST_OBSERVATION_UNREADABLE, - ] - } -} -/// Finding is one inconsistency the doctor observed. -/// -/// A finding is an observation, never an instruction. It says what disagrees -/// with what, and it names the repairs that could address it, but producing one -/// mutates nothing. That separation is the whole design: diagnosis and repair are -/// different operations with different messages, so a caller cannot reach a -/// mutation by filling in one more field on a read. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct Finding { - /// Stable identity for this problem: a digest over `kind` and `subject`. - /// - /// Deliberately not a digest over the observed values. A projection that falls - /// further behind between diagnosis and repair is still the same finding, and - /// an id that changed with every observed byte would make repairs impossible on - /// a busy session. Staleness is caught by re-verifying the finding at repair - /// time, not by comparing ids. - /// - /// Field 1: `finding_id` - #[serde( - rename = "findingId", - alias = "finding_id", - with = "::buffa::json_helpers::proto_string" - )] - pub finding_id: ::buffa::alloc::string::String, - /// Field 2: `kind` - #[serde(rename = "kind", with = "::buffa::json_helpers::proto_enum")] - pub kind: ::buffa::EnumValue, - /// Field 3: `severity` - #[serde(rename = "severity", with = "::buffa::json_helpers::proto_enum")] - pub severity: ::buffa::EnumValue, - /// Field 4: `subject` - #[serde(rename = "subject")] - pub subject: ::buffa::MessageField>, - /// Human-readable, non-contractual, safe to log. Never parse it. - /// - /// Field 5: `summary` - #[serde(rename = "summary", with = "::buffa::json_helpers::proto_string")] - pub summary: ::buffa::alloc::string::String, - /// Repairs that could address this finding, and the only actions a - /// RepairSessionRequest may name for it. An empty list means nothing the - /// doctor can do will help, which is the normal case for a CORRUPT finding. - /// - /// Field 6: `available_repairs` - #[serde( - rename = "availableRepairs", - alias = "available_repairs", - with = "::buffa::json_helpers::repeated_enum", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec" - )] - pub available_repairs: ::buffa::alloc::vec::Vec<::buffa::EnumValue>, - /// Field 7: `observed_at` - #[serde(rename = "observedAt", alias = "observed_at")] - pub observed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - #[serde(flatten)] - pub detail: ::core::option::Option<__buffa::oneof::finding::Detail>, -} -impl ::core::fmt::Debug for Finding { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Finding") - .field("finding_id", &self.finding_id) - .field("kind", &self.kind) - .field("severity", &self.severity) - .field("subject", &self.subject) - .field("summary", &self.summary) - .field("available_repairs", &self.available_repairs) - .field("observed_at", &self.observed_at) - .field("detail", &self.detail) - .finish() - } -} -impl Finding { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.Finding"; -} -::buffa::impl_default_instance!(Finding); -impl ::buffa::MessageName for Finding { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "Finding"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.Finding"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.Finding"; -} -impl ::buffa::Message for Finding { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.finding_id) as u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - { - let val = self.severity.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.subject.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.subject.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary) as u64; - if !self.available_repairs.is_empty() { - let payload: u64 = self - .available_repairs - .iter() - .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u64) - .sum::(); - size += 1u64 + ::buffa::encoding::varint_len(payload) as u64 + payload; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let ::core::option::Option::Some(ref v) = self.detail { - match v { - __buffa::oneof::finding::Detail::EventDecode(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::finding::Detail::ProjectionCheckpoint(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::finding::Detail::ArtifactDigest(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::finding::Detail::OperationLedger(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::finding::Detail::UnreconciledWork(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::finding::Detail::Orphan(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.finding_id, buf); - ::buffa::types::put_int32_field(2u32, self.kind.to_i32(), buf); - ::buffa::types::put_int32_field(3u32, self.severity.to_i32(), buf); - if self.subject.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.subject.write_to(__cache, buf); - } - ::buffa::types::put_string_field(5u32, &self.summary, buf); - if !self.available_repairs.is_empty() { - let payload: u64 = self - .available_repairs - .iter() - .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u64) - .sum::(); - ::buffa::types::put_len_delimited_header(6u32, payload, buf); - for v in &self.available_repairs { - ::buffa::types::encode_int32(v.to_i32(), buf); - } - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - if let ::core::option::Option::Some(ref v) = self.detail { - match v { - __buffa::oneof::finding::Detail::EventDecode(x) => { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::finding::Detail::ProjectionCheckpoint(x) => { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::finding::Detail::ArtifactDigest(x) => { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::finding::Detail::OperationLedger(x) => { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::finding::Detail::UnreconciledWork(x) => { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::finding::Detail::Orphan(x) => { - ::buffa::types::put_len_delimited_header( - 13u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.finding_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.kind = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.severity = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.subject.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.summary, buf)?; - } - 6u32 => { - if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { - let len = ::buffa::encoding::decode_varint(buf)?; - let len = usize::try_from(len) - .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; - if buf.remaining() < len { - return ::core::result::Result::Err( - ::buffa::DecodeError::UnexpectedEof, - ); - } - self.available_repairs.reserve(len); - let mut limited = buf.take(len); - while limited.has_remaining() { - self.available_repairs - .push( - ::buffa::EnumValue::from( - ::buffa::types::decode_int32_packed(&mut limited)?, - ), - ); - } - let leftover = limited.remaining(); - if leftover > 0 { - limited.advance(leftover); - } - } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { - self.available_repairs - .push( - ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?), - ); - } else { - return ::core::result::Result::Err( - ::buffa::encoding::wire_type_mismatch( - tag, - ::buffa::encoding::WireType::LengthDelimited, - ), - ); - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::finding::Detail::EventDecode(ref mut existing), - ) = self.detail - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.detail = ::core::option::Option::Some( - __buffa::oneof::finding::Detail::EventDecode( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::finding::Detail::ProjectionCheckpoint( - ref mut existing, - ), - ) = self.detail - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.detail = ::core::option::Option::Some( - __buffa::oneof::finding::Detail::ProjectionCheckpoint( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::finding::Detail::ArtifactDigest(ref mut existing), - ) = self.detail - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.detail = ::core::option::Option::Some( - __buffa::oneof::finding::Detail::ArtifactDigest( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::finding::Detail::OperationLedger(ref mut existing), - ) = self.detail - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.detail = ::core::option::Option::Some( - __buffa::oneof::finding::Detail::OperationLedger( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::finding::Detail::UnreconciledWork(ref mut existing), - ) = self.detail - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.detail = ::core::option::Option::Some( - __buffa::oneof::finding::Detail::UnreconciledWork( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::finding::Detail::Orphan(ref mut existing), - ) = self.detail - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.detail = ::core::option::Option::Some( - __buffa::oneof::finding::Detail::Orphan( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.finding_id.clear(); - self.kind = ::buffa::EnumValue::from(0); - self.severity = ::buffa::EnumValue::from(0); - self.subject = ::buffa::MessageField::none(); - self.summary.clear(); - self.available_repairs.clear(); - self.observed_at = ::buffa::MessageField::none(); - self.detail = ::core::option::Option::None; - } -} -impl<'de> serde::Deserialize<'de> for Finding { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = Finding; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct Finding") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __f_finding_id: ::core::option::Option< - ::buffa::alloc::string::String, - > = None; - let mut __f_kind: ::core::option::Option< - ::buffa::EnumValue, - > = None; - let mut __f_severity: ::core::option::Option< - ::buffa::EnumValue, - > = None; - let mut __f_subject: ::core::option::Option< - ::buffa::MessageField>, - > = None; - let mut __f_summary: ::core::option::Option< - ::buffa::alloc::string::String, - > = None; - let mut __f_available_repairs: ::core::option::Option< - ::buffa::alloc::vec::Vec<::buffa::EnumValue>, - > = None; - let mut __f_observed_at: ::core::option::Option< - ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - > = None; - let mut __oneof_detail: ::core::option::Option< - __buffa::oneof::finding::Detail, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "findingId" | "finding_id" => { - __f_finding_id = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::alloc::string::String; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::string::String, - D::Error, - > { - ::buffa::json_helpers::proto_string::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "kind" => { - __f_kind = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::EnumValue; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::EnumValue, - D::Error, - > { - ::buffa::json_helpers::proto_enum::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "severity" => { - __f_severity = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::EnumValue; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::EnumValue, - D::Error, - > { - ::buffa::json_helpers::proto_enum::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "subject" => { - __f_subject = Some( - map - .next_value::< - ::buffa::MessageField< - SubjectRef, - ::buffa::Inline, - >, - >()?, - ); - } - "summary" => { - __f_summary = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::alloc::string::String; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::string::String, - D::Error, - > { - ::buffa::json_helpers::proto_string::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "availableRepairs" | "available_repairs" => { - __f_available_repairs = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::alloc::vec::Vec< - ::buffa::EnumValue, - >; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::vec::Vec<::buffa::EnumValue>, - D::Error, - > { - ::buffa::json_helpers::repeated_enum::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "observedAt" | "observed_at" => { - __f_observed_at = Some( - map - .next_value::< - ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - >()?, - ); - } - "eventDecode" | "event_decode" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - EventDecodeDetail, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_detail.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'detail'", - ), - ); - } - __oneof_detail = Some( - __buffa::oneof::finding::Detail::EventDecode( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "projectionCheckpoint" | "projection_checkpoint" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ProjectionCheckpointDetail, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_detail.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'detail'", - ), - ); - } - __oneof_detail = Some( - __buffa::oneof::finding::Detail::ProjectionCheckpoint( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "artifactDigest" | "artifact_digest" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ArtifactDigestDetail, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_detail.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'detail'", - ), - ); - } - __oneof_detail = Some( - __buffa::oneof::finding::Detail::ArtifactDigest( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "operationLedger" | "operation_ledger" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - OperationLedgerDetail, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_detail.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'detail'", - ), - ); - } - __oneof_detail = Some( - __buffa::oneof::finding::Detail::OperationLedger( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "unreconciledWork" | "unreconciled_work" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - UnreconciledWorkDetail, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_detail.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'detail'", - ), - ); - } - __oneof_detail = Some( - __buffa::oneof::finding::Detail::UnreconciledWork( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "orphan" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - OrphanDetail, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_detail.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'detail'", - ), - ); - } - __oneof_detail = Some( - __buffa::oneof::finding::Detail::Orphan( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - if let ::core::option::Option::Some(v) = __f_finding_id { - __r.finding_id = v; - } - if let ::core::option::Option::Some(v) = __f_kind { - __r.kind = v; - } - if let ::core::option::Option::Some(v) = __f_severity { - __r.severity = v; - } - if let ::core::option::Option::Some(v) = __f_subject { - __r.subject = v; - } - if let ::core::option::Option::Some(v) = __f_summary { - __r.summary = v; - } - if let ::core::option::Option::Some(v) = __f_available_repairs { - __r.available_repairs = v; - } - if let ::core::option::Option::Some(v) = __f_observed_at { - __r.observed_at = v; - } - __r.detail = __oneof_detail; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for Finding { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __FINDING_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.Finding", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod finding { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::finding::Detail; - #[doc(inline)] - pub use super::__buffa::view::oneof::finding::Detail as DetailView; -} -/// SubjectRef says what a finding is about. -/// -/// `kind` is what gives `entity_id` meaning, and the pair travels together for -/// that reason: an id with no idea what it identifies is not a reference. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SubjectRef { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `kind` - #[serde(rename = "kind", with = "::buffa::json_helpers::proto_enum")] - pub kind: ::buffa::EnumValue, - /// Interpreted according to `kind`: an artifact id, an operation id, a tool - /// execution id, a projection name. Unset when `kind` is STREAM, which needs - /// no further identity than the session. - /// - /// Field 3: `entity_id` - #[serde( - rename = "entityId", - alias = "entity_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub entity_id: ::core::option::Option<::buffa::alloc::string::String>, - /// The SessionOrdinal the finding is anchored at. Unset when the finding is - /// not ordinal-scoped, which is not the same as ordinal zero. - /// - /// Field 4: `ordinal` - #[serde( - rename = "ordinal", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub ordinal: ::core::option::Option, -} -impl ::core::fmt::Debug for SubjectRef { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SubjectRef") - .field("session_id", &self.session_id) - .field("kind", &self.kind) - .field("entity_id", &self.entity_id) - .field("ordinal", &self.ordinal) - .finish() - } -} -impl SubjectRef { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.SubjectRef"; -} -impl SubjectRef { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::entity_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_entity_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.entity_id = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::ordinal`] to `Some(value)`, consuming and returning `self`. - pub fn with_ordinal(mut self, value: u64) -> Self { - self.ordinal = Some(value); - self - } -} -::buffa::impl_default_instance!(SubjectRef); -impl ::buffa::MessageName for SubjectRef { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "SubjectRef"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.SubjectRef"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.SubjectRef"; -} -impl ::buffa::Message for SubjectRef { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.entity_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(v) = self.ordinal { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.kind.to_i32(), buf); - if let Some(ref v) = self.entity_id { - ::buffa::types::put_string_field(3u32, v, buf); - } - if let Some(v) = self.ordinal { - ::buffa::types::put_uint64_field(4u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.kind = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .entity_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.ordinal = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.kind = ::buffa::EnumValue::from(0); - self.entity_id = ::core::option::Option::None; - self.ordinal = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for SubjectRef { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SUBJECT_REF_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.SubjectRef", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// EventDecodeDetail is enough to find the offending event without re-running -/// the scan. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct EventDecodeDetail { - /// Field 1: `ordinal` - #[serde(rename = "ordinal", with = "::buffa::json_helpers::uint64")] - pub ordinal: u64, - /// Field 2: `type_url` - #[serde( - rename = "typeUrl", - alias = "type_url", - with = "::buffa::json_helpers::proto_string" - )] - pub type_url: ::buffa::alloc::string::String, - /// Decoder error text. Diagnostic only, never parsed. - /// - /// Field 3: `decoder_error` - #[serde( - rename = "decoderError", - alias = "decoder_error", - with = "::buffa::json_helpers::proto_string" - )] - pub decoder_error: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for EventDecodeDetail { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("EventDecodeDetail") - .field("ordinal", &self.ordinal) - .field("type_url", &self.type_url) - .field("decoder_error", &self.decoder_error) - .finish() - } -} -impl EventDecodeDetail { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.EventDecodeDetail"; -} -::buffa::impl_default_instance!(EventDecodeDetail); -impl ::buffa::MessageName for EventDecodeDetail { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "EventDecodeDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.EventDecodeDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.EventDecodeDetail"; -} -impl ::buffa::Message for EventDecodeDetail { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.ordinal) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.type_url) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.decoder_error) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.ordinal, buf); - ::buffa::types::put_string_field(2u32, &self.type_url, buf); - ::buffa::types::put_string_field(3u32, &self.decoder_error, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.ordinal = ::buffa::types::decode_uint64(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.type_url, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.decoder_error, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.ordinal = 0u64; - self.type_url.clear(); - self.decoder_error.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for EventDecodeDetail { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __EVENT_DECODE_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.EventDecodeDetail", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ProjectionCheckpointDetail carries the three positions whose disagreement is -/// the finding, because a checkpoint inconsistency is unreadable without all -/// three. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ProjectionCheckpointDetail { - /// Field 1: `projection_name` - #[serde( - rename = "projectionName", - alias = "projection_name", - with = "::buffa::json_helpers::proto_string" - )] - pub projection_name: ::buffa::alloc::string::String, - /// Field 2: `projection_generation` - #[serde( - rename = "projectionGeneration", - alias = "projection_generation", - with = "::buffa::json_helpers::proto_string" - )] - pub projection_generation: ::buffa::alloc::string::String, - /// What the checkpoint claims was applied. - /// - /// Field 3: `checkpoint_watermark` - #[serde( - rename = "checkpointWatermark", - alias = "checkpoint_watermark", - with = "::buffa::json_helpers::uint64" - )] - pub checkpoint_watermark: u64, - /// What the materialized view actually reflects. Below the checkpoint means - /// the checkpoint is lying about work the view never received. - /// - /// Field 4: `view_applied_through` - #[serde( - rename = "viewAppliedThrough", - alias = "view_applied_through", - with = "::buffa::json_helpers::uint64" - )] - pub view_applied_through: u64, - /// The source head. Below the checkpoint means the checkpoint refers to - /// history this stream does not have. - /// - /// Field 5: `source_high_watermark` - #[serde( - rename = "sourceHighWatermark", - alias = "source_high_watermark", - with = "::buffa::json_helpers::uint64" - )] - pub source_high_watermark: u64, -} -impl ::core::fmt::Debug for ProjectionCheckpointDetail { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ProjectionCheckpointDetail") - .field("projection_name", &self.projection_name) - .field("projection_generation", &self.projection_generation) - .field("checkpoint_watermark", &self.checkpoint_watermark) - .field("view_applied_through", &self.view_applied_through) - .field("source_high_watermark", &self.source_high_watermark) - .finish() - } -} -impl ProjectionCheckpointDetail { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.ProjectionCheckpointDetail"; -} -::buffa::impl_default_instance!(ProjectionCheckpointDetail); -impl ::buffa::MessageName for ProjectionCheckpointDetail { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "ProjectionCheckpointDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.ProjectionCheckpointDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.ProjectionCheckpointDetail"; -} -impl ::buffa::Message for ProjectionCheckpointDetail { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.projection_name) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.projection_generation) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.checkpoint_watermark) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.view_applied_through) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.source_high_watermark) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.projection_name, buf); - ::buffa::types::put_string_field(2u32, &self.projection_generation, buf); - ::buffa::types::put_uint64_field(3u32, self.checkpoint_watermark, buf); - ::buffa::types::put_uint64_field(4u32, self.view_applied_through, buf); - ::buffa::types::put_uint64_field(5u32, self.source_high_watermark, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.projection_name, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.projection_generation, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.checkpoint_watermark = ::buffa::types::decode_uint64(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.view_applied_through = ::buffa::types::decode_uint64(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.source_high_watermark = ::buffa::types::decode_uint64(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.projection_name.clear(); - self.projection_generation.clear(); - self.checkpoint_watermark = 0u64; - self.view_applied_through = 0u64; - self.source_high_watermark = 0u64; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ProjectionCheckpointDetail { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PROJECTION_CHECKPOINT_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.ProjectionCheckpointDetail", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ArtifactDigestDetail distinguishes the three ways an artifact fails -/// verification, which the digests alone cannot express. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ArtifactDigestDetail { - /// Field 1: `artifact_id` - #[serde( - rename = "artifactId", - alias = "artifact_id", - with = "::buffa::json_helpers::proto_string" - )] - pub artifact_id: ::buffa::alloc::string::String, - /// Field 2: `observation` - #[serde(rename = "observation", with = "::buffa::json_helpers::proto_enum")] - pub observation: ::buffa::EnumValue, - /// The digest recorded when the artifact was stored. - /// - /// Field 3: `expected_digest` - #[serde( - rename = "expectedDigest", - alias = "expected_digest", - with = "::buffa::json_helpers::proto_string" - )] - pub expected_digest: ::buffa::alloc::string::String, - /// The digest computed during this check. Unset when the content could not be - /// read at all, which is why this is not simply compared to the expected one. - /// - /// Field 4: `observed_digest` - #[serde( - rename = "observedDigest", - alias = "observed_digest", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub observed_digest: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for ArtifactDigestDetail { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ArtifactDigestDetail") - .field("artifact_id", &self.artifact_id) - .field("observation", &self.observation) - .field("expected_digest", &self.expected_digest) - .field("observed_digest", &self.observed_digest) - .finish() - } -} -impl ArtifactDigestDetail { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.ArtifactDigestDetail"; -} -impl ArtifactDigestDetail { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::observed_digest`] to `Some(value)`, consuming and returning `self`. - pub fn with_observed_digest( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.observed_digest = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ArtifactDigestDetail); -impl ::buffa::MessageName for ArtifactDigestDetail { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "ArtifactDigestDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.ArtifactDigestDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.ArtifactDigestDetail"; -} -impl ::buffa::Message for ArtifactDigestDetail { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - { - let val = self.observation.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.expected_digest) as u64; - if let Some(ref v) = self.observed_digest { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.artifact_id, buf); - ::buffa::types::put_int32_field(2u32, self.observation.to_i32(), buf); - ::buffa::types::put_string_field(3u32, &self.expected_digest, buf); - if let Some(ref v) = self.observed_digest { - ::buffa::types::put_string_field(4u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.artifact_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.observation = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.expected_digest, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .observed_digest - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.artifact_id.clear(); - self.observation = ::buffa::EnumValue::from(0); - self.expected_digest.clear(); - self.observed_digest = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ArtifactDigestDetail { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ARTIFACT_DIGEST_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.ArtifactDigestDetail", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// OperationLedgerDetail describes a side effect that never settled. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct OperationLedgerDetail { - /// Field 1: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// Field 2: `reserved_at` - #[serde(rename = "reservedAt", alias = "reserved_at")] - pub reserved_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// How far past its expected settlement window the operation is. Unset when no - /// window applies. - /// - /// Field 3: `overdue_by` - #[serde( - rename = "overdueBy", - alias = "overdue_by", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub overdue_by: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, - /// True when an indeterminate outcome was recorded, meaning the side effect - /// may or may not have run. An operator must not assume either. - /// - /// Field 4: `outcome_indeterminate` - #[serde( - rename = "outcomeIndeterminate", - alias = "outcome_indeterminate", - with = "::buffa::json_helpers::proto_bool" - )] - pub outcome_indeterminate: bool, -} -impl ::core::fmt::Debug for OperationLedgerDetail { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("OperationLedgerDetail") - .field("operation_id", &self.operation_id) - .field("reserved_at", &self.reserved_at) - .field("overdue_by", &self.overdue_by) - .field("outcome_indeterminate", &self.outcome_indeterminate) - .finish() - } -} -impl OperationLedgerDetail { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.OperationLedgerDetail"; -} -::buffa::impl_default_instance!(OperationLedgerDetail); -impl ::buffa::MessageName for OperationLedgerDetail { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "OperationLedgerDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.OperationLedgerDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.OperationLedgerDetail"; -} -impl ::buffa::Message for OperationLedgerDetail { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if self.reserved_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.reserved_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.overdue_by.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.overdue_by.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.operation_id, buf); - if self.reserved_at.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.reserved_at.write_to(__cache, buf); - } - if self.overdue_by.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.overdue_by.write_to(__cache, buf); - } - ::buffa::types::put_bool_field(4u32, self.outcome_indeterminate, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.reserved_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.overdue_by.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.outcome_indeterminate = ::buffa::types::decode_bool(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.operation_id.clear(); - self.reserved_at = ::buffa::MessageField::none(); - self.overdue_by = ::buffa::MessageField::none(); - self.outcome_indeterminate = false; - } -} -impl ::buffa::json_helpers::ProtoElemJson for OperationLedgerDetail { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __OPERATION_LEDGER_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.OperationLedgerDetail", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// UnreconciledWorkDetail describes work the fold shows as started and never -/// finished. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct UnreconciledWorkDetail { - /// Tool execution id, delegation id, or saga id, per the subject kind. - /// - /// Field 1: `entity_id` - #[serde( - rename = "entityId", - alias = "entity_id", - with = "::buffa::json_helpers::proto_string" - )] - pub entity_id: ::buffa::alloc::string::String, - /// Field 2: `started_at` - #[serde(rename = "startedAt", alias = "started_at")] - pub started_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// True when the session has already reached a terminal marker. A session can - /// be terminally successful and still have work stranded in flight, and that - /// combination is exactly what a reader treating terminal as complete will - /// miss. - /// - /// Field 3: `session_terminal` - #[serde( - rename = "sessionTerminal", - alias = "session_terminal", - with = "::buffa::json_helpers::proto_bool" - )] - pub session_terminal: bool, -} -impl ::core::fmt::Debug for UnreconciledWorkDetail { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("UnreconciledWorkDetail") - .field("entity_id", &self.entity_id) - .field("started_at", &self.started_at) - .field("session_terminal", &self.session_terminal) - .finish() - } -} -impl UnreconciledWorkDetail { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.UnreconciledWorkDetail"; -} -::buffa::impl_default_instance!(UnreconciledWorkDetail); -impl ::buffa::MessageName for UnreconciledWorkDetail { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "UnreconciledWorkDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.UnreconciledWorkDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.UnreconciledWorkDetail"; -} -impl ::buffa::Message for UnreconciledWorkDetail { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.entity_id) as u64; - if self.started_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.started_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.entity_id, buf); - if self.started_at.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.started_at.write_to(__cache, buf); - } - ::buffa::types::put_bool_field(3u32, self.session_terminal, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.entity_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.started_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.session_terminal = ::buffa::types::decode_bool(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.entity_id.clear(); - self.started_at = ::buffa::MessageField::none(); - self.session_terminal = false; - } -} -impl ::buffa::json_helpers::ProtoElemJson for UnreconciledWorkDetail { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __UNRECONCILED_WORK_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.UnreconciledWorkDetail", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.mod.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.mod.rs deleted file mode 100644 index b5910e93b..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.mod.rs +++ /dev/null @@ -1,144 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. - -include!("trogonai.session.sessions.doctor.v1alpha1.orphan.rs"); -include!("trogonai.session.sessions.doctor.v1alpha1.repair_action.rs"); -include!("trogonai.session.sessions.doctor.v1alpha1.finding.rs"); -include!("trogonai.session.sessions.doctor.v1alpha1.diagnose_session.rs"); -include!("trogonai.session.sessions.doctor.v1alpha1.doctor_error.rs"); -include!("trogonai.session.sessions.doctor.v1alpha1.repair_session.rs"); -#[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception -)] -pub mod __buffa { - #[allow(unused_imports)] - use super::*; - pub mod view { - #[allow(unused_imports)] - use super::*; - include!("trogonai.session.sessions.doctor.v1alpha1.orphan.__view.rs"); - include!("trogonai.session.sessions.doctor.v1alpha1.finding.__view.rs"); - include!("trogonai.session.sessions.doctor.v1alpha1.diagnose_session.__view.rs"); - include!("trogonai.session.sessions.doctor.v1alpha1.doctor_error.__view.rs"); - include!("trogonai.session.sessions.doctor.v1alpha1.repair_session.__view.rs"); - pub mod oneof { - #[allow(unused_imports)] - use super::*; - include!( - "trogonai.session.sessions.doctor.v1alpha1.finding.__view_oneof.rs" - ); - } - } - pub mod oneof { - #[allow(unused_imports)] - use super::*; - include!("trogonai.session.sessions.doctor.v1alpha1.finding.__oneof.rs"); - } - /// Register this package's `Any` type entries and extension entries. - pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) { - reg.register_json_any(super::__ORPHAN_DETAIL_JSON_ANY); - reg.register_json_any(super::__OWNERSHIP_TRACE_JSON_ANY); - reg.register_json_any(super::__RELEASE_GATE_JSON_ANY); - reg.register_json_any(super::__FINDING_JSON_ANY); - reg.register_json_any(super::__SUBJECT_REF_JSON_ANY); - reg.register_json_any(super::__EVENT_DECODE_DETAIL_JSON_ANY); - reg.register_json_any(super::__PROJECTION_CHECKPOINT_DETAIL_JSON_ANY); - reg.register_json_any(super::__ARTIFACT_DIGEST_DETAIL_JSON_ANY); - reg.register_json_any(super::__OPERATION_LEDGER_DETAIL_JSON_ANY); - reg.register_json_any(super::__UNRECONCILED_WORK_DETAIL_JSON_ANY); - reg.register_json_any(super::__DIAGNOSE_SESSION_REQUEST_JSON_ANY); - reg.register_json_any(super::__INSPECTION_BUDGET_JSON_ANY); - reg.register_json_any(super::__DIAGNOSE_SESSION_RESPONSE_JSON_ANY); - reg.register_json_any(super::__CHECK_OUTCOME_JSON_ANY); - reg.register_json_any(super::__DOCTOR_ERROR_JSON_ANY); - reg.register_json_any(super::__REPAIR_SESSION_REQUEST_JSON_ANY); - reg.register_json_any(super::__REPAIR_TARGET_JSON_ANY); - reg.register_json_any(super::__REPAIR_SESSION_RESPONSE_JSON_ANY); - reg.register_json_any(super::__REPAIR_RESULT_JSON_ANY); - } -} -#[doc(inline)] -pub use self::__buffa::view::OrphanDetailView; -#[doc(inline)] -pub use self::__buffa::view::OrphanDetailOwnedView; -#[doc(inline)] -pub use self::__buffa::view::OwnershipTraceView; -#[doc(inline)] -pub use self::__buffa::view::OwnershipTraceOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReleaseGateView; -#[doc(inline)] -pub use self::__buffa::view::ReleaseGateOwnedView; -#[doc(inline)] -pub use self::__buffa::view::FindingView; -#[doc(inline)] -pub use self::__buffa::view::FindingOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SubjectRefView; -#[doc(inline)] -pub use self::__buffa::view::SubjectRefOwnedView; -#[doc(inline)] -pub use self::__buffa::view::EventDecodeDetailView; -#[doc(inline)] -pub use self::__buffa::view::EventDecodeDetailOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ProjectionCheckpointDetailView; -#[doc(inline)] -pub use self::__buffa::view::ProjectionCheckpointDetailOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ArtifactDigestDetailView; -#[doc(inline)] -pub use self::__buffa::view::ArtifactDigestDetailOwnedView; -#[doc(inline)] -pub use self::__buffa::view::OperationLedgerDetailView; -#[doc(inline)] -pub use self::__buffa::view::OperationLedgerDetailOwnedView; -#[doc(inline)] -pub use self::__buffa::view::UnreconciledWorkDetailView; -#[doc(inline)] -pub use self::__buffa::view::UnreconciledWorkDetailOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DiagnoseSessionRequestView; -#[doc(inline)] -pub use self::__buffa::view::DiagnoseSessionRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::InspectionBudgetView; -#[doc(inline)] -pub use self::__buffa::view::InspectionBudgetOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DiagnoseSessionResponseView; -#[doc(inline)] -pub use self::__buffa::view::DiagnoseSessionResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CheckOutcomeView; -#[doc(inline)] -pub use self::__buffa::view::CheckOutcomeOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DoctorErrorView; -#[doc(inline)] -pub use self::__buffa::view::DoctorErrorOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RepairSessionRequestView; -#[doc(inline)] -pub use self::__buffa::view::RepairSessionRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RepairTargetView; -#[doc(inline)] -pub use self::__buffa::view::RepairTargetOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RepairSessionResponseView; -#[doc(inline)] -pub use self::__buffa::view::RepairSessionResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RepairResultView; -#[doc(inline)] -pub use self::__buffa::view::RepairResultOwnedView; -#[doc(inline)] -pub use self::__buffa::register_types; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.orphan.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.orphan.__view.rs deleted file mode 100644 index 076413562..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.orphan.__view.rs +++ /dev/null @@ -1,1606 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/doctor/v1alpha1/orphan.proto - -/// OrphanDetail is the evidence behind an orphan finding. -#[derive(Clone, Debug, Default)] -pub struct OrphanDetailView<'a> { - /// Field 1: `orphan_class` - pub orphan_class: ::buffa::EnumValue, - /// Upload id, artifact id, projection generation, migration id, or lease id, - /// per `orphan_class`. - /// - /// Field 2: `resource_id` - pub resource_id: &'a str, - /// When the resource was created in its store, as the store recorded it. A - /// wall-clock occurrence, not a position derived from append order (D10), - /// because an orphan by definition never reached the log. - /// - /// Field 3: `staged_at` - pub staged_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// How long it has been sitting there, as of the finding's `observed_at`. - /// - /// Field 4: `age` - pub age: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, - /// What was actually checked before calling this unreferenced. - /// - /// Field 5: `trace` - pub trace: ::buffa::MessageFieldView< - super::super::__buffa::view::OwnershipTraceView<'a>, - >, - /// What still has to be true before it can be released. - /// - /// Field 6: `gate` - pub gate: ::buffa::MessageFieldView< - super::super::__buffa::view::ReleaseGateView<'a>, - >, - /// Storage this would return. Unset when the store cannot say, which is - /// ordinary for an incomplete multipart upload and is not zero bytes. - /// - /// Field 7: `reclaimable_bytes` - pub reclaimable_bytes: ::core::option::Option, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> OrphanDetailView<'a> { - /**Whether required field `orphan_class` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_orphan_class(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `resource_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_resource_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `staged_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_staged_at(&self) -> bool { - self.staged_at.is_set() - } - /**Whether required field `age` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_age(&self) -> bool { - self.age.is_set() - } - /**Whether required field `trace` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_trace(&self) -> bool { - self.trace.is_set() - } - /**Whether required field `gate` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_gate(&self) -> bool { - self.gate.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for OrphanDetailView<'a> { - type Owned = super::super::OrphanDetail; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.orphan_class = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.resource_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.staged_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.staged_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.age.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.age = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.trace.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.trace = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.gate.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.gate = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reclaimable_bytes = Some(::buffa::types::decode_uint64(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::OrphanDetail { - orphan_class: self.orphan_class, - resource_id: self.resource_id.to_string(), - staged_at: match self.staged_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - age: match self.age.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - trace: match self.trace.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::OwnershipTrace, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - gate: match self.gate.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ReleaseGate, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - reclaimable_bytes: self.reclaimable_bytes, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for OrphanDetailView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.orphan_class.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.resource_id) as u64; - if self.staged_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.staged_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.age.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.age.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.trace.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.trace.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.gate.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.gate.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(v) = self.reclaimable_bytes { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.orphan_class.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.resource_id, buf); - if self.staged_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.staged_at.write_to(__cache, buf); - } - if self.age.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.age.write_to(__cache, buf); - } - if self.trace.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.trace.write_to(__cache, buf); - } - if self.gate.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.gate.write_to(__cache, buf); - } - if let Some(v) = self.reclaimable_bytes { - ::buffa::types::put_uint64_field(7u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for OrphanDetailView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("orphanClass", &self.orphan_class)?; - } - { - __map.serialize_entry("resourceId", self.resource_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.staged_at.as_option() { - __map.serialize_entry("stagedAt", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.age.as_option() { - __map.serialize_entry("age", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.trace.as_option() { - __map.serialize_entry("trace", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.gate.as_option() { - __map.serialize_entry("gate", __v)?; - } - } - if let ::core::option::Option::Some(__v) = self.reclaimable_bytes { - __map - .serialize_entry( - "reclaimableBytes", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for OrphanDetailView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "OrphanDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.OrphanDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.OrphanDetail"; -} -::buffa::impl_default_view_instance!(OrphanDetailView); -::buffa::impl_view_reborrow!(OrphanDetailView); -/** Self-contained, `'static` owned view of a `OrphanDetail` message. - - Wraps [`::buffa::OwnedView`]`<`[`OrphanDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`OrphanDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct OrphanDetailOwnedView(::buffa::OwnedView>); -impl OrphanDetailOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OrphanDetailOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OrphanDetailOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::OrphanDetail, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OrphanDetailOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`OrphanDetailView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &OrphanDetailView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::OrphanDetail { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `orphan_class` - #[must_use] - pub fn orphan_class(&self) -> ::buffa::EnumValue { - self.0.reborrow().orphan_class - } - /// Upload id, artifact id, projection generation, migration id, or lease id, - /// per `orphan_class`. - /// - /// Field 2: `resource_id` - #[must_use] - pub fn resource_id(&self) -> &'_ str { - self.0.reborrow().resource_id - } - /// When the resource was created in its store, as the store recorded it. A - /// wall-clock occurrence, not a position derived from append order (D10), - /// because an orphan by definition never reached the log. - /// - /// Field 3: `staged_at` - #[must_use] - pub fn staged_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().staged_at - } - /// How long it has been sitting there, as of the finding's `observed_at`. - /// - /// Field 4: `age` - #[must_use] - pub fn age( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().age - } - /// What was actually checked before calling this unreferenced. - /// - /// Field 5: `trace` - #[must_use] - pub fn trace( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::OwnershipTraceView<'_>, - > { - &self.0.reborrow().trace - } - /// What still has to be true before it can be released. - /// - /// Field 6: `gate` - #[must_use] - pub fn gate( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().gate - } - /// Storage this would return. Unset when the store cannot say, which is - /// ordinary for an incomplete multipart upload and is not zero bytes. - /// - /// Field 7: `reclaimable_bytes` - #[must_use] - pub fn reclaimable_bytes(&self) -> ::core::option::Option { - self.0.reborrow().reclaimable_bytes - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for OrphanDetailOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - OrphanDetailOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: OrphanDetailOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for OrphanDetailOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::OrphanDetail { - type View<'a> = OrphanDetailView<'a>; - type ViewHandle = OrphanDetailOwnedView; -} -impl ::serde::Serialize for OrphanDetailOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// OwnershipTrace is what the orphan check looked at, and how far it got. -/// -/// This message is the difference between a finding and a guess. "No reference -/// found" is only meaningful alongside where the search ran and where it -/// stopped, and a check that scanned four of a tenant's streams produces the -/// same empty result as one that scanned all of them. -#[derive(Clone, Debug, Default)] -pub struct OwnershipTraceView<'a> { - /// Field 1: `completeness` - pub completeness: ::buffa::EnumValue, - /// Streams the trace read to completion. - /// - /// Field 2: `streams_scanned` - pub streams_scanned: u32, - /// Streams in scope the trace could not read. Any non-zero value makes the - /// result non-exhaustive no matter how many streams were scanned, because the - /// reference could be in exactly one of them. - /// - /// Field 3: `streams_unreadable` - pub streams_unreadable: u32, - /// Position the trace scanned through. - /// - /// Field 4: `scanned_through_watermark` - pub scanned_through_watermark: u64, - /// Head at the time the trace ran. Above `scanned_through_watermark` means - /// events were appended during the scan, and a reference could be in the gap. - /// - /// Field 5: `source_high_watermark` - pub source_high_watermark: u64, - /// Position the slowest projector needed for this trace had applied through. - /// - /// A trace that consults derived state is only as complete as that state. A - /// projector behind the scan makes the trace's answer a statement about - /// history the projector has already seen, which is not the same as the - /// history that exists. - /// - /// Field 6: `projector_applied_through` - pub projector_applied_through: u64, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, - #[doc(hidden)] - pub __buffa_phantom: ::core::marker::PhantomData<&'a ()>, -} -impl<'a> OwnershipTraceView<'a> { - /**Whether required field `completeness` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_completeness(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `streams_scanned` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_streams_scanned(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `streams_unreadable` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_streams_unreadable(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `scanned_through_watermark` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_scanned_through_watermark(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `source_high_watermark` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_high_watermark(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } - /**Whether required field `projector_applied_through` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_projector_applied_through(&self) -> bool { - self.__buffa_required_seen_0 & 32u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for OwnershipTraceView<'a> { - type Owned = super::super::OwnershipTrace; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.completeness = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.streams_scanned = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.streams_unreadable = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.scanned_through_watermark = ::buffa::types::decode_uint64( - &mut cur, - )?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.source_high_watermark = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.projector_applied_through = ::buffa::types::decode_uint64( - &mut cur, - )?; - view.__buffa_required_seen_0 |= 32u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::OwnershipTrace { - completeness: self.completeness, - streams_scanned: self.streams_scanned, - streams_unreadable: self.streams_unreadable, - scanned_through_watermark: self.scanned_through_watermark, - source_high_watermark: self.source_high_watermark, - projector_applied_through: self.projector_applied_through, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for OwnershipTraceView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.completeness.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.streams_scanned) as u64; - size - += 1u64 + ::buffa::types::uint32_encoded_len(self.streams_unreadable) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.scanned_through_watermark) - as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.source_high_watermark) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.projector_applied_through) - as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.completeness.to_i32(), buf); - ::buffa::types::put_uint32_field(2u32, self.streams_scanned, buf); - ::buffa::types::put_uint32_field(3u32, self.streams_unreadable, buf); - ::buffa::types::put_uint64_field(4u32, self.scanned_through_watermark, buf); - ::buffa::types::put_uint64_field(5u32, self.source_high_watermark, buf); - ::buffa::types::put_uint64_field(6u32, self.projector_applied_through, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for OwnershipTraceView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("completeness", &self.completeness)?; - } - { - __map - .serialize_entry( - "streamsScanned", - &::buffa::json_helpers::ProtoJson(&self.streams_scanned), - )?; - } - { - __map - .serialize_entry( - "streamsUnreadable", - &::buffa::json_helpers::ProtoJson(&self.streams_unreadable), - )?; - } - { - __map - .serialize_entry( - "scannedThroughWatermark", - &::buffa::json_helpers::ProtoJson(&self.scanned_through_watermark), - )?; - } - { - __map - .serialize_entry( - "sourceHighWatermark", - &::buffa::json_helpers::ProtoJson(&self.source_high_watermark), - )?; - } - { - __map - .serialize_entry( - "projectorAppliedThrough", - &::buffa::json_helpers::ProtoJson(&self.projector_applied_through), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for OwnershipTraceView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "OwnershipTrace"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.OwnershipTrace"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.OwnershipTrace"; -} -::buffa::impl_default_view_instance!(OwnershipTraceView); -::buffa::impl_view_reborrow!(OwnershipTraceView); -/** Self-contained, `'static` owned view of a `OwnershipTrace` message. - - Wraps [`::buffa::OwnedView`]`<`[`OwnershipTraceView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`OwnershipTraceView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct OwnershipTraceOwnedView(::buffa::OwnedView>); -impl OwnershipTraceOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OwnershipTraceOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OwnershipTraceOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::OwnershipTrace, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OwnershipTraceOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`OwnershipTraceView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &OwnershipTraceView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::OwnershipTrace { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `completeness` - #[must_use] - pub fn completeness(&self) -> ::buffa::EnumValue { - self.0.reborrow().completeness - } - /// Streams the trace read to completion. - /// - /// Field 2: `streams_scanned` - #[must_use] - pub fn streams_scanned(&self) -> u32 { - self.0.reborrow().streams_scanned - } - /// Streams in scope the trace could not read. Any non-zero value makes the - /// result non-exhaustive no matter how many streams were scanned, because the - /// reference could be in exactly one of them. - /// - /// Field 3: `streams_unreadable` - #[must_use] - pub fn streams_unreadable(&self) -> u32 { - self.0.reborrow().streams_unreadable - } - /// Position the trace scanned through. - /// - /// Field 4: `scanned_through_watermark` - #[must_use] - pub fn scanned_through_watermark(&self) -> u64 { - self.0.reborrow().scanned_through_watermark - } - /// Head at the time the trace ran. Above `scanned_through_watermark` means - /// events were appended during the scan, and a reference could be in the gap. - /// - /// Field 5: `source_high_watermark` - #[must_use] - pub fn source_high_watermark(&self) -> u64 { - self.0.reborrow().source_high_watermark - } - /// Position the slowest projector needed for this trace had applied through. - /// - /// A trace that consults derived state is only as complete as that state. A - /// projector behind the scan makes the trace's answer a statement about - /// history the projector has already seen, which is not the same as the - /// history that exists. - /// - /// Field 6: `projector_applied_through` - #[must_use] - pub fn projector_applied_through(&self) -> u64 { - self.0.reborrow().projector_applied_through - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for OwnershipTraceOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - OwnershipTraceOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: OwnershipTraceOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for OwnershipTraceOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::OwnershipTrace { - type View<'a> = OwnershipTraceView<'a>; - type ViewHandle = OwnershipTraceOwnedView; -} -impl ::serde::Serialize for OwnershipTraceOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ReleaseGate is what stands between an orphan finding and deleting something. -/// -/// Nothing is released on age alone and nothing is released on absence of -/// references alone. Both are necessary and neither is sufficient, which is why -/// the outcome is a single value rather than a set of flags a caller could read -/// selectively. -#[derive(Clone, Debug, Default)] -pub struct ReleaseGateView<'a> { - /// Field 1: `outcome` - pub outcome: ::buffa::EnumValue, - /// How old a resource of this class must be before release is considered. - /// - /// Field 2: `minimum_age` - pub minimum_age: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, - /// How long an append can remain indeterminate before its outcome is settled - /// one way or the other. - /// - /// This is the number that makes the whole gate correct. An append whose write - /// state is unknown may still land, and if it lands it carries a reference to - /// a resource that a cleanup pass has already decided nothing points at. So - /// `minimum_age` has to exceed this window, and a resource inside it is held - /// regardless of how thoroughly it was traced: the trace was accurate and the - /// history was not finished happening. - /// - /// Field 3: `indeterminacy_window` - pub indeterminacy_window: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, - /// Earliest time this could become releasable, if nothing changes. Unset when - /// waiting will not help, which is the case for every outcome that depends on - /// a fault being fixed rather than on time passing. - /// - /// Field 4: `releasable_after` - pub releasable_after: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReleaseGateView<'a> { - /**Whether required field `outcome` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_outcome(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `minimum_age` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_minimum_age(&self) -> bool { - self.minimum_age.is_set() - } - /**Whether required field `indeterminacy_window` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_indeterminacy_window(&self) -> bool { - self.indeterminacy_window.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ReleaseGateView<'a> { - type Owned = super::super::ReleaseGate; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.outcome = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.minimum_age.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.minimum_age = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.indeterminacy_window.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.indeterminacy_window = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.releasable_after.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.releasable_after = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReleaseGate { - outcome: self.outcome, - minimum_age: match self.minimum_age.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - indeterminacy_window: match self.indeterminacy_window.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - releasable_after: match self.releasable_after.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReleaseGateView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.outcome.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.minimum_age.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.minimum_age.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.indeterminacy_window.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.indeterminacy_window.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.releasable_after.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.releasable_after.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.outcome.to_i32(), buf); - if self.minimum_age.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.minimum_age.write_to(__cache, buf); - } - if self.indeterminacy_window.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.indeterminacy_window.write_to(__cache, buf); - } - if self.releasable_after.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.releasable_after.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReleaseGateView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("outcome", &self.outcome)?; - } - { - if let ::core::option::Option::Some(__v) = self.minimum_age.as_option() { - __map.serialize_entry("minimumAge", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self - .indeterminacy_window - .as_option() - { - __map.serialize_entry("indeterminacyWindow", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.releasable_after.as_option() - { - __map.serialize_entry("releasableAfter", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReleaseGateView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "ReleaseGate"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.ReleaseGate"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.ReleaseGate"; -} -::buffa::impl_default_view_instance!(ReleaseGateView); -::buffa::impl_view_reborrow!(ReleaseGateView); -/** Self-contained, `'static` owned view of a `ReleaseGate` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReleaseGateView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReleaseGateView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReleaseGateOwnedView(::buffa::OwnedView>); -impl ReleaseGateOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReleaseGateOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReleaseGateOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReleaseGate, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReleaseGateOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReleaseGateView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReleaseGateView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReleaseGate { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `outcome` - #[must_use] - pub fn outcome(&self) -> ::buffa::EnumValue { - self.0.reborrow().outcome - } - /// How old a resource of this class must be before release is considered. - /// - /// Field 2: `minimum_age` - #[must_use] - pub fn minimum_age( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().minimum_age - } - /// How long an append can remain indeterminate before its outcome is settled - /// one way or the other. - /// - /// This is the number that makes the whole gate correct. An append whose write - /// state is unknown may still land, and if it lands it carries a reference to - /// a resource that a cleanup pass has already decided nothing points at. So - /// `minimum_age` has to exceed this window, and a resource inside it is held - /// regardless of how thoroughly it was traced: the trace was accurate and the - /// history was not finished happening. - /// - /// Field 3: `indeterminacy_window` - #[must_use] - pub fn indeterminacy_window( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().indeterminacy_window - } - /// Earliest time this could become releasable, if nothing changes. Unset when - /// waiting will not help, which is the case for every outcome that depends on - /// a fault being fixed rather than on time passing. - /// - /// Field 4: `releasable_after` - #[must_use] - pub fn releasable_after( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().releasable_after - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReleaseGateOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReleaseGateOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReleaseGateOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReleaseGateOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReleaseGate { - type View<'a> = ReleaseGateView<'a>; - type ViewHandle = ReleaseGateOwnedView; -} -impl ::serde::Serialize for ReleaseGateOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.orphan.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.orphan.rs deleted file mode 100644 index d3dae57b3..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.orphan.rs +++ /dev/null @@ -1,1426 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/doctor/v1alpha1/orphan.proto - -/// Orphan reporting for the doctor. -/// -/// An orphan is a resource that was staged for a write that never landed. The -/// canonical shape is an artifact upload that succeeded followed by an append -/// that failed: the bytes are durable, nothing references them, and nothing ever -/// will. Left alone they accumulate; deleted carelessly they take live content -/// with them. -/// -/// Every message here exists to make the second failure hard. The point is not -/// to find candidates, which is easy, but to state what was actually traced and -/// what is still holding a release back, so that deleting something is a -/// decision an operator makes against evidence rather than against a count. -/// -/// OrphanClass is what kind of resource was left behind. -/// -/// They are enumerated separately rather than collapsed into "unreferenced -/// thing" because they have different owners, different ways of being -/// referenced, and different consequences for getting it wrong. Releasing an -/// abandoned projection generation costs a rebuild. Releasing a claim check that -/// was about to be referenced destroys the only copy of a command's output. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum OrphanClass { - ORPHAN_CLASS_UNSPECIFIED = 0i32, - /// A multipart upload with parts written and no completion. It holds storage, - /// it has no digest yet, and no event can reference it because the object it - /// would name does not exist. - ORPHAN_CLASS_UNCOMMITTED_MULTIPART_UPLOAD = 1i32, - /// A completed object with a digest that no event in any stream references. - /// - /// The dangerous one. Content-addressed storage means the same bytes can be - /// reachable through a stream nobody thought to scan, so this class is the - /// reason ownership has to be traced rather than searched for. - ORPHAN_CLASS_UNREFERENCED_CLAIM_CHECK = 2i32, - /// Materialized state belonging to a projection generation that is neither - /// current nor being rebuilt. Disposable by construction: the stream can - /// produce it again. - ORPHAN_CLASS_ABANDONED_PROJECTION_GENERATION = 3i32, - /// Staging state from a migration that has since finished. It was never the - /// source of truth, and it stops being a fallback once the migration is done. - ORPHAN_CLASS_COMPLETED_MIGRATION_STAGING = 4i32, - /// A reconciliation lease past its expiry whose holder never returned. - /// - /// Releasing this one is not a deletion, it is a handoff: the work the lease - /// covered still needs settling, and reclaiming the lease is what lets someone - /// else settle it. - ORPHAN_CLASS_EXPIRED_RECONCILIATION_LEASE = 5i32, -} -impl OrphanClass { - ///Idiomatic alias for [`Self::ORPHAN_CLASS_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::ORPHAN_CLASS_UNSPECIFIED; - ///Idiomatic alias for [`Self::ORPHAN_CLASS_UNCOMMITTED_MULTIPART_UPLOAD`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const UncommittedMultipartUpload: Self = Self::ORPHAN_CLASS_UNCOMMITTED_MULTIPART_UPLOAD; - ///Idiomatic alias for [`Self::ORPHAN_CLASS_UNREFERENCED_CLAIM_CHECK`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const UnreferencedClaimCheck: Self = Self::ORPHAN_CLASS_UNREFERENCED_CLAIM_CHECK; - ///Idiomatic alias for [`Self::ORPHAN_CLASS_ABANDONED_PROJECTION_GENERATION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const AbandonedProjectionGeneration: Self = Self::ORPHAN_CLASS_ABANDONED_PROJECTION_GENERATION; - ///Idiomatic alias for [`Self::ORPHAN_CLASS_COMPLETED_MIGRATION_STAGING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const CompletedMigrationStaging: Self = Self::ORPHAN_CLASS_COMPLETED_MIGRATION_STAGING; - ///Idiomatic alias for [`Self::ORPHAN_CLASS_EXPIRED_RECONCILIATION_LEASE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ExpiredReconciliationLease: Self = Self::ORPHAN_CLASS_EXPIRED_RECONCILIATION_LEASE; -} -impl ::core::default::Default for OrphanClass { - fn default() -> Self { - Self::ORPHAN_CLASS_UNSPECIFIED - } -} -impl ::serde::Serialize for OrphanClass { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for OrphanClass { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = OrphanClass; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(OrphanClass)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for OrphanClass { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for OrphanClass { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::ORPHAN_CLASS_UNSPECIFIED), - 1i32 => { - ::core::option::Option::Some( - Self::ORPHAN_CLASS_UNCOMMITTED_MULTIPART_UPLOAD, - ) - } - 2i32 => { - ::core::option::Option::Some(Self::ORPHAN_CLASS_UNREFERENCED_CLAIM_CHECK) - } - 3i32 => { - ::core::option::Option::Some( - Self::ORPHAN_CLASS_ABANDONED_PROJECTION_GENERATION, - ) - } - 4i32 => { - ::core::option::Option::Some( - Self::ORPHAN_CLASS_COMPLETED_MIGRATION_STAGING, - ) - } - 5i32 => { - ::core::option::Option::Some( - Self::ORPHAN_CLASS_EXPIRED_RECONCILIATION_LEASE, - ) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::ORPHAN_CLASS_UNSPECIFIED => "ORPHAN_CLASS_UNSPECIFIED", - Self::ORPHAN_CLASS_UNCOMMITTED_MULTIPART_UPLOAD => { - "ORPHAN_CLASS_UNCOMMITTED_MULTIPART_UPLOAD" - } - Self::ORPHAN_CLASS_UNREFERENCED_CLAIM_CHECK => { - "ORPHAN_CLASS_UNREFERENCED_CLAIM_CHECK" - } - Self::ORPHAN_CLASS_ABANDONED_PROJECTION_GENERATION => { - "ORPHAN_CLASS_ABANDONED_PROJECTION_GENERATION" - } - Self::ORPHAN_CLASS_COMPLETED_MIGRATION_STAGING => { - "ORPHAN_CLASS_COMPLETED_MIGRATION_STAGING" - } - Self::ORPHAN_CLASS_EXPIRED_RECONCILIATION_LEASE => { - "ORPHAN_CLASS_EXPIRED_RECONCILIATION_LEASE" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "ORPHAN_CLASS_UNSPECIFIED" => { - ::core::option::Option::Some(Self::ORPHAN_CLASS_UNSPECIFIED) - } - "ORPHAN_CLASS_UNCOMMITTED_MULTIPART_UPLOAD" => { - ::core::option::Option::Some( - Self::ORPHAN_CLASS_UNCOMMITTED_MULTIPART_UPLOAD, - ) - } - "ORPHAN_CLASS_UNREFERENCED_CLAIM_CHECK" => { - ::core::option::Option::Some(Self::ORPHAN_CLASS_UNREFERENCED_CLAIM_CHECK) - } - "ORPHAN_CLASS_ABANDONED_PROJECTION_GENERATION" => { - ::core::option::Option::Some( - Self::ORPHAN_CLASS_ABANDONED_PROJECTION_GENERATION, - ) - } - "ORPHAN_CLASS_COMPLETED_MIGRATION_STAGING" => { - ::core::option::Option::Some( - Self::ORPHAN_CLASS_COMPLETED_MIGRATION_STAGING, - ) - } - "ORPHAN_CLASS_EXPIRED_RECONCILIATION_LEASE" => { - ::core::option::Option::Some( - Self::ORPHAN_CLASS_EXPIRED_RECONCILIATION_LEASE, - ) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::ORPHAN_CLASS_UNSPECIFIED, - Self::ORPHAN_CLASS_UNCOMMITTED_MULTIPART_UPLOAD, - Self::ORPHAN_CLASS_UNREFERENCED_CLAIM_CHECK, - Self::ORPHAN_CLASS_ABANDONED_PROJECTION_GENERATION, - Self::ORPHAN_CLASS_COMPLETED_MIGRATION_STAGING, - Self::ORPHAN_CLASS_EXPIRED_RECONCILIATION_LEASE, - ] - } -} -/// TraceCompleteness is how much of the search space the trace actually covered. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum TraceCompleteness { - /// Unknown coverage. Treat as INCOMPLETE. - TRACE_COMPLETENESS_UNSPECIFIED = 0i32, - /// Every stream in scope was read to the head observed at scan time, and - /// every projector consulted was current with it. - TRACE_COMPLETENESS_EXHAUSTIVE = 1i32, - /// Coverage was cut short by a budget: a time limit, a stream limit, a byte - /// limit. Whatever was scanned is accurate, and the unscanned part is unknown. - TRACE_COMPLETENESS_BOUNDED = 2i32, - /// Something in scope could not be read at all. Distinct from BOUNDED because - /// a bounded trace can be finished by granting more budget, and this one - /// cannot be finished until the fault is fixed. - TRACE_COMPLETENESS_INCOMPLETE = 3i32, -} -impl TraceCompleteness { - ///Idiomatic alias for [`Self::TRACE_COMPLETENESS_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::TRACE_COMPLETENESS_UNSPECIFIED; - ///Idiomatic alias for [`Self::TRACE_COMPLETENESS_EXHAUSTIVE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Exhaustive: Self = Self::TRACE_COMPLETENESS_EXHAUSTIVE; - ///Idiomatic alias for [`Self::TRACE_COMPLETENESS_BOUNDED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Bounded: Self = Self::TRACE_COMPLETENESS_BOUNDED; - ///Idiomatic alias for [`Self::TRACE_COMPLETENESS_INCOMPLETE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Incomplete: Self = Self::TRACE_COMPLETENESS_INCOMPLETE; -} -impl ::core::default::Default for TraceCompleteness { - fn default() -> Self { - Self::TRACE_COMPLETENESS_UNSPECIFIED - } -} -impl ::serde::Serialize for TraceCompleteness { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for TraceCompleteness { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = TraceCompleteness; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(TraceCompleteness) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for TraceCompleteness { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for TraceCompleteness { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::TRACE_COMPLETENESS_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::TRACE_COMPLETENESS_EXHAUSTIVE), - 2i32 => ::core::option::Option::Some(Self::TRACE_COMPLETENESS_BOUNDED), - 3i32 => ::core::option::Option::Some(Self::TRACE_COMPLETENESS_INCOMPLETE), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::TRACE_COMPLETENESS_UNSPECIFIED => "TRACE_COMPLETENESS_UNSPECIFIED", - Self::TRACE_COMPLETENESS_EXHAUSTIVE => "TRACE_COMPLETENESS_EXHAUSTIVE", - Self::TRACE_COMPLETENESS_BOUNDED => "TRACE_COMPLETENESS_BOUNDED", - Self::TRACE_COMPLETENESS_INCOMPLETE => "TRACE_COMPLETENESS_INCOMPLETE", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "TRACE_COMPLETENESS_UNSPECIFIED" => { - ::core::option::Option::Some(Self::TRACE_COMPLETENESS_UNSPECIFIED) - } - "TRACE_COMPLETENESS_EXHAUSTIVE" => { - ::core::option::Option::Some(Self::TRACE_COMPLETENESS_EXHAUSTIVE) - } - "TRACE_COMPLETENESS_BOUNDED" => { - ::core::option::Option::Some(Self::TRACE_COMPLETENESS_BOUNDED) - } - "TRACE_COMPLETENESS_INCOMPLETE" => { - ::core::option::Option::Some(Self::TRACE_COMPLETENESS_INCOMPLETE) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::TRACE_COMPLETENESS_UNSPECIFIED, - Self::TRACE_COMPLETENESS_EXHAUSTIVE, - Self::TRACE_COMPLETENESS_BOUNDED, - Self::TRACE_COMPLETENESS_INCOMPLETE, - ] - } -} -/// GateOutcome is whether this orphan may be released now, and if not, why not. -/// -/// The zero value holds and RELEASABLE is last, so a reader that does not -/// recognize a variant keeps the resource. Getting this backwards would make an -/// unknown enum value a deletion. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum GateOutcome { - /// Unknown outcome. Hold. - GATE_OUTCOME_UNSPECIFIED = 0i32, - /// Younger than `minimum_age`. - GATE_OUTCOME_HELD_TOO_YOUNG = 1i32, - /// Inside the indeterminacy window of an append that has not settled. The - /// reference may still arrive. - GATE_OUTCOME_HELD_INDETERMINATE_APPEND = 2i32, - /// The ownership trace did not cover the search space, so "unreferenced" has - /// not actually been established. - GATE_OUTCOME_HELD_TRACE_INCOMPLETE = 3i32, - /// A projector the trace depends on is behind the stream head. Held rather - /// than reported as incomplete, because this one resolves on its own once the - /// projector catches up. - GATE_OUTCOME_HELD_PROJECTOR_BEHIND = 4i32, - /// Old enough, exhaustively traced, no unsettled append in range. A repair may - /// release it. - /// - /// Still not an instruction. The doctor observes and never mutates; releasing - /// is a RepairSession call naming this finding, and the gate is re-evaluated - /// then, because everything it asserts can stop being true in the interval. - GATE_OUTCOME_RELEASABLE = 5i32, -} -impl GateOutcome { - ///Idiomatic alias for [`Self::GATE_OUTCOME_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::GATE_OUTCOME_UNSPECIFIED; - ///Idiomatic alias for [`Self::GATE_OUTCOME_HELD_TOO_YOUNG`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const HeldTooYoung: Self = Self::GATE_OUTCOME_HELD_TOO_YOUNG; - ///Idiomatic alias for [`Self::GATE_OUTCOME_HELD_INDETERMINATE_APPEND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const HeldIndeterminateAppend: Self = Self::GATE_OUTCOME_HELD_INDETERMINATE_APPEND; - ///Idiomatic alias for [`Self::GATE_OUTCOME_HELD_TRACE_INCOMPLETE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const HeldTraceIncomplete: Self = Self::GATE_OUTCOME_HELD_TRACE_INCOMPLETE; - ///Idiomatic alias for [`Self::GATE_OUTCOME_HELD_PROJECTOR_BEHIND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const HeldProjectorBehind: Self = Self::GATE_OUTCOME_HELD_PROJECTOR_BEHIND; - ///Idiomatic alias for [`Self::GATE_OUTCOME_RELEASABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Releasable: Self = Self::GATE_OUTCOME_RELEASABLE; -} -impl ::core::default::Default for GateOutcome { - fn default() -> Self { - Self::GATE_OUTCOME_UNSPECIFIED - } -} -impl ::serde::Serialize for GateOutcome { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for GateOutcome { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = GateOutcome; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(GateOutcome)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for GateOutcome { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for GateOutcome { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::GATE_OUTCOME_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::GATE_OUTCOME_HELD_TOO_YOUNG), - 2i32 => { - ::core::option::Option::Some( - Self::GATE_OUTCOME_HELD_INDETERMINATE_APPEND, - ) - } - 3i32 => { - ::core::option::Option::Some(Self::GATE_OUTCOME_HELD_TRACE_INCOMPLETE) - } - 4i32 => { - ::core::option::Option::Some(Self::GATE_OUTCOME_HELD_PROJECTOR_BEHIND) - } - 5i32 => ::core::option::Option::Some(Self::GATE_OUTCOME_RELEASABLE), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::GATE_OUTCOME_UNSPECIFIED => "GATE_OUTCOME_UNSPECIFIED", - Self::GATE_OUTCOME_HELD_TOO_YOUNG => "GATE_OUTCOME_HELD_TOO_YOUNG", - Self::GATE_OUTCOME_HELD_INDETERMINATE_APPEND => { - "GATE_OUTCOME_HELD_INDETERMINATE_APPEND" - } - Self::GATE_OUTCOME_HELD_TRACE_INCOMPLETE => { - "GATE_OUTCOME_HELD_TRACE_INCOMPLETE" - } - Self::GATE_OUTCOME_HELD_PROJECTOR_BEHIND => { - "GATE_OUTCOME_HELD_PROJECTOR_BEHIND" - } - Self::GATE_OUTCOME_RELEASABLE => "GATE_OUTCOME_RELEASABLE", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "GATE_OUTCOME_UNSPECIFIED" => { - ::core::option::Option::Some(Self::GATE_OUTCOME_UNSPECIFIED) - } - "GATE_OUTCOME_HELD_TOO_YOUNG" => { - ::core::option::Option::Some(Self::GATE_OUTCOME_HELD_TOO_YOUNG) - } - "GATE_OUTCOME_HELD_INDETERMINATE_APPEND" => { - ::core::option::Option::Some( - Self::GATE_OUTCOME_HELD_INDETERMINATE_APPEND, - ) - } - "GATE_OUTCOME_HELD_TRACE_INCOMPLETE" => { - ::core::option::Option::Some(Self::GATE_OUTCOME_HELD_TRACE_INCOMPLETE) - } - "GATE_OUTCOME_HELD_PROJECTOR_BEHIND" => { - ::core::option::Option::Some(Self::GATE_OUTCOME_HELD_PROJECTOR_BEHIND) - } - "GATE_OUTCOME_RELEASABLE" => { - ::core::option::Option::Some(Self::GATE_OUTCOME_RELEASABLE) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::GATE_OUTCOME_UNSPECIFIED, - Self::GATE_OUTCOME_HELD_TOO_YOUNG, - Self::GATE_OUTCOME_HELD_INDETERMINATE_APPEND, - Self::GATE_OUTCOME_HELD_TRACE_INCOMPLETE, - Self::GATE_OUTCOME_HELD_PROJECTOR_BEHIND, - Self::GATE_OUTCOME_RELEASABLE, - ] - } -} -/// OrphanDetail is the evidence behind an orphan finding. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct OrphanDetail { - /// Field 1: `orphan_class` - #[serde( - rename = "orphanClass", - alias = "orphan_class", - with = "::buffa::json_helpers::proto_enum" - )] - pub orphan_class: ::buffa::EnumValue, - /// Upload id, artifact id, projection generation, migration id, or lease id, - /// per `orphan_class`. - /// - /// Field 2: `resource_id` - #[serde( - rename = "resourceId", - alias = "resource_id", - with = "::buffa::json_helpers::proto_string" - )] - pub resource_id: ::buffa::alloc::string::String, - /// When the resource was created in its store, as the store recorded it. A - /// wall-clock occurrence, not a position derived from append order (D10), - /// because an orphan by definition never reached the log. - /// - /// Field 3: `staged_at` - #[serde(rename = "stagedAt", alias = "staged_at")] - pub staged_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// How long it has been sitting there, as of the finding's `observed_at`. - /// - /// Field 4: `age` - #[serde(rename = "age")] - pub age: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, - /// What was actually checked before calling this unreferenced. - /// - /// Field 5: `trace` - #[serde(rename = "trace")] - pub trace: ::buffa::MessageField>, - /// What still has to be true before it can be released. - /// - /// Field 6: `gate` - #[serde(rename = "gate")] - pub gate: ::buffa::MessageField>, - /// Storage this would return. Unset when the store cannot say, which is - /// ordinary for an incomplete multipart upload and is not zero bytes. - /// - /// Field 7: `reclaimable_bytes` - #[serde( - rename = "reclaimableBytes", - alias = "reclaimable_bytes", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub reclaimable_bytes: ::core::option::Option, -} -impl ::core::fmt::Debug for OrphanDetail { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("OrphanDetail") - .field("orphan_class", &self.orphan_class) - .field("resource_id", &self.resource_id) - .field("staged_at", &self.staged_at) - .field("age", &self.age) - .field("trace", &self.trace) - .field("gate", &self.gate) - .field("reclaimable_bytes", &self.reclaimable_bytes) - .finish() - } -} -impl OrphanDetail { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.OrphanDetail"; -} -impl OrphanDetail { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::reclaimable_bytes`] to `Some(value)`, consuming and returning `self`. - pub fn with_reclaimable_bytes(mut self, value: u64) -> Self { - self.reclaimable_bytes = Some(value); - self - } -} -::buffa::impl_default_instance!(OrphanDetail); -impl ::buffa::MessageName for OrphanDetail { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "OrphanDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.OrphanDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.OrphanDetail"; -} -impl ::buffa::Message for OrphanDetail { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.orphan_class.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.resource_id) as u64; - if self.staged_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.staged_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.age.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.age.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.trace.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.trace.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.gate.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.gate.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(v) = self.reclaimable_bytes { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.orphan_class.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.resource_id, buf); - if self.staged_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.staged_at.write_to(__cache, buf); - } - if self.age.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.age.write_to(__cache, buf); - } - if self.trace.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.trace.write_to(__cache, buf); - } - if self.gate.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.gate.write_to(__cache, buf); - } - if let Some(v) = self.reclaimable_bytes { - ::buffa::types::put_uint64_field(7u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.orphan_class = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.resource_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.staged_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.age.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.trace.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.gate.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reclaimable_bytes = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.orphan_class = ::buffa::EnumValue::from(0); - self.resource_id.clear(); - self.staged_at = ::buffa::MessageField::none(); - self.age = ::buffa::MessageField::none(); - self.trace = ::buffa::MessageField::none(); - self.gate = ::buffa::MessageField::none(); - self.reclaimable_bytes = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for OrphanDetail { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ORPHAN_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.OrphanDetail", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// OwnershipTrace is what the orphan check looked at, and how far it got. -/// -/// This message is the difference between a finding and a guess. "No reference -/// found" is only meaningful alongside where the search ran and where it -/// stopped, and a check that scanned four of a tenant's streams produces the -/// same empty result as one that scanned all of them. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct OwnershipTrace { - /// Field 1: `completeness` - #[serde(rename = "completeness", with = "::buffa::json_helpers::proto_enum")] - pub completeness: ::buffa::EnumValue, - /// Streams the trace read to completion. - /// - /// Field 2: `streams_scanned` - #[serde( - rename = "streamsScanned", - alias = "streams_scanned", - with = "::buffa::json_helpers::uint32" - )] - pub streams_scanned: u32, - /// Streams in scope the trace could not read. Any non-zero value makes the - /// result non-exhaustive no matter how many streams were scanned, because the - /// reference could be in exactly one of them. - /// - /// Field 3: `streams_unreadable` - #[serde( - rename = "streamsUnreadable", - alias = "streams_unreadable", - with = "::buffa::json_helpers::uint32" - )] - pub streams_unreadable: u32, - /// Position the trace scanned through. - /// - /// Field 4: `scanned_through_watermark` - #[serde( - rename = "scannedThroughWatermark", - alias = "scanned_through_watermark", - with = "::buffa::json_helpers::uint64" - )] - pub scanned_through_watermark: u64, - /// Head at the time the trace ran. Above `scanned_through_watermark` means - /// events were appended during the scan, and a reference could be in the gap. - /// - /// Field 5: `source_high_watermark` - #[serde( - rename = "sourceHighWatermark", - alias = "source_high_watermark", - with = "::buffa::json_helpers::uint64" - )] - pub source_high_watermark: u64, - /// Position the slowest projector needed for this trace had applied through. - /// - /// A trace that consults derived state is only as complete as that state. A - /// projector behind the scan makes the trace's answer a statement about - /// history the projector has already seen, which is not the same as the - /// history that exists. - /// - /// Field 6: `projector_applied_through` - #[serde( - rename = "projectorAppliedThrough", - alias = "projector_applied_through", - with = "::buffa::json_helpers::uint64" - )] - pub projector_applied_through: u64, -} -impl ::core::fmt::Debug for OwnershipTrace { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("OwnershipTrace") - .field("completeness", &self.completeness) - .field("streams_scanned", &self.streams_scanned) - .field("streams_unreadable", &self.streams_unreadable) - .field("scanned_through_watermark", &self.scanned_through_watermark) - .field("source_high_watermark", &self.source_high_watermark) - .field("projector_applied_through", &self.projector_applied_through) - .finish() - } -} -impl OwnershipTrace { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.OwnershipTrace"; -} -::buffa::impl_default_instance!(OwnershipTrace); -impl ::buffa::MessageName for OwnershipTrace { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "OwnershipTrace"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.OwnershipTrace"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.OwnershipTrace"; -} -impl ::buffa::Message for OwnershipTrace { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.completeness.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.streams_scanned) as u64; - size - += 1u64 + ::buffa::types::uint32_encoded_len(self.streams_unreadable) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.scanned_through_watermark) - as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.source_high_watermark) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.projector_applied_through) - as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.completeness.to_i32(), buf); - ::buffa::types::put_uint32_field(2u32, self.streams_scanned, buf); - ::buffa::types::put_uint32_field(3u32, self.streams_unreadable, buf); - ::buffa::types::put_uint64_field(4u32, self.scanned_through_watermark, buf); - ::buffa::types::put_uint64_field(5u32, self.source_high_watermark, buf); - ::buffa::types::put_uint64_field(6u32, self.projector_applied_through, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.completeness = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.streams_scanned = ::buffa::types::decode_uint32(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.streams_unreadable = ::buffa::types::decode_uint32(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.scanned_through_watermark = ::buffa::types::decode_uint64(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.source_high_watermark = ::buffa::types::decode_uint64(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.projector_applied_through = ::buffa::types::decode_uint64(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.completeness = ::buffa::EnumValue::from(0); - self.streams_scanned = 0u32; - self.streams_unreadable = 0u32; - self.scanned_through_watermark = 0u64; - self.source_high_watermark = 0u64; - self.projector_applied_through = 0u64; - } -} -impl ::buffa::json_helpers::ProtoElemJson for OwnershipTrace { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __OWNERSHIP_TRACE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.OwnershipTrace", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ReleaseGate is what stands between an orphan finding and deleting something. -/// -/// Nothing is released on age alone and nothing is released on absence of -/// references alone. Both are necessary and neither is sufficient, which is why -/// the outcome is a single value rather than a set of flags a caller could read -/// selectively. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReleaseGate { - /// Field 1: `outcome` - #[serde(rename = "outcome", with = "::buffa::json_helpers::proto_enum")] - pub outcome: ::buffa::EnumValue, - /// How old a resource of this class must be before release is considered. - /// - /// Field 2: `minimum_age` - #[serde(rename = "minimumAge", alias = "minimum_age")] - pub minimum_age: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, - /// How long an append can remain indeterminate before its outcome is settled - /// one way or the other. - /// - /// This is the number that makes the whole gate correct. An append whose write - /// state is unknown may still land, and if it lands it carries a reference to - /// a resource that a cleanup pass has already decided nothing points at. So - /// `minimum_age` has to exceed this window, and a resource inside it is held - /// regardless of how thoroughly it was traced: the trace was accurate and the - /// history was not finished happening. - /// - /// Field 3: `indeterminacy_window` - #[serde(rename = "indeterminacyWindow", alias = "indeterminacy_window")] - pub indeterminacy_window: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, - /// Earliest time this could become releasable, if nothing changes. Unset when - /// waiting will not help, which is the case for every outcome that depends on - /// a fault being fixed rather than on time passing. - /// - /// Field 4: `releasable_after` - #[serde( - rename = "releasableAfter", - alias = "releasable_after", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub releasable_after: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for ReleaseGate { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReleaseGate") - .field("outcome", &self.outcome) - .field("minimum_age", &self.minimum_age) - .field("indeterminacy_window", &self.indeterminacy_window) - .field("releasable_after", &self.releasable_after) - .finish() - } -} -impl ReleaseGate { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.ReleaseGate"; -} -::buffa::impl_default_instance!(ReleaseGate); -impl ::buffa::MessageName for ReleaseGate { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "ReleaseGate"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.ReleaseGate"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.ReleaseGate"; -} -impl ::buffa::Message for ReleaseGate { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.outcome.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.minimum_age.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.minimum_age.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.indeterminacy_window.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.indeterminacy_window.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.releasable_after.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.releasable_after.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.outcome.to_i32(), buf); - if self.minimum_age.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.minimum_age.write_to(__cache, buf); - } - if self.indeterminacy_window.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.indeterminacy_window.write_to(__cache, buf); - } - if self.releasable_after.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.releasable_after.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.outcome = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.minimum_age.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.indeterminacy_window.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.releasable_after.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.outcome = ::buffa::EnumValue::from(0); - self.minimum_age = ::buffa::MessageField::none(); - self.indeterminacy_window = ::buffa::MessageField::none(); - self.releasable_after = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReleaseGate { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RELEASE_GATE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.ReleaseGate", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.repair_action.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.repair_action.rs deleted file mode 100644 index 1fd61fe30..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.repair_action.rs +++ /dev/null @@ -1,292 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/doctor/v1alpha1/repair_action.proto - -/// RepairAction is something the doctor can do about a finding. -/// -/// Every value in this enum operates on derived state: a projection, a -/// checkpoint, a snapshot, a claim. That is not a coincidence and it is not a -/// starting point to be extended later. -/// -/// The event stream is the source of truth and it is append-only. A repair that -/// edited, deleted, or reordered events would make the log depend on the tooling -/// built to inspect it, and every guarantee that rests on replay determinism -/// would rest instead on nobody having run the wrong repair. So no such action -/// exists here, and adding one is a decision about the architecture rather than -/// an addition to a list. -/// -/// The corollary catches the case operators most often expect to find here. -/// Reconciling a tool call that never recorded an outcome is not a repair. It is -/// CompleteToolCall or FailToolCall, an ordinary command through the ordinary -/// decider, subject to the ordinary invariants. Routing it through the doctor -/// would let an operator write history without passing the rules that make the -/// history mean anything. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum RepairAction { - REPAIR_ACTION_UNSPECIFIED = 0i32, - /// Rebuild a projection from the stream under a new generation. The workhorse: - /// it addresses most DEGRADED findings and it is safe because the input is - /// authoritative and the output is disposable. - REPAIR_ACTION_REBUILD_PROJECTION = 1i32, - /// Mark a projection generation unreadable so reads fail closed instead of - /// serving state known to be wrong. Used when a rebuild is not immediately - /// possible, and it makes the situation worse for readers on purpose: a - /// refused read is recoverable, a believed wrong answer is not. - REPAIR_ACTION_QUARANTINE_PROJECTION_GENERATION = 2i32, - /// Reset a projection checkpoint to the position the materialized view - /// actually reflects, so the projector reprocesses the gap it skipped. - REPAIR_ACTION_RESET_PROJECTION_CHECKPOINT = 3i32, - /// Discard a snapshot so the aggregate is folded from events again. Always - /// safe and never necessary for correctness, since a snapshot is a cache. - REPAIR_ACTION_DISCARD_SNAPSHOT = 4i32, - /// Recompute an artifact's digest from storage. This is a re-observation, not - /// a mutation, and it exists as an action because a digest finding is often a - /// transient read failure rather than data loss. - REPAIR_ACTION_REVERIFY_ARTIFACT = 5i32, - /// Release an artifact claim or multipart upload that references nothing - /// durable. The only action here that destroys anything, which is why the - /// finding it answers requires tracing durable ownership rather than a - /// reference search. - REPAIR_ACTION_RELEASE_ORPHANED_CLAIM = 6i32, - /// Discard derived state belonging to a computation that no longer runs: an - /// abandoned projection generation, staging from a completed migration. - /// - /// Distinct from releasing a claim, which is the only other action that - /// destroys anything, because this one destroys something reproducible. The - /// gate on the finding still has to pass: the cheap thing to get wrong here is - /// discarding the generation a rebuild is currently writing into. - REPAIR_ACTION_DISCARD_ORPHANED_DERIVED_STATE = 7i32, - /// Reclaim an expired reconciliation lease so another worker can settle the - /// operation it covered. A handoff rather than a deletion: the work still - /// exists and still needs an outcome. - REPAIR_ACTION_RECLAIM_EXPIRED_LEASE = 8i32, -} -impl RepairAction { - ///Idiomatic alias for [`Self::REPAIR_ACTION_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::REPAIR_ACTION_UNSPECIFIED; - ///Idiomatic alias for [`Self::REPAIR_ACTION_REBUILD_PROJECTION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const RebuildProjection: Self = Self::REPAIR_ACTION_REBUILD_PROJECTION; - ///Idiomatic alias for [`Self::REPAIR_ACTION_QUARANTINE_PROJECTION_GENERATION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const QuarantineProjectionGeneration: Self = Self::REPAIR_ACTION_QUARANTINE_PROJECTION_GENERATION; - ///Idiomatic alias for [`Self::REPAIR_ACTION_RESET_PROJECTION_CHECKPOINT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ResetProjectionCheckpoint: Self = Self::REPAIR_ACTION_RESET_PROJECTION_CHECKPOINT; - ///Idiomatic alias for [`Self::REPAIR_ACTION_DISCARD_SNAPSHOT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const DiscardSnapshot: Self = Self::REPAIR_ACTION_DISCARD_SNAPSHOT; - ///Idiomatic alias for [`Self::REPAIR_ACTION_REVERIFY_ARTIFACT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ReverifyArtifact: Self = Self::REPAIR_ACTION_REVERIFY_ARTIFACT; - ///Idiomatic alias for [`Self::REPAIR_ACTION_RELEASE_ORPHANED_CLAIM`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ReleaseOrphanedClaim: Self = Self::REPAIR_ACTION_RELEASE_ORPHANED_CLAIM; - ///Idiomatic alias for [`Self::REPAIR_ACTION_DISCARD_ORPHANED_DERIVED_STATE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const DiscardOrphanedDerivedState: Self = Self::REPAIR_ACTION_DISCARD_ORPHANED_DERIVED_STATE; - ///Idiomatic alias for [`Self::REPAIR_ACTION_RECLAIM_EXPIRED_LEASE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ReclaimExpiredLease: Self = Self::REPAIR_ACTION_RECLAIM_EXPIRED_LEASE; -} -impl ::core::default::Default for RepairAction { - fn default() -> Self { - Self::REPAIR_ACTION_UNSPECIFIED - } -} -impl ::serde::Serialize for RepairAction { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for RepairAction { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = RepairAction; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(RepairAction)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for RepairAction { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for RepairAction { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::REPAIR_ACTION_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::REPAIR_ACTION_REBUILD_PROJECTION), - 2i32 => { - ::core::option::Option::Some( - Self::REPAIR_ACTION_QUARANTINE_PROJECTION_GENERATION, - ) - } - 3i32 => { - ::core::option::Option::Some( - Self::REPAIR_ACTION_RESET_PROJECTION_CHECKPOINT, - ) - } - 4i32 => ::core::option::Option::Some(Self::REPAIR_ACTION_DISCARD_SNAPSHOT), - 5i32 => ::core::option::Option::Some(Self::REPAIR_ACTION_REVERIFY_ARTIFACT), - 6i32 => { - ::core::option::Option::Some(Self::REPAIR_ACTION_RELEASE_ORPHANED_CLAIM) - } - 7i32 => { - ::core::option::Option::Some( - Self::REPAIR_ACTION_DISCARD_ORPHANED_DERIVED_STATE, - ) - } - 8i32 => { - ::core::option::Option::Some(Self::REPAIR_ACTION_RECLAIM_EXPIRED_LEASE) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::REPAIR_ACTION_UNSPECIFIED => "REPAIR_ACTION_UNSPECIFIED", - Self::REPAIR_ACTION_REBUILD_PROJECTION => "REPAIR_ACTION_REBUILD_PROJECTION", - Self::REPAIR_ACTION_QUARANTINE_PROJECTION_GENERATION => { - "REPAIR_ACTION_QUARANTINE_PROJECTION_GENERATION" - } - Self::REPAIR_ACTION_RESET_PROJECTION_CHECKPOINT => { - "REPAIR_ACTION_RESET_PROJECTION_CHECKPOINT" - } - Self::REPAIR_ACTION_DISCARD_SNAPSHOT => "REPAIR_ACTION_DISCARD_SNAPSHOT", - Self::REPAIR_ACTION_REVERIFY_ARTIFACT => "REPAIR_ACTION_REVERIFY_ARTIFACT", - Self::REPAIR_ACTION_RELEASE_ORPHANED_CLAIM => { - "REPAIR_ACTION_RELEASE_ORPHANED_CLAIM" - } - Self::REPAIR_ACTION_DISCARD_ORPHANED_DERIVED_STATE => { - "REPAIR_ACTION_DISCARD_ORPHANED_DERIVED_STATE" - } - Self::REPAIR_ACTION_RECLAIM_EXPIRED_LEASE => { - "REPAIR_ACTION_RECLAIM_EXPIRED_LEASE" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "REPAIR_ACTION_UNSPECIFIED" => { - ::core::option::Option::Some(Self::REPAIR_ACTION_UNSPECIFIED) - } - "REPAIR_ACTION_REBUILD_PROJECTION" => { - ::core::option::Option::Some(Self::REPAIR_ACTION_REBUILD_PROJECTION) - } - "REPAIR_ACTION_QUARANTINE_PROJECTION_GENERATION" => { - ::core::option::Option::Some( - Self::REPAIR_ACTION_QUARANTINE_PROJECTION_GENERATION, - ) - } - "REPAIR_ACTION_RESET_PROJECTION_CHECKPOINT" => { - ::core::option::Option::Some( - Self::REPAIR_ACTION_RESET_PROJECTION_CHECKPOINT, - ) - } - "REPAIR_ACTION_DISCARD_SNAPSHOT" => { - ::core::option::Option::Some(Self::REPAIR_ACTION_DISCARD_SNAPSHOT) - } - "REPAIR_ACTION_REVERIFY_ARTIFACT" => { - ::core::option::Option::Some(Self::REPAIR_ACTION_REVERIFY_ARTIFACT) - } - "REPAIR_ACTION_RELEASE_ORPHANED_CLAIM" => { - ::core::option::Option::Some(Self::REPAIR_ACTION_RELEASE_ORPHANED_CLAIM) - } - "REPAIR_ACTION_DISCARD_ORPHANED_DERIVED_STATE" => { - ::core::option::Option::Some( - Self::REPAIR_ACTION_DISCARD_ORPHANED_DERIVED_STATE, - ) - } - "REPAIR_ACTION_RECLAIM_EXPIRED_LEASE" => { - ::core::option::Option::Some(Self::REPAIR_ACTION_RECLAIM_EXPIRED_LEASE) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::REPAIR_ACTION_UNSPECIFIED, - Self::REPAIR_ACTION_REBUILD_PROJECTION, - Self::REPAIR_ACTION_QUARANTINE_PROJECTION_GENERATION, - Self::REPAIR_ACTION_RESET_PROJECTION_CHECKPOINT, - Self::REPAIR_ACTION_DISCARD_SNAPSHOT, - Self::REPAIR_ACTION_REVERIFY_ARTIFACT, - Self::REPAIR_ACTION_RELEASE_ORPHANED_CLAIM, - Self::REPAIR_ACTION_DISCARD_ORPHANED_DERIVED_STATE, - Self::REPAIR_ACTION_RECLAIM_EXPIRED_LEASE, - ] - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.repair_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.repair_session.__view.rs deleted file mode 100644 index 0786b46a5..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.repair_session.__view.rs +++ /dev/null @@ -1,1504 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/doctor/v1alpha1/repair_session.proto - -/// RepairSessionRequest applies typed repairs to findings from a specific -/// diagnosis. -/// -/// Three properties make this safe, and each of them closes a failure that -/// operator tooling reaches for eventually. -/// -/// It is targeted. There is no "repair everything" shape. A caller names exact -/// findings and the exact action for each, because a bulk repair is a repair -/// whose blast radius nobody reviewed. -/// -/// It is provenanced. `diagnosis_id` binds every mutation to the report that -/// justified it, so an audit can answer what the operator was looking at. -/// -/// It re-verifies. The server re-runs each finding's check before acting on it. -/// The interval between running a doctor and running a repair is where state -/// changes, and a repair that trusts a report from ten minutes ago will happily -/// discard a projection that already rebuilt itself. -#[derive(Clone, Debug, Default)] -pub struct RepairSessionRequestView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// The diagnosis whose findings are being acted on. Findings from a different - /// diagnosis are refused rather than looked up, so a repair cannot be - /// assembled from ids an operator collected by hand. - /// - /// Field 2: `diagnosis_id` - pub diagnosis_id: &'a str, - /// Field 3: `mode` - pub mode: ::buffa::EnumValue, - /// Field 4: `targets` - pub targets: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::RepairTargetView<'a>, - >, - /// Why the operator is doing this, for the audit record. Required, and - /// required to be non-empty: a repair with no stated reason is the one that - /// will need explaining later. - /// - /// Field 5: `operator_reason` - pub operator_reason: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RepairSessionRequestView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `diagnosis_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_diagnosis_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `mode` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_mode(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `operator_reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operator_reason(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RepairSessionRequestView<'a> { - type Owned = super::super::RepairSessionRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.diagnosis_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.mode = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operator_reason = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::RepairTargetView, - >(), - )?; - view.targets - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::RepairSessionRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::RepairSessionRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RepairSessionRequest { - session_id: self.session_id.to_string(), - diagnosis_id: self.diagnosis_id.to_string(), - mode: self.mode, - targets: self - .targets - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - operator_reason: self.operator_reason.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RepairSessionRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.diagnosis_id) as u64; - { - let val = self.mode.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - for v in &self.targets { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.operator_reason) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.diagnosis_id, buf); - ::buffa::types::put_int32_field(3u32, self.mode.to_i32(), buf); - for v in &self.targets { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - ::buffa::types::put_string_field(5u32, &self.operator_reason, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RepairSessionRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("diagnosisId", self.diagnosis_id)?; - } - { - __map.serialize_entry("mode", &self.mode)?; - } - if !self.targets.is_empty() { - __map.serialize_entry("targets", &*self.targets)?; - } - { - __map.serialize_entry("operatorReason", self.operator_reason)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RepairSessionRequestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "RepairSessionRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.RepairSessionRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairSessionRequest"; -} -::buffa::impl_default_view_instance!(RepairSessionRequestView); -::buffa::impl_view_reborrow!(RepairSessionRequestView); -/** Self-contained, `'static` owned view of a `RepairSessionRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`RepairSessionRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RepairSessionRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RepairSessionRequestOwnedView( - ::buffa::OwnedView>, -); -impl RepairSessionRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RepairSessionRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RepairSessionRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RepairSessionRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RepairSessionRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RepairSessionRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RepairSessionRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RepairSessionRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// The diagnosis whose findings are being acted on. Findings from a different - /// diagnosis are refused rather than looked up, so a repair cannot be - /// assembled from ids an operator collected by hand. - /// - /// Field 2: `diagnosis_id` - #[must_use] - pub fn diagnosis_id(&self) -> &'_ str { - self.0.reborrow().diagnosis_id - } - /// Field 3: `mode` - #[must_use] - pub fn mode(&self) -> ::buffa::EnumValue { - self.0.reborrow().mode - } - /// Field 4: `targets` - #[must_use] - pub fn targets( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::RepairTargetView<'_>> { - &self.0.reborrow().targets - } - /// Why the operator is doing this, for the audit record. Required, and - /// required to be non-empty: a repair with no stated reason is the one that - /// will need explaining later. - /// - /// Field 5: `operator_reason` - #[must_use] - pub fn operator_reason(&self) -> &'_ str { - self.0.reborrow().operator_reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RepairSessionRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RepairSessionRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RepairSessionRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RepairSessionRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RepairSessionRequest { - type View<'a> = RepairSessionRequestView<'a>; - type ViewHandle = RepairSessionRequestOwnedView; -} -impl ::serde::Serialize for RepairSessionRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// RepairTarget is one finding and the action to take on it. -#[derive(Clone, Debug, Default)] -pub struct RepairTargetView<'a> { - /// Field 1: `finding_id` - pub finding_id: &'a str, - /// Must be one of the finding's `available_repairs`. An action the doctor did - /// not offer for this finding is refused, so the set of legal repairs is - /// decided by the code that understands the finding rather than by the caller. - /// - /// Field 2: `action` - pub action: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RepairTargetView<'a> { - /**Whether required field `finding_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_finding_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `action` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_action(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RepairTargetView<'a> { - type Owned = super::super::RepairTarget; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.finding_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.action = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RepairTarget { - finding_id: self.finding_id.to_string(), - action: self.action, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RepairTargetView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.finding_id) as u64; - { - let val = self.action.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.finding_id, buf); - ::buffa::types::put_int32_field(2u32, self.action.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RepairTargetView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("findingId", self.finding_id)?; - } - { - __map.serialize_entry("action", &self.action)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RepairTargetView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "RepairTarget"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.RepairTarget"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairTarget"; -} -::buffa::impl_default_view_instance!(RepairTargetView); -::buffa::impl_view_reborrow!(RepairTargetView); -/** Self-contained, `'static` owned view of a `RepairTarget` message. - - Wraps [`::buffa::OwnedView`]`<`[`RepairTargetView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RepairTargetView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RepairTargetOwnedView(::buffa::OwnedView>); -impl RepairTargetOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RepairTargetOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RepairTargetOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RepairTarget, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RepairTargetOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RepairTargetView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RepairTargetView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RepairTarget { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `finding_id` - #[must_use] - pub fn finding_id(&self) -> &'_ str { - self.0.reborrow().finding_id - } - /// Must be one of the finding's `available_repairs`. An action the doctor did - /// not offer for this finding is refused, so the set of legal repairs is - /// decided by the code that understands the finding rather than by the caller. - /// - /// Field 2: `action` - #[must_use] - pub fn action(&self) -> ::buffa::EnumValue { - self.0.reborrow().action - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RepairTargetOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RepairTargetOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RepairTargetOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RepairTargetOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RepairTarget { - type View<'a> = RepairTargetView<'a>; - type ViewHandle = RepairTargetOwnedView; -} -impl ::serde::Serialize for RepairTargetOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// RepairSessionResponse is what happened, or what would have. -#[derive(Clone, Debug, Default)] -pub struct RepairSessionResponseView<'a> { - /// Echoes the mode that ran. A dry run and an apply must never be - /// distinguishable only by what the caller believes it sent. - /// - /// Field 1: `mode` - pub mode: ::buffa::EnumValue, - /// Field 2: `results` - pub results: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::RepairResultView<'a>, - >, - /// Field 3: `observed_at` - pub observed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RepairSessionResponseView<'a> { - /**Whether required field `mode` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_mode(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `observed_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_observed_at(&self) -> bool { - self.observed_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for RepairSessionResponseView<'a> { - type Owned = super::super::RepairSessionResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.mode = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::RepairResultView, - >(), - )?; - view.results - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::RepairSessionResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::RepairSessionResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RepairSessionResponse { - mode: self.mode, - results: self - .results - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - observed_at: match self.observed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RepairSessionResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.mode.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - for v in &self.results { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.mode.to_i32(), buf); - for v in &self.results { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RepairSessionResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("mode", &self.mode)?; - } - if !self.results.is_empty() { - __map.serialize_entry("results", &*self.results)?; - } - { - if let ::core::option::Option::Some(__v) = self.observed_at.as_option() { - __map.serialize_entry("observedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RepairSessionResponseView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "RepairSessionResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.RepairSessionResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairSessionResponse"; -} -::buffa::impl_default_view_instance!(RepairSessionResponseView); -::buffa::impl_view_reborrow!(RepairSessionResponseView); -/** Self-contained, `'static` owned view of a `RepairSessionResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`RepairSessionResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RepairSessionResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RepairSessionResponseOwnedView( - ::buffa::OwnedView>, -); -impl RepairSessionResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RepairSessionResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RepairSessionResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RepairSessionResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RepairSessionResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RepairSessionResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RepairSessionResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RepairSessionResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Echoes the mode that ran. A dry run and an apply must never be - /// distinguishable only by what the caller believes it sent. - /// - /// Field 1: `mode` - #[must_use] - pub fn mode(&self) -> ::buffa::EnumValue { - self.0.reborrow().mode - } - /// Field 2: `results` - #[must_use] - pub fn results( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::RepairResultView<'_>> { - &self.0.reborrow().results - } - /// Field 3: `observed_at` - #[must_use] - pub fn observed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().observed_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RepairSessionResponseOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RepairSessionResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RepairSessionResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RepairSessionResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RepairSessionResponse { - type View<'a> = RepairSessionResponseView<'a>; - type ViewHandle = RepairSessionResponseOwnedView; -} -impl ::serde::Serialize for RepairSessionResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// RepairResult is the outcome for one target. -#[derive(Clone, Debug, Default)] -pub struct RepairResultView<'a> { - /// Field 1: `finding_id` - pub finding_id: &'a str, - /// Field 2: `action` - pub action: ::buffa::EnumValue, - /// Field 3: `status` - pub status: ::buffa::EnumValue, - /// What the action touched, or would touch: projection generations, snapshot - /// ids, claim ids. The substance of a dry run, and the audit trail of an - /// apply. - /// - /// Field 4: `affected` - pub affected: ::buffa::RepeatedView<'a, &'a str>, - /// Human-readable detail. Never parsed. - /// - /// Field 5: `detail` - pub detail: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RepairResultView<'a> { - /**Whether required field `finding_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_finding_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `action` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_action(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `status` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_status(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RepairResultView<'a> { - type Owned = super::super::RepairResult; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.finding_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.action = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.status = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::borrow_str(&mut cur)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - view.affected.push(__elem); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RepairResult { - finding_id: self.finding_id.to_string(), - action: self.action, - status: self.status, - affected: self.affected.iter().map(|s| s.to_string()).collect(), - detail: self.detail.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RepairResultView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.finding_id) as u64; - { - let val = self.action.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - { - let val = self.status.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - for v in &self.affected { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.finding_id, buf); - ::buffa::types::put_int32_field(2u32, self.action.to_i32(), buf); - ::buffa::types::put_int32_field(3u32, self.status.to_i32(), buf); - for v in &self.affected { - ::buffa::types::put_string_field(4u32, v, buf); - } - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(5u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RepairResultView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("findingId", self.finding_id)?; - } - { - __map.serialize_entry("action", &self.action)?; - } - { - __map.serialize_entry("status", &self.status)?; - } - if !self.affected.is_empty() { - __map.serialize_entry("affected", &*self.affected)?; - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RepairResultView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "RepairResult"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.RepairResult"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairResult"; -} -::buffa::impl_default_view_instance!(RepairResultView); -::buffa::impl_view_reborrow!(RepairResultView); -/** Self-contained, `'static` owned view of a `RepairResult` message. - - Wraps [`::buffa::OwnedView`]`<`[`RepairResultView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RepairResultView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RepairResultOwnedView(::buffa::OwnedView>); -impl RepairResultOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RepairResultOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RepairResultOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RepairResult, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RepairResultOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RepairResultView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RepairResultView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RepairResult { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `finding_id` - #[must_use] - pub fn finding_id(&self) -> &'_ str { - self.0.reborrow().finding_id - } - /// Field 2: `action` - #[must_use] - pub fn action(&self) -> ::buffa::EnumValue { - self.0.reborrow().action - } - /// Field 3: `status` - #[must_use] - pub fn status(&self) -> ::buffa::EnumValue { - self.0.reborrow().status - } - /// What the action touched, or would touch: projection generations, snapshot - /// ids, claim ids. The substance of a dry run, and the audit trail of an - /// apply. - /// - /// Field 4: `affected` - #[must_use] - pub fn affected(&self) -> &::buffa::RepeatedView<'_, &'_ str> { - &self.0.reborrow().affected - } - /// Human-readable detail. Never parsed. - /// - /// Field 5: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RepairResultOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RepairResultOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RepairResultOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RepairResultOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RepairResult { - type View<'a> = RepairResultView<'a>; - type ViewHandle = RepairResultOwnedView; -} -impl ::serde::Serialize for RepairResultOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.repair_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.repair_session.rs deleted file mode 100644 index 505019c9c..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.doctor.v1alpha1.repair_session.rs +++ /dev/null @@ -1,1125 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/doctor/v1alpha1/repair_session.proto - -/// RepairMode is whether this call is allowed to mutate anything. -/// -/// The numbering is load-bearing. Zero is DRY_RUN, so a caller that forgets the -/// field, decodes an older message, or builds a request programmatically and -/// misses a branch gets a preview rather than a mutation. Every other ordering -/// of these values makes the default destructive, and a default that destroys -/// is a defect no amount of documentation fixes. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum RepairMode { - /// Treated as DRY_RUN. Unset is a preview, never an apply. - REPAIR_MODE_UNSPECIFIED = 0i32, - /// Re-verify every target and report what would happen. Mutates nothing. - REPAIR_MODE_DRY_RUN = 1i32, - /// Re-verify every target and apply the ones that still hold. - REPAIR_MODE_APPLY = 2i32, -} -impl RepairMode { - ///Idiomatic alias for [`Self::REPAIR_MODE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::REPAIR_MODE_UNSPECIFIED; - ///Idiomatic alias for [`Self::REPAIR_MODE_DRY_RUN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const DryRun: Self = Self::REPAIR_MODE_DRY_RUN; - ///Idiomatic alias for [`Self::REPAIR_MODE_APPLY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Apply: Self = Self::REPAIR_MODE_APPLY; -} -impl ::core::default::Default for RepairMode { - fn default() -> Self { - Self::REPAIR_MODE_UNSPECIFIED - } -} -impl ::serde::Serialize for RepairMode { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for RepairMode { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = RepairMode; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(RepairMode)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for RepairMode { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for RepairMode { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::REPAIR_MODE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::REPAIR_MODE_DRY_RUN), - 2i32 => ::core::option::Option::Some(Self::REPAIR_MODE_APPLY), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::REPAIR_MODE_UNSPECIFIED => "REPAIR_MODE_UNSPECIFIED", - Self::REPAIR_MODE_DRY_RUN => "REPAIR_MODE_DRY_RUN", - Self::REPAIR_MODE_APPLY => "REPAIR_MODE_APPLY", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "REPAIR_MODE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::REPAIR_MODE_UNSPECIFIED) - } - "REPAIR_MODE_DRY_RUN" => { - ::core::option::Option::Some(Self::REPAIR_MODE_DRY_RUN) - } - "REPAIR_MODE_APPLY" => ::core::option::Option::Some(Self::REPAIR_MODE_APPLY), - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::REPAIR_MODE_UNSPECIFIED, - Self::REPAIR_MODE_DRY_RUN, - Self::REPAIR_MODE_APPLY, - ] - } -} -/// RepairResultStatus is per-target, because a repair call is not atomic and -/// pretending otherwise would hide which half of it landed. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum RepairResultStatus { - REPAIR_RESULT_STATUS_UNSPECIFIED = 0i32, - /// Dry run: the finding still holds and the action would be taken. - REPAIR_RESULT_STATUS_WOULD_APPLY = 1i32, - /// Apply: the action was taken. - REPAIR_RESULT_STATUS_APPLIED = 2i32, - /// Re-verification found the finding no longer holds. Not an error: the - /// problem resolved itself between diagnosis and repair, and doing nothing is - /// the correct outcome. - REPAIR_RESULT_STATUS_NOT_REPRODUCIBLE = 3i32, - /// The action is not among the finding's available repairs. - REPAIR_RESULT_STATUS_ACTION_NOT_AVAILABLE = 4i32, - /// The finding still holds and the server declined to act, because applying - /// the action in the current state could destroy something recoverable. An - /// unreadable artifact is the standard case: it is not yet known to be lost, - /// so nothing that treats it as lost may run. - REPAIR_RESULT_STATUS_REFUSED_UNSAFE = 5i32, - /// The action was attempted and failed. Distinct from refused: something may - /// have partially changed, and `affected` says what. - REPAIR_RESULT_STATUS_FAILED = 6i32, -} -impl RepairResultStatus { - ///Idiomatic alias for [`Self::REPAIR_RESULT_STATUS_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::REPAIR_RESULT_STATUS_UNSPECIFIED; - ///Idiomatic alias for [`Self::REPAIR_RESULT_STATUS_WOULD_APPLY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const WouldApply: Self = Self::REPAIR_RESULT_STATUS_WOULD_APPLY; - ///Idiomatic alias for [`Self::REPAIR_RESULT_STATUS_APPLIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Applied: Self = Self::REPAIR_RESULT_STATUS_APPLIED; - ///Idiomatic alias for [`Self::REPAIR_RESULT_STATUS_NOT_REPRODUCIBLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NotReproducible: Self = Self::REPAIR_RESULT_STATUS_NOT_REPRODUCIBLE; - ///Idiomatic alias for [`Self::REPAIR_RESULT_STATUS_ACTION_NOT_AVAILABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ActionNotAvailable: Self = Self::REPAIR_RESULT_STATUS_ACTION_NOT_AVAILABLE; - ///Idiomatic alias for [`Self::REPAIR_RESULT_STATUS_REFUSED_UNSAFE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const RefusedUnsafe: Self = Self::REPAIR_RESULT_STATUS_REFUSED_UNSAFE; - ///Idiomatic alias for [`Self::REPAIR_RESULT_STATUS_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Failed: Self = Self::REPAIR_RESULT_STATUS_FAILED; -} -impl ::core::default::Default for RepairResultStatus { - fn default() -> Self { - Self::REPAIR_RESULT_STATUS_UNSPECIFIED - } -} -impl ::serde::Serialize for RepairResultStatus { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for RepairResultStatus { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = RepairResultStatus; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(RepairResultStatus) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for RepairResultStatus { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for RepairResultStatus { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::REPAIR_RESULT_STATUS_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::REPAIR_RESULT_STATUS_WOULD_APPLY), - 2i32 => ::core::option::Option::Some(Self::REPAIR_RESULT_STATUS_APPLIED), - 3i32 => { - ::core::option::Option::Some(Self::REPAIR_RESULT_STATUS_NOT_REPRODUCIBLE) - } - 4i32 => { - ::core::option::Option::Some( - Self::REPAIR_RESULT_STATUS_ACTION_NOT_AVAILABLE, - ) - } - 5i32 => { - ::core::option::Option::Some(Self::REPAIR_RESULT_STATUS_REFUSED_UNSAFE) - } - 6i32 => ::core::option::Option::Some(Self::REPAIR_RESULT_STATUS_FAILED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::REPAIR_RESULT_STATUS_UNSPECIFIED => "REPAIR_RESULT_STATUS_UNSPECIFIED", - Self::REPAIR_RESULT_STATUS_WOULD_APPLY => "REPAIR_RESULT_STATUS_WOULD_APPLY", - Self::REPAIR_RESULT_STATUS_APPLIED => "REPAIR_RESULT_STATUS_APPLIED", - Self::REPAIR_RESULT_STATUS_NOT_REPRODUCIBLE => { - "REPAIR_RESULT_STATUS_NOT_REPRODUCIBLE" - } - Self::REPAIR_RESULT_STATUS_ACTION_NOT_AVAILABLE => { - "REPAIR_RESULT_STATUS_ACTION_NOT_AVAILABLE" - } - Self::REPAIR_RESULT_STATUS_REFUSED_UNSAFE => { - "REPAIR_RESULT_STATUS_REFUSED_UNSAFE" - } - Self::REPAIR_RESULT_STATUS_FAILED => "REPAIR_RESULT_STATUS_FAILED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "REPAIR_RESULT_STATUS_UNSPECIFIED" => { - ::core::option::Option::Some(Self::REPAIR_RESULT_STATUS_UNSPECIFIED) - } - "REPAIR_RESULT_STATUS_WOULD_APPLY" => { - ::core::option::Option::Some(Self::REPAIR_RESULT_STATUS_WOULD_APPLY) - } - "REPAIR_RESULT_STATUS_APPLIED" => { - ::core::option::Option::Some(Self::REPAIR_RESULT_STATUS_APPLIED) - } - "REPAIR_RESULT_STATUS_NOT_REPRODUCIBLE" => { - ::core::option::Option::Some(Self::REPAIR_RESULT_STATUS_NOT_REPRODUCIBLE) - } - "REPAIR_RESULT_STATUS_ACTION_NOT_AVAILABLE" => { - ::core::option::Option::Some( - Self::REPAIR_RESULT_STATUS_ACTION_NOT_AVAILABLE, - ) - } - "REPAIR_RESULT_STATUS_REFUSED_UNSAFE" => { - ::core::option::Option::Some(Self::REPAIR_RESULT_STATUS_REFUSED_UNSAFE) - } - "REPAIR_RESULT_STATUS_FAILED" => { - ::core::option::Option::Some(Self::REPAIR_RESULT_STATUS_FAILED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::REPAIR_RESULT_STATUS_UNSPECIFIED, - Self::REPAIR_RESULT_STATUS_WOULD_APPLY, - Self::REPAIR_RESULT_STATUS_APPLIED, - Self::REPAIR_RESULT_STATUS_NOT_REPRODUCIBLE, - Self::REPAIR_RESULT_STATUS_ACTION_NOT_AVAILABLE, - Self::REPAIR_RESULT_STATUS_REFUSED_UNSAFE, - Self::REPAIR_RESULT_STATUS_FAILED, - ] - } -} -/// RepairSessionRequest applies typed repairs to findings from a specific -/// diagnosis. -/// -/// Three properties make this safe, and each of them closes a failure that -/// operator tooling reaches for eventually. -/// -/// It is targeted. There is no "repair everything" shape. A caller names exact -/// findings and the exact action for each, because a bulk repair is a repair -/// whose blast radius nobody reviewed. -/// -/// It is provenanced. `diagnosis_id` binds every mutation to the report that -/// justified it, so an audit can answer what the operator was looking at. -/// -/// It re-verifies. The server re-runs each finding's check before acting on it. -/// The interval between running a doctor and running a repair is where state -/// changes, and a repair that trusts a report from ten minutes ago will happily -/// discard a projection that already rebuilt itself. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RepairSessionRequest { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// The diagnosis whose findings are being acted on. Findings from a different - /// diagnosis are refused rather than looked up, so a repair cannot be - /// assembled from ids an operator collected by hand. - /// - /// Field 2: `diagnosis_id` - #[serde( - rename = "diagnosisId", - alias = "diagnosis_id", - with = "::buffa::json_helpers::proto_string" - )] - pub diagnosis_id: ::buffa::alloc::string::String, - /// Field 3: `mode` - #[serde(rename = "mode", with = "::buffa::json_helpers::proto_enum")] - pub mode: ::buffa::EnumValue, - /// Field 4: `targets` - #[serde( - rename = "targets", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub targets: ::buffa::alloc::vec::Vec, - /// Why the operator is doing this, for the audit record. Required, and - /// required to be non-empty: a repair with no stated reason is the one that - /// will need explaining later. - /// - /// Field 5: `operator_reason` - #[serde( - rename = "operatorReason", - alias = "operator_reason", - with = "::buffa::json_helpers::proto_string" - )] - pub operator_reason: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for RepairSessionRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RepairSessionRequest") - .field("session_id", &self.session_id) - .field("diagnosis_id", &self.diagnosis_id) - .field("mode", &self.mode) - .field("targets", &self.targets) - .field("operator_reason", &self.operator_reason) - .finish() - } -} -impl RepairSessionRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairSessionRequest"; -} -::buffa::impl_default_instance!(RepairSessionRequest); -impl ::buffa::MessageName for RepairSessionRequest { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "RepairSessionRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.RepairSessionRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairSessionRequest"; -} -impl ::buffa::Message for RepairSessionRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.diagnosis_id) as u64; - { - let val = self.mode.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - for v in &self.targets { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.operator_reason) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.diagnosis_id, buf); - ::buffa::types::put_int32_field(3u32, self.mode.to_i32(), buf); - for v in &self.targets { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - ::buffa::types::put_string_field(5u32, &self.operator_reason, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.diagnosis_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.mode = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.targets.push(elem); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operator_reason, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.diagnosis_id.clear(); - self.mode = ::buffa::EnumValue::from(0); - self.targets.clear(); - self.operator_reason.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for RepairSessionRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REPAIR_SESSION_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairSessionRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// RepairTarget is one finding and the action to take on it. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RepairTarget { - /// Field 1: `finding_id` - #[serde( - rename = "findingId", - alias = "finding_id", - with = "::buffa::json_helpers::proto_string" - )] - pub finding_id: ::buffa::alloc::string::String, - /// Must be one of the finding's `available_repairs`. An action the doctor did - /// not offer for this finding is refused, so the set of legal repairs is - /// decided by the code that understands the finding rather than by the caller. - /// - /// Field 2: `action` - #[serde(rename = "action", with = "::buffa::json_helpers::proto_enum")] - pub action: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for RepairTarget { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RepairTarget") - .field("finding_id", &self.finding_id) - .field("action", &self.action) - .finish() - } -} -impl RepairTarget { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairTarget"; -} -::buffa::impl_default_instance!(RepairTarget); -impl ::buffa::MessageName for RepairTarget { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "RepairTarget"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.RepairTarget"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairTarget"; -} -impl ::buffa::Message for RepairTarget { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.finding_id) as u64; - { - let val = self.action.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.finding_id, buf); - ::buffa::types::put_int32_field(2u32, self.action.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.finding_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.action = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.finding_id.clear(); - self.action = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for RepairTarget { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REPAIR_TARGET_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairTarget", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// RepairSessionResponse is what happened, or what would have. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RepairSessionResponse { - /// Echoes the mode that ran. A dry run and an apply must never be - /// distinguishable only by what the caller believes it sent. - /// - /// Field 1: `mode` - #[serde(rename = "mode", with = "::buffa::json_helpers::proto_enum")] - pub mode: ::buffa::EnumValue, - /// Field 2: `results` - #[serde( - rename = "results", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub results: ::buffa::alloc::vec::Vec, - /// Field 3: `observed_at` - #[serde(rename = "observedAt", alias = "observed_at")] - pub observed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for RepairSessionResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RepairSessionResponse") - .field("mode", &self.mode) - .field("results", &self.results) - .field("observed_at", &self.observed_at) - .finish() - } -} -impl RepairSessionResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairSessionResponse"; -} -::buffa::impl_default_instance!(RepairSessionResponse); -impl ::buffa::MessageName for RepairSessionResponse { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "RepairSessionResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.RepairSessionResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairSessionResponse"; -} -impl ::buffa::Message for RepairSessionResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.mode.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - for v in &self.results { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.mode.to_i32(), buf); - for v in &self.results { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.mode = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.results.push(elem); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.mode = ::buffa::EnumValue::from(0); - self.results.clear(); - self.observed_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for RepairSessionResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REPAIR_SESSION_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairSessionResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// RepairResult is the outcome for one target. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RepairResult { - /// Field 1: `finding_id` - #[serde( - rename = "findingId", - alias = "finding_id", - with = "::buffa::json_helpers::proto_string" - )] - pub finding_id: ::buffa::alloc::string::String, - /// Field 2: `action` - #[serde(rename = "action", with = "::buffa::json_helpers::proto_enum")] - pub action: ::buffa::EnumValue, - /// Field 3: `status` - #[serde(rename = "status", with = "::buffa::json_helpers::proto_enum")] - pub status: ::buffa::EnumValue, - /// What the action touched, or would touch: projection generations, snapshot - /// ids, claim ids. The substance of a dry run, and the audit trail of an - /// apply. - /// - /// Field 4: `affected` - #[serde( - rename = "affected", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub affected: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, - /// Human-readable detail. Never parsed. - /// - /// Field 5: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for RepairResult { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RepairResult") - .field("finding_id", &self.finding_id) - .field("action", &self.action) - .field("status", &self.status) - .field("affected", &self.affected) - .field("detail", &self.detail) - .finish() - } -} -impl RepairResult { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairResult"; -} -impl RepairResult { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(RepairResult); -impl ::buffa::MessageName for RepairResult { - const PACKAGE: &'static str = "trogonai.session.sessions.doctor.v1alpha1"; - const NAME: &'static str = "RepairResult"; - const FULL_NAME: &'static str = "trogonai.session.sessions.doctor.v1alpha1.RepairResult"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairResult"; -} -impl ::buffa::Message for RepairResult { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.finding_id) as u64; - { - let val = self.action.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - { - let val = self.status.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - for v in &self.affected { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.finding_id, buf); - ::buffa::types::put_int32_field(2u32, self.action.to_i32(), buf); - ::buffa::types::put_int32_field(3u32, self.status.to_i32(), buf); - for v in &self.affected { - ::buffa::types::put_string_field(4u32, v, buf); - } - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(5u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.finding_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.action = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.status = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::decode_string(buf)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - self.affected.push(__elem); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.finding_id.clear(); - self.action = ::buffa::EnumValue::from(0); - self.status = ::buffa::EnumValue::from(0); - self.affected.clear(); - self.detail = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for RepairResult { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REPAIR_RESULT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.doctor.v1alpha1.RepairResult", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.maintenance_error.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.maintenance_error.__view.rs deleted file mode 100644 index 88fe5ec1d..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.maintenance_error.__view.rs +++ /dev/null @@ -1,329 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/maintenance_error.proto - -/// MaintenanceError is the typed failure payload for the migration and salvage -/// surface. -/// -/// Kept separate from QueryError and DoctorError on the same reasoning each of -/// those applies: these are operator operations that rewrite or duplicate -/// durable state, and their failure vocabulary should be free to grow without -/// that growth being a client-visible or diagnostic-visible change. -/// -/// An operation that ran and could not be classified is not an error. It is a -/// successful call reporting MAINTENANCE_STATE_INDETERMINATE, because it has a -/// durable record and a defined next step, and turning it into an error would -/// discard both. -#[derive(Clone, Debug, Default)] -pub struct MaintenanceErrorView<'a> { - /// Field 1: `code` - pub code: ::buffa::EnumValue, - /// Human-readable, non-contractual. Never parse it. - /// - /// Field 2: `message` - pub message: &'a str, - /// Dotted path into the request for INVALID_ARGUMENT. - /// - /// Field 3: `field_path` - pub field_path: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> MaintenanceErrorView<'a> { - /**Whether required field `code` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_code(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `message` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for MaintenanceErrorView<'a> { - type Owned = super::super::MaintenanceError; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.code = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.message = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.field_path = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::MaintenanceError { - code: self.code, - message: self.message.to_string(), - field_path: self.field_path.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for MaintenanceErrorView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.code.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.message) as u64; - if let Some(ref v) = self.field_path { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.code.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.message, buf); - if let Some(ref v) = self.field_path { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for MaintenanceErrorView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("code", &self.code)?; - } - { - __map.serialize_entry("message", self.message)?; - } - if let ::core::option::Option::Some(__v) = self.field_path { - __map.serialize_entry("fieldPath", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for MaintenanceErrorView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MaintenanceError"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MaintenanceError"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MaintenanceError"; -} -::buffa::impl_default_view_instance!(MaintenanceErrorView); -::buffa::impl_view_reborrow!(MaintenanceErrorView); -/** Self-contained, `'static` owned view of a `MaintenanceError` message. - - Wraps [`::buffa::OwnedView`]`<`[`MaintenanceErrorView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`MaintenanceErrorView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct MaintenanceErrorOwnedView(::buffa::OwnedView>); -impl MaintenanceErrorOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MaintenanceErrorOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MaintenanceErrorOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::MaintenanceError, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MaintenanceErrorOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`MaintenanceErrorView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &MaintenanceErrorView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::MaintenanceError { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `code` - #[must_use] - pub fn code(&self) -> ::buffa::EnumValue { - self.0.reborrow().code - } - /// Human-readable, non-contractual. Never parse it. - /// - /// Field 2: `message` - #[must_use] - pub fn message(&self) -> &'_ str { - self.0.reborrow().message - } - /// Dotted path into the request for INVALID_ARGUMENT. - /// - /// Field 3: `field_path` - #[must_use] - pub fn field_path(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().field_path - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for MaintenanceErrorOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - MaintenanceErrorOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: MaintenanceErrorOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for MaintenanceErrorOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::MaintenanceError { - type View<'a> = MaintenanceErrorView<'a>; - type ViewHandle = MaintenanceErrorOwnedView; -} -impl ::serde::Serialize for MaintenanceErrorOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.maintenance_error.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.maintenance_error.rs deleted file mode 100644 index 33df50e59..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.maintenance_error.rs +++ /dev/null @@ -1,461 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/maintenance_error.proto - -/// MaintenanceErrorCode is why an operation could not be attempted. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum MaintenanceErrorCode { - MAINTENANCE_ERROR_CODE_UNSPECIFIED = 0i32, - MAINTENANCE_ERROR_CODE_SESSION_NOT_FOUND = 1i32, - MAINTENANCE_ERROR_CODE_INVALID_ARGUMENT = 2i32, - /// Reconciliation was asked about an identity with no recorded intent. Distinct - /// from an indeterminate outcome: there is no operation to reconcile, so there - /// is nothing to report a state for. - MAINTENANCE_ERROR_CODE_INTENT_NOT_FOUND = 3i32, - /// The request's parameters do not reproduce the identity it names. Refused - /// rather than treated as a new operation, because the caller believes it is - /// retrying something it is not. - MAINTENANCE_ERROR_CODE_IDENTITY_MISMATCH = 4i32, - /// Another maintenance operation holds this session. Two concurrent migrations - /// of one session both write a target, and only one can be right. - MAINTENANCE_ERROR_CODE_OPERATION_IN_PROGRESS = 5i32, - /// Planning and committing are authorized separately: the right to see what a - /// migration would do does not carry the right to run it. - MAINTENANCE_ERROR_CODE_PERMISSION_DENIED = 6i32, - MAINTENANCE_ERROR_CODE_RESOURCE_EXHAUSTED = 7i32, - MAINTENANCE_ERROR_CODE_INTERNAL = 8i32, -} -impl MaintenanceErrorCode { - ///Idiomatic alias for [`Self::MAINTENANCE_ERROR_CODE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::MAINTENANCE_ERROR_CODE_UNSPECIFIED; - ///Idiomatic alias for [`Self::MAINTENANCE_ERROR_CODE_SESSION_NOT_FOUND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SessionNotFound: Self = Self::MAINTENANCE_ERROR_CODE_SESSION_NOT_FOUND; - ///Idiomatic alias for [`Self::MAINTENANCE_ERROR_CODE_INVALID_ARGUMENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const InvalidArgument: Self = Self::MAINTENANCE_ERROR_CODE_INVALID_ARGUMENT; - ///Idiomatic alias for [`Self::MAINTENANCE_ERROR_CODE_INTENT_NOT_FOUND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const IntentNotFound: Self = Self::MAINTENANCE_ERROR_CODE_INTENT_NOT_FOUND; - ///Idiomatic alias for [`Self::MAINTENANCE_ERROR_CODE_IDENTITY_MISMATCH`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const IdentityMismatch: Self = Self::MAINTENANCE_ERROR_CODE_IDENTITY_MISMATCH; - ///Idiomatic alias for [`Self::MAINTENANCE_ERROR_CODE_OPERATION_IN_PROGRESS`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const OperationInProgress: Self = Self::MAINTENANCE_ERROR_CODE_OPERATION_IN_PROGRESS; - ///Idiomatic alias for [`Self::MAINTENANCE_ERROR_CODE_PERMISSION_DENIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const PermissionDenied: Self = Self::MAINTENANCE_ERROR_CODE_PERMISSION_DENIED; - ///Idiomatic alias for [`Self::MAINTENANCE_ERROR_CODE_RESOURCE_EXHAUSTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ResourceExhausted: Self = Self::MAINTENANCE_ERROR_CODE_RESOURCE_EXHAUSTED; - ///Idiomatic alias for [`Self::MAINTENANCE_ERROR_CODE_INTERNAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Internal: Self = Self::MAINTENANCE_ERROR_CODE_INTERNAL; -} -impl ::core::default::Default for MaintenanceErrorCode { - fn default() -> Self { - Self::MAINTENANCE_ERROR_CODE_UNSPECIFIED - } -} -impl ::serde::Serialize for MaintenanceErrorCode { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for MaintenanceErrorCode { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = MaintenanceErrorCode; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(MaintenanceErrorCode) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for MaintenanceErrorCode { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for MaintenanceErrorCode { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some(Self::MAINTENANCE_ERROR_CODE_UNSPECIFIED) - } - 1i32 => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_SESSION_NOT_FOUND, - ) - } - 2i32 => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_INVALID_ARGUMENT, - ) - } - 3i32 => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_INTENT_NOT_FOUND, - ) - } - 4i32 => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_IDENTITY_MISMATCH, - ) - } - 5i32 => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_OPERATION_IN_PROGRESS, - ) - } - 6i32 => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_PERMISSION_DENIED, - ) - } - 7i32 => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_RESOURCE_EXHAUSTED, - ) - } - 8i32 => ::core::option::Option::Some(Self::MAINTENANCE_ERROR_CODE_INTERNAL), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::MAINTENANCE_ERROR_CODE_UNSPECIFIED => { - "MAINTENANCE_ERROR_CODE_UNSPECIFIED" - } - Self::MAINTENANCE_ERROR_CODE_SESSION_NOT_FOUND => { - "MAINTENANCE_ERROR_CODE_SESSION_NOT_FOUND" - } - Self::MAINTENANCE_ERROR_CODE_INVALID_ARGUMENT => { - "MAINTENANCE_ERROR_CODE_INVALID_ARGUMENT" - } - Self::MAINTENANCE_ERROR_CODE_INTENT_NOT_FOUND => { - "MAINTENANCE_ERROR_CODE_INTENT_NOT_FOUND" - } - Self::MAINTENANCE_ERROR_CODE_IDENTITY_MISMATCH => { - "MAINTENANCE_ERROR_CODE_IDENTITY_MISMATCH" - } - Self::MAINTENANCE_ERROR_CODE_OPERATION_IN_PROGRESS => { - "MAINTENANCE_ERROR_CODE_OPERATION_IN_PROGRESS" - } - Self::MAINTENANCE_ERROR_CODE_PERMISSION_DENIED => { - "MAINTENANCE_ERROR_CODE_PERMISSION_DENIED" - } - Self::MAINTENANCE_ERROR_CODE_RESOURCE_EXHAUSTED => { - "MAINTENANCE_ERROR_CODE_RESOURCE_EXHAUSTED" - } - Self::MAINTENANCE_ERROR_CODE_INTERNAL => "MAINTENANCE_ERROR_CODE_INTERNAL", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "MAINTENANCE_ERROR_CODE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::MAINTENANCE_ERROR_CODE_UNSPECIFIED) - } - "MAINTENANCE_ERROR_CODE_SESSION_NOT_FOUND" => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_SESSION_NOT_FOUND, - ) - } - "MAINTENANCE_ERROR_CODE_INVALID_ARGUMENT" => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_INVALID_ARGUMENT, - ) - } - "MAINTENANCE_ERROR_CODE_INTENT_NOT_FOUND" => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_INTENT_NOT_FOUND, - ) - } - "MAINTENANCE_ERROR_CODE_IDENTITY_MISMATCH" => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_IDENTITY_MISMATCH, - ) - } - "MAINTENANCE_ERROR_CODE_OPERATION_IN_PROGRESS" => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_OPERATION_IN_PROGRESS, - ) - } - "MAINTENANCE_ERROR_CODE_PERMISSION_DENIED" => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_PERMISSION_DENIED, - ) - } - "MAINTENANCE_ERROR_CODE_RESOURCE_EXHAUSTED" => { - ::core::option::Option::Some( - Self::MAINTENANCE_ERROR_CODE_RESOURCE_EXHAUSTED, - ) - } - "MAINTENANCE_ERROR_CODE_INTERNAL" => { - ::core::option::Option::Some(Self::MAINTENANCE_ERROR_CODE_INTERNAL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::MAINTENANCE_ERROR_CODE_UNSPECIFIED, - Self::MAINTENANCE_ERROR_CODE_SESSION_NOT_FOUND, - Self::MAINTENANCE_ERROR_CODE_INVALID_ARGUMENT, - Self::MAINTENANCE_ERROR_CODE_INTENT_NOT_FOUND, - Self::MAINTENANCE_ERROR_CODE_IDENTITY_MISMATCH, - Self::MAINTENANCE_ERROR_CODE_OPERATION_IN_PROGRESS, - Self::MAINTENANCE_ERROR_CODE_PERMISSION_DENIED, - Self::MAINTENANCE_ERROR_CODE_RESOURCE_EXHAUSTED, - Self::MAINTENANCE_ERROR_CODE_INTERNAL, - ] - } -} -/// MaintenanceError is the typed failure payload for the migration and salvage -/// surface. -/// -/// Kept separate from QueryError and DoctorError on the same reasoning each of -/// those applies: these are operator operations that rewrite or duplicate -/// durable state, and their failure vocabulary should be free to grow without -/// that growth being a client-visible or diagnostic-visible change. -/// -/// An operation that ran and could not be classified is not an error. It is a -/// successful call reporting MAINTENANCE_STATE_INDETERMINATE, because it has a -/// durable record and a defined next step, and turning it into an error would -/// discard both. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct MaintenanceError { - /// Field 1: `code` - #[serde(rename = "code", with = "::buffa::json_helpers::proto_enum")] - pub code: ::buffa::EnumValue, - /// Human-readable, non-contractual. Never parse it. - /// - /// Field 2: `message` - #[serde(rename = "message", with = "::buffa::json_helpers::proto_string")] - pub message: ::buffa::alloc::string::String, - /// Dotted path into the request for INVALID_ARGUMENT. - /// - /// Field 3: `field_path` - #[serde( - rename = "fieldPath", - alias = "field_path", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub field_path: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for MaintenanceError { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("MaintenanceError") - .field("code", &self.code) - .field("message", &self.message) - .field("field_path", &self.field_path) - .finish() - } -} -impl MaintenanceError { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MaintenanceError"; -} -impl MaintenanceError { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::field_path`] to `Some(value)`, consuming and returning `self`. - pub fn with_field_path( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.field_path = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(MaintenanceError); -impl ::buffa::MessageName for MaintenanceError { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MaintenanceError"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MaintenanceError"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MaintenanceError"; -} -impl ::buffa::Message for MaintenanceError { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.code.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.message) as u64; - if let Some(ref v) = self.field_path { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.code.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.message, buf); - if let Some(ref v) = self.field_path { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.code = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.message, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .field_path - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.code = ::buffa::EnumValue::from(0); - self.message.clear(); - self.field_path = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for MaintenanceError { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __MAINTENANCE_ERROR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MaintenanceError", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.migrate_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.migrate_session.__view.rs deleted file mode 100644 index 42674aa99..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.migrate_session.__view.rs +++ /dev/null @@ -1,1383 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/migrate_session.proto - -/// MigrateSession rewrites one session's stored events under a newer storage -/// schema, keeping the session's identity and its ordinals. -/// -/// Ordering of effects is fixed and not an implementation detail: record the -/// intent, stage the target, commit, validate. A process that dies at any point -/// leaves state that ReconcileMigration can classify, because the intent was -/// written before anything else was. -#[derive(Clone, Debug, Default)] -pub struct MigrateSessionRequestView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `target_schema_version` - pub target_schema_version: u32, - /// Field 3: `implementation_version` - pub implementation_version: &'a str, - /// Field 4: `actor` - pub actor: &'a str, - /// Field 5: `reason` - pub reason: &'a str, - /// Unset is PLAN_ONLY. The zero value is the one that writes nothing, so a - /// caller that forgets the field gets a plan instead of a rewrite. - /// - /// Field 6: `mode` - pub mode: ::core::option::Option<::buffa::EnumValue>, - /// The source boundary the caller already observed. A fleet orchestrator that - /// read the source sets this, and the migration refuses if the source has - /// moved since. Unset means the migration observes and pins the boundary - /// itself, which is correct for a single session and racy for a fleet run that - /// decided what to migrate minutes ago. - /// - /// Field 7: `expected_source` - pub expected_source: ::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'a>, - >, - /// Field 8: `limits` - pub limits: ::buffa::MessageFieldView< - super::super::__buffa::view::MigrationLimitsView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> MigrateSessionRequestView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `target_schema_version` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_target_schema_version(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `implementation_version` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_implementation_version(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `actor` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_actor(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for MigrateSessionRequestView<'a> { - type Owned = super::super::MigrateSessionRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.target_schema_version = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.implementation_version = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.actor = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.mode = Some( - ::buffa::EnumValue::from(::buffa::types::decode_int32(&mut cur)?), - ); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.expected_source.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.expected_source = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.limits.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.limits = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::MigrateSessionRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::MigrateSessionRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::MigrateSessionRequest { - session_id: self.session_id.to_string(), - target_schema_version: self.target_schema_version, - implementation_version: self.implementation_version.to_string(), - actor: self.actor.to_string(), - reason: self.reason.to_string(), - mode: self.mode, - expected_source: match self.expected_source.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::StreamBoundary, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - limits: match self.limits.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::MigrationLimits, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for MigrateSessionRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.target_schema_version) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.implementation_version) - as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.actor) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.reason) as u64; - if let Some(ref v) = self.mode { - size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; - } - if self.expected_source.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.expected_source.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.limits.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.limits.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_uint32_field(2u32, self.target_schema_version, buf); - ::buffa::types::put_string_field(3u32, &self.implementation_version, buf); - ::buffa::types::put_string_field(4u32, &self.actor, buf); - ::buffa::types::put_string_field(5u32, &self.reason, buf); - if let Some(ref v) = self.mode { - ::buffa::types::put_int32_field(6u32, v.to_i32(), buf); - } - if self.expected_source.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.expected_source.write_to(__cache, buf); - } - if self.limits.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.limits.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for MigrateSessionRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map - .serialize_entry( - "targetSchemaVersion", - &::buffa::json_helpers::ProtoJson(&self.target_schema_version), - )?; - } - { - __map.serialize_entry("implementationVersion", self.implementation_version)?; - } - { - __map.serialize_entry("actor", self.actor)?; - } - { - __map.serialize_entry("reason", self.reason)?; - } - if let ::core::option::Option::Some(ref __v) = self.mode { - __map.serialize_entry("mode", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.expected_source.as_option() { - __map.serialize_entry("expectedSource", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.limits.as_option() { - __map.serialize_entry("limits", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for MigrateSessionRequestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MigrateSessionRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MigrateSessionRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrateSessionRequest"; -} -::buffa::impl_default_view_instance!(MigrateSessionRequestView); -::buffa::impl_view_reborrow!(MigrateSessionRequestView); -/** Self-contained, `'static` owned view of a `MigrateSessionRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`MigrateSessionRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`MigrateSessionRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct MigrateSessionRequestOwnedView( - ::buffa::OwnedView>, -); -impl MigrateSessionRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrateSessionRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrateSessionRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::MigrateSessionRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrateSessionRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`MigrateSessionRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &MigrateSessionRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::MigrateSessionRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `target_schema_version` - #[must_use] - pub fn target_schema_version(&self) -> u32 { - self.0.reborrow().target_schema_version - } - /// Field 3: `implementation_version` - #[must_use] - pub fn implementation_version(&self) -> &'_ str { - self.0.reborrow().implementation_version - } - /// Field 4: `actor` - #[must_use] - pub fn actor(&self) -> &'_ str { - self.0.reborrow().actor - } - /// Field 5: `reason` - #[must_use] - pub fn reason(&self) -> &'_ str { - self.0.reborrow().reason - } - /// Unset is PLAN_ONLY. The zero value is the one that writes nothing, so a - /// caller that forgets the field gets a plan instead of a rewrite. - /// - /// Field 6: `mode` - #[must_use] - pub fn mode( - &self, - ) -> ::core::option::Option<::buffa::EnumValue> { - self.0.reborrow().mode - } - /// The source boundary the caller already observed. A fleet orchestrator that - /// read the source sets this, and the migration refuses if the source has - /// moved since. Unset means the migration observes and pins the boundary - /// itself, which is correct for a single session and racy for a fleet run that - /// decided what to migrate minutes ago. - /// - /// Field 7: `expected_source` - #[must_use] - pub fn expected_source( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'_>, - > { - &self.0.reborrow().expected_source - } - /// Field 8: `limits` - #[must_use] - pub fn limits( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::MigrationLimitsView<'_>, - > { - &self.0.reborrow().limits - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for MigrateSessionRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - MigrateSessionRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: MigrateSessionRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for MigrateSessionRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::MigrateSessionRequest { - type View<'a> = MigrateSessionRequestView<'a>; - type ViewHandle = MigrateSessionRequestOwnedView; -} -impl ::serde::Serialize for MigrateSessionRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// MigrationLimits bounds one call. A migration reads and rewrites an entire -/// stream, so an unbounded one on a large session is an outage. -#[derive(Clone, Debug, Default)] -pub struct MigrationLimitsView<'a> { - /// Field 1: `max_source_events` - pub max_source_events: ::core::option::Option, - /// Field 2: `max_source_bytes` - pub max_source_bytes: ::core::option::Option, - /// Field 3: `max_duration` - pub max_duration: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, -} -impl<'a> ::buffa::MessageView<'a> for MigrationLimitsView<'a> { - type Owned = super::super::MigrationLimits; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.max_source_events = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.max_source_bytes = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.max_duration.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.max_duration = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::MigrationLimits { - max_source_events: self.max_source_events, - max_source_bytes: self.max_source_bytes, - max_duration: match self.max_duration.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for MigrationLimitsView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(v) = self.max_source_events { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.max_source_bytes { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.max_duration.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.max_duration.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(v) = self.max_source_events { - ::buffa::types::put_uint64_field(1u32, v, buf); - } - if let Some(v) = self.max_source_bytes { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if self.max_duration.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.max_duration.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for MigrationLimitsView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - if let ::core::option::Option::Some(__v) = self.max_source_events { - __map - .serialize_entry( - "maxSourceEvents", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.max_source_bytes { - __map - .serialize_entry( - "maxSourceBytes", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.max_duration.as_option() { - __map.serialize_entry("maxDuration", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for MigrationLimitsView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MigrationLimits"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MigrationLimits"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationLimits"; -} -::buffa::impl_default_view_instance!(MigrationLimitsView); -::buffa::impl_view_reborrow!(MigrationLimitsView); -/** Self-contained, `'static` owned view of a `MigrationLimits` message. - - Wraps [`::buffa::OwnedView`]`<`[`MigrationLimitsView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`MigrationLimitsView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct MigrationLimitsOwnedView(::buffa::OwnedView>); -impl MigrationLimitsOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrationLimitsOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrationLimitsOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::MigrationLimits, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrationLimitsOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`MigrationLimitsView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &MigrationLimitsView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::MigrationLimits { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `max_source_events` - #[must_use] - pub fn max_source_events(&self) -> ::core::option::Option { - self.0.reborrow().max_source_events - } - /// Field 2: `max_source_bytes` - #[must_use] - pub fn max_source_bytes(&self) -> ::core::option::Option { - self.0.reborrow().max_source_bytes - } - /// Field 3: `max_duration` - #[must_use] - pub fn max_duration( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().max_duration - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for MigrationLimitsOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - MigrationLimitsOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: MigrationLimitsOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for MigrationLimitsOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::MigrationLimits { - type View<'a> = MigrationLimitsView<'a>; - type ViewHandle = MigrationLimitsOwnedView; -} -impl ::serde::Serialize for MigrationLimitsOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -#[derive(Clone, Debug, Default)] -pub struct MigrateSessionResponseView<'a> { - /// Field 1: `result` - pub result: ::buffa::EnumValue, - /// Always present, including on refusal: the record is what a later - /// reconciliation is run against, so a caller that cannot store it cannot - /// reconcile. - /// - /// Field 2: `record` - pub record: ::buffa::MessageFieldView< - super::super::__buffa::view::MigrationRecordView<'a>, - >, - /// Set only for MIGRATION_RESULT_NOT_ADMISSIBLE. - /// - /// Field 3: `not_admissible` - pub not_admissible: ::buffa::MessageFieldView< - super::super::__buffa::view::AdmissibilityDetailView<'a>, - >, - /// Field 4: `observed_at` - pub observed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> MigrateSessionResponseView<'a> { - /**Whether required field `result` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_result(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `record` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_record(&self) -> bool { - self.record.is_set() - } - /**Whether required field `observed_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_observed_at(&self) -> bool { - self.observed_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for MigrateSessionResponseView<'a> { - type Owned = super::super::MigrateSessionResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.result = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.record.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.record = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.not_admissible.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.not_admissible = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::MigrateSessionResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::MigrateSessionResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::MigrateSessionResponse { - result: self.result, - record: match self.record.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::MigrationRecord, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - not_admissible: match self.not_admissible.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::AdmissibilityDetail, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - observed_at: match self.observed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for MigrateSessionResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.result.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.record.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.record.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.not_admissible.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.not_admissible.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.result.to_i32(), buf); - if self.record.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.record.write_to(__cache, buf); - } - if self.not_admissible.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.not_admissible.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for MigrateSessionResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("result", &self.result)?; - } - { - if let ::core::option::Option::Some(__v) = self.record.as_option() { - __map.serialize_entry("record", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.not_admissible.as_option() { - __map.serialize_entry("notAdmissible", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.observed_at.as_option() { - __map.serialize_entry("observedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for MigrateSessionResponseView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MigrateSessionResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MigrateSessionResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrateSessionResponse"; -} -::buffa::impl_default_view_instance!(MigrateSessionResponseView); -::buffa::impl_view_reborrow!(MigrateSessionResponseView); -/** Self-contained, `'static` owned view of a `MigrateSessionResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`MigrateSessionResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`MigrateSessionResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct MigrateSessionResponseOwnedView( - ::buffa::OwnedView>, -); -impl MigrateSessionResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrateSessionResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrateSessionResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::MigrateSessionResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrateSessionResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`MigrateSessionResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &MigrateSessionResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::MigrateSessionResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `result` - #[must_use] - pub fn result(&self) -> ::buffa::EnumValue { - self.0.reborrow().result - } - /// Always present, including on refusal: the record is what a later - /// reconciliation is run against, so a caller that cannot store it cannot - /// reconcile. - /// - /// Field 2: `record` - #[must_use] - pub fn record( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::MigrationRecordView<'_>, - > { - &self.0.reborrow().record - } - /// Set only for MIGRATION_RESULT_NOT_ADMISSIBLE. - /// - /// Field 3: `not_admissible` - #[must_use] - pub fn not_admissible( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::AdmissibilityDetailView<'_>, - > { - &self.0.reborrow().not_admissible - } - /// Field 4: `observed_at` - #[must_use] - pub fn observed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().observed_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for MigrateSessionResponseOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - MigrateSessionResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: MigrateSessionResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for MigrateSessionResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::MigrateSessionResponse { - type View<'a> = MigrateSessionResponseView<'a>; - type ViewHandle = MigrateSessionResponseOwnedView; -} -impl ::serde::Serialize for MigrateSessionResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.migrate_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.migrate_session.rs deleted file mode 100644 index 0aefbeb40..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.migrate_session.rs +++ /dev/null @@ -1,870 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/migrate_session.proto - -/// MigrationMode is whether this call may write. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum MigrationMode { - MIGRATION_MODE_UNSPECIFIED = 0i32, - /// Validate admissibility, compute the intent, write nothing. - MIGRATION_MODE_PLAN_ONLY = 1i32, - MIGRATION_MODE_COMMIT = 2i32, -} -impl MigrationMode { - ///Idiomatic alias for [`Self::MIGRATION_MODE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::MIGRATION_MODE_UNSPECIFIED; - ///Idiomatic alias for [`Self::MIGRATION_MODE_PLAN_ONLY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const PlanOnly: Self = Self::MIGRATION_MODE_PLAN_ONLY; - ///Idiomatic alias for [`Self::MIGRATION_MODE_COMMIT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Commit: Self = Self::MIGRATION_MODE_COMMIT; -} -impl ::core::default::Default for MigrationMode { - fn default() -> Self { - Self::MIGRATION_MODE_UNSPECIFIED - } -} -impl ::serde::Serialize for MigrationMode { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for MigrationMode { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = MigrationMode; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(MigrationMode)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for MigrationMode { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for MigrationMode { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::MIGRATION_MODE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::MIGRATION_MODE_PLAN_ONLY), - 2i32 => ::core::option::Option::Some(Self::MIGRATION_MODE_COMMIT), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::MIGRATION_MODE_UNSPECIFIED => "MIGRATION_MODE_UNSPECIFIED", - Self::MIGRATION_MODE_PLAN_ONLY => "MIGRATION_MODE_PLAN_ONLY", - Self::MIGRATION_MODE_COMMIT => "MIGRATION_MODE_COMMIT", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "MIGRATION_MODE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::MIGRATION_MODE_UNSPECIFIED) - } - "MIGRATION_MODE_PLAN_ONLY" => { - ::core::option::Option::Some(Self::MIGRATION_MODE_PLAN_ONLY) - } - "MIGRATION_MODE_COMMIT" => { - ::core::option::Option::Some(Self::MIGRATION_MODE_COMMIT) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::MIGRATION_MODE_UNSPECIFIED, - Self::MIGRATION_MODE_PLAN_ONLY, - Self::MIGRATION_MODE_COMMIT, - ] - } -} -/// MigrateSession rewrites one session's stored events under a newer storage -/// schema, keeping the session's identity and its ordinals. -/// -/// Ordering of effects is fixed and not an implementation detail: record the -/// intent, stage the target, commit, validate. A process that dies at any point -/// leaves state that ReconcileMigration can classify, because the intent was -/// written before anything else was. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct MigrateSessionRequest { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `target_schema_version` - #[serde( - rename = "targetSchemaVersion", - alias = "target_schema_version", - with = "::buffa::json_helpers::uint32" - )] - pub target_schema_version: u32, - /// Field 3: `implementation_version` - #[serde( - rename = "implementationVersion", - alias = "implementation_version", - with = "::buffa::json_helpers::proto_string" - )] - pub implementation_version: ::buffa::alloc::string::String, - /// Field 4: `actor` - #[serde(rename = "actor", with = "::buffa::json_helpers::proto_string")] - pub actor: ::buffa::alloc::string::String, - /// Field 5: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_string")] - pub reason: ::buffa::alloc::string::String, - /// Unset is PLAN_ONLY. The zero value is the one that writes nothing, so a - /// caller that forgets the field gets a plan instead of a rewrite. - /// - /// Field 6: `mode` - #[serde( - rename = "mode", - with = "::buffa::json_helpers::opt_enum", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub mode: ::core::option::Option<::buffa::EnumValue>, - /// The source boundary the caller already observed. A fleet orchestrator that - /// read the source sets this, and the migration refuses if the source has - /// moved since. Unset means the migration observes and pins the boundary - /// itself, which is correct for a single session and racy for a fleet run that - /// decided what to migrate minutes ago. - /// - /// Field 7: `expected_source` - #[serde( - rename = "expectedSource", - alias = "expected_source", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub expected_source: ::buffa::MessageField< - StreamBoundary, - ::buffa::Inline, - >, - /// Field 8: `limits` - #[serde( - rename = "limits", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub limits: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for MigrateSessionRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("MigrateSessionRequest") - .field("session_id", &self.session_id) - .field("target_schema_version", &self.target_schema_version) - .field("implementation_version", &self.implementation_version) - .field("actor", &self.actor) - .field("reason", &self.reason) - .field("mode", &self.mode) - .field("expected_source", &self.expected_source) - .field("limits", &self.limits) - .finish() - } -} -impl MigrateSessionRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrateSessionRequest"; -} -impl MigrateSessionRequest { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::mode`] to `Some(value)`, consuming and returning `self`. - pub fn with_mode( - mut self, - value: impl Into<::buffa::EnumValue>, - ) -> Self { - self.mode = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(MigrateSessionRequest); -impl ::buffa::MessageName for MigrateSessionRequest { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MigrateSessionRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MigrateSessionRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrateSessionRequest"; -} -impl ::buffa::Message for MigrateSessionRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.target_schema_version) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.implementation_version) - as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.actor) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.reason) as u64; - if let Some(ref v) = self.mode { - size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; - } - if self.expected_source.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.expected_source.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.limits.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.limits.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_uint32_field(2u32, self.target_schema_version, buf); - ::buffa::types::put_string_field(3u32, &self.implementation_version, buf); - ::buffa::types::put_string_field(4u32, &self.actor, buf); - ::buffa::types::put_string_field(5u32, &self.reason, buf); - if let Some(ref v) = self.mode { - ::buffa::types::put_int32_field(6u32, v.to_i32(), buf); - } - if self.expected_source.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.expected_source.write_to(__cache, buf); - } - if self.limits.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.limits.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.target_schema_version = ::buffa::types::decode_uint32(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.implementation_version, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.actor, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.reason, buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.mode = ::core::option::Option::Some( - ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?), - ); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.expected_source.get_or_insert_default(), - buf, - ctx, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.limits.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.target_schema_version = 0u32; - self.implementation_version.clear(); - self.actor.clear(); - self.reason.clear(); - self.mode = ::core::option::Option::None; - self.expected_source = ::buffa::MessageField::none(); - self.limits = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for MigrateSessionRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __MIGRATE_SESSION_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrateSessionRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// MigrationLimits bounds one call. A migration reads and rewrites an entire -/// stream, so an unbounded one on a large session is an outage. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct MigrationLimits { - /// Field 1: `max_source_events` - #[serde( - rename = "maxSourceEvents", - alias = "max_source_events", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub max_source_events: ::core::option::Option, - /// Field 2: `max_source_bytes` - #[serde( - rename = "maxSourceBytes", - alias = "max_source_bytes", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub max_source_bytes: ::core::option::Option, - /// Field 3: `max_duration` - #[serde( - rename = "maxDuration", - alias = "max_duration", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub max_duration: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, -} -impl ::core::fmt::Debug for MigrationLimits { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("MigrationLimits") - .field("max_source_events", &self.max_source_events) - .field("max_source_bytes", &self.max_source_bytes) - .field("max_duration", &self.max_duration) - .finish() - } -} -impl MigrationLimits { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationLimits"; -} -impl MigrationLimits { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::max_source_events`] to `Some(value)`, consuming and returning `self`. - pub fn with_max_source_events(mut self, value: u64) -> Self { - self.max_source_events = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::max_source_bytes`] to `Some(value)`, consuming and returning `self`. - pub fn with_max_source_bytes(mut self, value: u64) -> Self { - self.max_source_bytes = Some(value); - self - } -} -::buffa::impl_default_instance!(MigrationLimits); -impl ::buffa::MessageName for MigrationLimits { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MigrationLimits"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MigrationLimits"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationLimits"; -} -impl ::buffa::Message for MigrationLimits { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(v) = self.max_source_events { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.max_source_bytes { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.max_duration.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.max_duration.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(v) = self.max_source_events { - ::buffa::types::put_uint64_field(1u32, v, buf); - } - if let Some(v) = self.max_source_bytes { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if self.max_duration.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.max_duration.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.max_source_events = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.max_source_bytes = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.max_duration.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.max_source_events = ::core::option::Option::None; - self.max_source_bytes = ::core::option::Option::None; - self.max_duration = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for MigrationLimits { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __MIGRATION_LIMITS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationLimits", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct MigrateSessionResponse { - /// Field 1: `result` - #[serde(rename = "result", with = "::buffa::json_helpers::proto_enum")] - pub result: ::buffa::EnumValue, - /// Always present, including on refusal: the record is what a later - /// reconciliation is run against, so a caller that cannot store it cannot - /// reconcile. - /// - /// Field 2: `record` - #[serde(rename = "record")] - pub record: ::buffa::MessageField>, - /// Set only for MIGRATION_RESULT_NOT_ADMISSIBLE. - /// - /// Field 3: `not_admissible` - #[serde( - rename = "notAdmissible", - alias = "not_admissible", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub not_admissible: ::buffa::MessageField< - AdmissibilityDetail, - ::buffa::Inline, - >, - /// Field 4: `observed_at` - #[serde(rename = "observedAt", alias = "observed_at")] - pub observed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for MigrateSessionResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("MigrateSessionResponse") - .field("result", &self.result) - .field("record", &self.record) - .field("not_admissible", &self.not_admissible) - .field("observed_at", &self.observed_at) - .finish() - } -} -impl MigrateSessionResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrateSessionResponse"; -} -::buffa::impl_default_instance!(MigrateSessionResponse); -impl ::buffa::MessageName for MigrateSessionResponse { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MigrateSessionResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MigrateSessionResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrateSessionResponse"; -} -impl ::buffa::Message for MigrateSessionResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.result.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.record.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.record.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.not_admissible.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.not_admissible.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.result.to_i32(), buf); - if self.record.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.record.write_to(__cache, buf); - } - if self.not_admissible.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.not_admissible.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.result = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.record.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.not_admissible.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.result = ::buffa::EnumValue::from(0); - self.record = ::buffa::MessageField::none(); - self.not_admissible = ::buffa::MessageField::none(); - self.observed_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for MigrateSessionResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __MIGRATE_SESSION_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrateSessionResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.migration.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.migration.__view.rs deleted file mode 100644 index 8ac009f2d..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.migration.__view.rs +++ /dev/null @@ -1,1976 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/migration.proto - -/// The durable record of a Session migration. -/// -/// A migration rewrites one session's stored events under a newer storage schema -/// and keeps the session's identity. Two rules make that safe, and both are -/// admissibility requirements rather than best effort: -/// -/// 1. Ordinals are preserved exactly. The target has the same event count as the -/// ```text -/// source, one transformed payload per source position. Inserting or removing -/// an event would renumber every following SessionOrdinal, and ordinals are -/// referenced from outside this stream: fork context boundaries on child -/// sessions, checkpoint evidence, consistency tokens, and page cursors would -/// all silently come to mean something else. -/// ``` -/// 2. The transformation is byte-deterministic. Given the same source bytes and -/// ```text -/// the same implementation_version, it produces the same target bytes. -/// ``` -/// -/// The second rule is what makes a lost commit acknowledgment recoverable: the -/// expected target digest can be written down before the commit, so a later look -/// at the target answers "did my write land" instead of "did some write land." -/// A transformation that cannot reproduce its own output is not a migration. It -/// is a salvage, and it must mint a new identity. -/// -/// MigrationIdentity is the retry identity of a migration. -/// -/// Two attempts sharing this tuple are the same migration and the second is -/// idempotent. Two attempts differing anywhere in it are different migrations, -/// and treating the second as a retry of the first is how a session gets -/// migrated twice. -#[derive(Clone, Debug, Default)] -pub struct MigrationIdentityView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Digest of the source cut. Part of identity because a migration of different - /// source content is a different migration even under the same version pair. - /// - /// Field 2: `source_digest` - pub source_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::ContentDigestView<'a>, - >, - /// Pins the transformation, including its encoder. Byte-determinism is scoped - /// to this value: a new encoder is a new implementation_version, because the - /// output bytes are part of what it promises. - /// - /// Field 3: `implementation_version` - pub implementation_version: &'a str, - /// Field 4: `source_schema_version` - pub source_schema_version: u32, - /// Field 5: `target_schema_version` - pub target_schema_version: u32, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> MigrationIdentityView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `source_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_digest(&self) -> bool { - self.source_digest.is_set() - } - /**Whether required field `implementation_version` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_implementation_version(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `source_schema_version` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_schema_version(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `target_schema_version` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_target_schema_version(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for MigrationIdentityView<'a> { - type Owned = super::super::MigrationIdentity; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.source_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.source_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.implementation_version = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.source_schema_version = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.target_schema_version = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::MigrationIdentity { - session_id: self.session_id.to_string(), - source_digest: match self.source_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContentDigest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - implementation_version: self.implementation_version.to_string(), - source_schema_version: self.source_schema_version, - target_schema_version: self.target_schema_version, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for MigrationIdentityView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.source_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.implementation_version) - as u64; - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.source_schema_version) as u64; - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.target_schema_version) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.source_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(3u32, &self.implementation_version, buf); - ::buffa::types::put_uint32_field(4u32, self.source_schema_version, buf); - ::buffa::types::put_uint32_field(5u32, self.target_schema_version, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for MigrationIdentityView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.source_digest.as_option() { - __map.serialize_entry("sourceDigest", __v)?; - } - } - { - __map.serialize_entry("implementationVersion", self.implementation_version)?; - } - { - __map - .serialize_entry( - "sourceSchemaVersion", - &::buffa::json_helpers::ProtoJson(&self.source_schema_version), - )?; - } - { - __map - .serialize_entry( - "targetSchemaVersion", - &::buffa::json_helpers::ProtoJson(&self.target_schema_version), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for MigrationIdentityView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MigrationIdentity"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MigrationIdentity"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationIdentity"; -} -::buffa::impl_default_view_instance!(MigrationIdentityView); -::buffa::impl_view_reborrow!(MigrationIdentityView); -/** Self-contained, `'static` owned view of a `MigrationIdentity` message. - - Wraps [`::buffa::OwnedView`]`<`[`MigrationIdentityView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`MigrationIdentityView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct MigrationIdentityOwnedView( - ::buffa::OwnedView>, -); -impl MigrationIdentityOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrationIdentityOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrationIdentityOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::MigrationIdentity, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrationIdentityOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`MigrationIdentityView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &MigrationIdentityView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::MigrationIdentity { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Digest of the source cut. Part of identity because a migration of different - /// source content is a different migration even under the same version pair. - /// - /// Field 2: `source_digest` - #[must_use] - pub fn source_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().source_digest - } - /// Pins the transformation, including its encoder. Byte-determinism is scoped - /// to this value: a new encoder is a new implementation_version, because the - /// output bytes are part of what it promises. - /// - /// Field 3: `implementation_version` - #[must_use] - pub fn implementation_version(&self) -> &'_ str { - self.0.reborrow().implementation_version - } - /// Field 4: `source_schema_version` - #[must_use] - pub fn source_schema_version(&self) -> u32 { - self.0.reborrow().source_schema_version - } - /// Field 5: `target_schema_version` - #[must_use] - pub fn target_schema_version(&self) -> u32 { - self.0.reborrow().target_schema_version - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for MigrationIdentityOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - MigrationIdentityOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: MigrationIdentityOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for MigrationIdentityOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::MigrationIdentity { - type View<'a> = MigrationIdentityView<'a>; - type ViewHandle = MigrationIdentityOwnedView; -} -impl ::serde::Serialize for MigrationIdentityOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// MigrationIntent is written durably before any target byte is written. -/// -/// This is the load-bearing record of the whole workflow. Reconciliation is a -/// comparison, and a comparison needs something recorded on the near side of the -/// crash. Without an intent, a process that dies mid-commit leaves a target that -/// nobody can attribute and nobody can safely replace. -#[derive(Clone, Debug, Default)] -pub struct MigrationIntentView<'a> { - /// Field 1: `identity` - pub identity: ::buffa::MessageFieldView< - super::super::__buffa::view::MigrationIdentityView<'a>, - >, - /// Field 2: `source` - pub source: ::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'a>, - >, - /// The boundary the target will have if the commit lands, computed before the - /// commit is attempted. `expected_target.ordinal` always equals - /// `source.ordinal`; a plan where they differ is not admissible. - /// - /// Field 3: `expected_target` - pub expected_target: ::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'a>, - >, - /// Field 4: `actor` - pub actor: &'a str, - /// Why this migration was run. A migration is a rewrite of durable history, - /// and an unattributed rewrite is not auditable. - /// - /// Field 5: `reason` - pub reason: &'a str, - /// Field 6: `planned_at` - pub planned_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> MigrationIntentView<'a> { - /**Whether required field `identity` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_identity(&self) -> bool { - self.identity.is_set() - } - /**Whether required field `source` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source(&self) -> bool { - self.source.is_set() - } - /**Whether required field `expected_target` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_expected_target(&self) -> bool { - self.expected_target.is_set() - } - /**Whether required field `actor` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_actor(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `planned_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_planned_at(&self) -> bool { - self.planned_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for MigrationIntentView<'a> { - type Owned = super::super::MigrationIntent; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.identity.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.identity = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.source.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.source = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.expected_target.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.expected_target = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.actor = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.planned_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.planned_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::MigrationIntent { - identity: match self.identity.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::MigrationIdentity, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - source: match self.source.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::StreamBoundary, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - expected_target: match self.expected_target.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::StreamBoundary, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - actor: self.actor.to_string(), - reason: self.reason.to_string(), - planned_at: match self.planned_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for MigrationIntentView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.identity.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.identity.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.source.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.expected_target.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.expected_target.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.actor) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.reason) as u64; - if self.planned_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.planned_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.identity.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.identity.write_to(__cache, buf); - } - if self.source.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source.write_to(__cache, buf); - } - if self.expected_target.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.expected_target.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.actor, buf); - ::buffa::types::put_string_field(5u32, &self.reason, buf); - if self.planned_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.planned_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for MigrationIntentView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.identity.as_option() { - __map.serialize_entry("identity", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.source.as_option() { - __map.serialize_entry("source", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.expected_target.as_option() { - __map.serialize_entry("expectedTarget", __v)?; - } - } - { - __map.serialize_entry("actor", self.actor)?; - } - { - __map.serialize_entry("reason", self.reason)?; - } - { - if let ::core::option::Option::Some(__v) = self.planned_at.as_option() { - __map.serialize_entry("plannedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for MigrationIntentView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MigrationIntent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MigrationIntent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationIntent"; -} -::buffa::impl_default_view_instance!(MigrationIntentView); -::buffa::impl_view_reborrow!(MigrationIntentView); -/** Self-contained, `'static` owned view of a `MigrationIntent` message. - - Wraps [`::buffa::OwnedView`]`<`[`MigrationIntentView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`MigrationIntentView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct MigrationIntentOwnedView(::buffa::OwnedView>); -impl MigrationIntentOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrationIntentOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrationIntentOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::MigrationIntent, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrationIntentOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`MigrationIntentView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &MigrationIntentView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::MigrationIntent { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `identity` - #[must_use] - pub fn identity( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::MigrationIdentityView<'_>, - > { - &self.0.reborrow().identity - } - /// Field 2: `source` - #[must_use] - pub fn source( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'_>, - > { - &self.0.reborrow().source - } - /// The boundary the target will have if the commit lands, computed before the - /// commit is attempted. `expected_target.ordinal` always equals - /// `source.ordinal`; a plan where they differ is not admissible. - /// - /// Field 3: `expected_target` - #[must_use] - pub fn expected_target( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'_>, - > { - &self.0.reborrow().expected_target - } - /// Field 4: `actor` - #[must_use] - pub fn actor(&self) -> &'_ str { - self.0.reborrow().actor - } - /// Why this migration was run. A migration is a rewrite of durable history, - /// and an unattributed rewrite is not auditable. - /// - /// Field 5: `reason` - #[must_use] - pub fn reason(&self) -> &'_ str { - self.0.reborrow().reason - } - /// Field 6: `planned_at` - #[must_use] - pub fn planned_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().planned_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for MigrationIntentOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - MigrationIntentOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: MigrationIntentOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for MigrationIntentOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::MigrationIntent { - type View<'a> = MigrationIntentView<'a>; - type ViewHandle = MigrationIntentOwnedView; -} -impl ::serde::Serialize for MigrationIntentOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// MigrationRecord is the intent plus everything learned since. -#[derive(Clone, Debug, Default)] -pub struct MigrationRecordView<'a> { - /// Field 1: `intent` - pub intent: ::buffa::MessageFieldView< - super::super::__buffa::view::MigrationIntentView<'a>, - >, - /// Field 2: `state` - pub state: ::buffa::EnumValue, - /// Set only for MAINTENANCE_STATE_INDETERMINATE. - /// - /// Field 3: `indeterminate` - pub indeterminate: ::buffa::MessageFieldView< - super::super::__buffa::view::IndeterminateDetailView<'a>, - >, - /// The target as actually observed. Unset before any commit was attempted, and - /// unset after a reconciliation that found no target. - /// - /// Field 4: `observed_target` - pub observed_target: ::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'a>, - >, - /// Attempts made under this identity. A rising count against an unchanged - /// state is the signal that a retry loop is not converging. - /// - /// Field 5: `attempt_count` - pub attempt_count: u32, - /// Field 6: `updated_at` - pub updated_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> MigrationRecordView<'a> { - /**Whether required field `intent` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_intent(&self) -> bool { - self.intent.is_set() - } - /**Whether required field `state` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_state(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `attempt_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_attempt_count(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `updated_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_updated_at(&self) -> bool { - self.updated_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for MigrationRecordView<'a> { - type Owned = super::super::MigrationRecord; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.intent.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.intent = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.state = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.indeterminate.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.indeterminate = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_target.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_target = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.attempt_count = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.updated_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.updated_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::MigrationRecord { - intent: match self.intent.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::MigrationIntent, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - state: self.state, - indeterminate: match self.indeterminate.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::IndeterminateDetail, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - observed_target: match self.observed_target.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::StreamBoundary, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - attempt_count: self.attempt_count, - updated_at: match self.updated_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for MigrationRecordView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.intent.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.intent.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.state.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.indeterminate.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.indeterminate.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_target.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_target.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.attempt_count) as u64; - if self.updated_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.updated_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.intent.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.intent.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(2u32, self.state.to_i32(), buf); - if self.indeterminate.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.indeterminate.write_to(__cache, buf); - } - if self.observed_target.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_target.write_to(__cache, buf); - } - ::buffa::types::put_uint32_field(5u32, self.attempt_count, buf); - if self.updated_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.updated_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for MigrationRecordView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.intent.as_option() { - __map.serialize_entry("intent", __v)?; - } - } - { - __map.serialize_entry("state", &self.state)?; - } - { - if let ::core::option::Option::Some(__v) = self.indeterminate.as_option() { - __map.serialize_entry("indeterminate", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.observed_target.as_option() { - __map.serialize_entry("observedTarget", __v)?; - } - } - { - __map - .serialize_entry( - "attemptCount", - &::buffa::json_helpers::ProtoJson(&self.attempt_count), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.updated_at.as_option() { - __map.serialize_entry("updatedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for MigrationRecordView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MigrationRecord"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MigrationRecord"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationRecord"; -} -::buffa::impl_default_view_instance!(MigrationRecordView); -::buffa::impl_view_reborrow!(MigrationRecordView); -/** Self-contained, `'static` owned view of a `MigrationRecord` message. - - Wraps [`::buffa::OwnedView`]`<`[`MigrationRecordView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`MigrationRecordView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct MigrationRecordOwnedView(::buffa::OwnedView>); -impl MigrationRecordOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrationRecordOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrationRecordOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::MigrationRecord, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MigrationRecordOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`MigrationRecordView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &MigrationRecordView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::MigrationRecord { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `intent` - #[must_use] - pub fn intent( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::MigrationIntentView<'_>, - > { - &self.0.reborrow().intent - } - /// Field 2: `state` - #[must_use] - pub fn state(&self) -> ::buffa::EnumValue { - self.0.reborrow().state - } - /// Set only for MAINTENANCE_STATE_INDETERMINATE. - /// - /// Field 3: `indeterminate` - #[must_use] - pub fn indeterminate( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::IndeterminateDetailView<'_>, - > { - &self.0.reborrow().indeterminate - } - /// The target as actually observed. Unset before any commit was attempted, and - /// unset after a reconciliation that found no target. - /// - /// Field 4: `observed_target` - #[must_use] - pub fn observed_target( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'_>, - > { - &self.0.reborrow().observed_target - } - /// Attempts made under this identity. A rising count against an unchanged - /// state is the signal that a retry loop is not converging. - /// - /// Field 5: `attempt_count` - #[must_use] - pub fn attempt_count(&self) -> u32 { - self.0.reborrow().attempt_count - } - /// Field 6: `updated_at` - #[must_use] - pub fn updated_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().updated_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for MigrationRecordOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - MigrationRecordOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: MigrationRecordOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for MigrationRecordOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::MigrationRecord { - type View<'a> = MigrationRecordView<'a>; - type ViewHandle = MigrationRecordOwnedView; -} -impl ::serde::Serialize for MigrationRecordOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// AdmissibilityDetail is why a migration was refused before writing anything. -/// -/// Every reason here is a reason to reach for salvage instead. A migration that -/// bends any of these rules keeps the session's identity while changing what its -/// ordinals mean, and nothing downstream would notice. -#[derive(Clone, Debug, Default)] -pub struct AdmissibilityDetailView<'a> { - /// Field 1: `reason` - pub reason: ::buffa::EnumValue, - /// The source position that triggered the refusal, where one did. - /// - /// Field 2: `ordinal` - pub ordinal: ::core::option::Option, - /// The source event type that triggered it, where one did. - /// - /// Field 3: `type_url` - pub type_url: ::core::option::Option<&'a str>, - /// Field 4: `detail` - pub detail: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> AdmissibilityDetailView<'a> { - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for AdmissibilityDetailView<'a> { - type Owned = super::super::AdmissibilityDetail; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.ordinal = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.type_url = Some(::buffa::types::borrow_str(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::AdmissibilityDetail, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::AdmissibilityDetail, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::AdmissibilityDetail { - reason: self.reason, - ordinal: self.ordinal, - type_url: self.type_url.map(|s| s.to_string()), - detail: self.detail.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for AdmissibilityDetailView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(v) = self.ordinal { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(ref v) = self.type_url { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - if let Some(v) = self.ordinal { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if let Some(ref v) = self.type_url { - ::buffa::types::put_string_field(3u32, v, buf); - } - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for AdmissibilityDetailView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("reason", &self.reason)?; - } - if let ::core::option::Option::Some(__v) = self.ordinal { - __map.serialize_entry("ordinal", &::buffa::json_helpers::ProtoJson(&__v))?; - } - if let ::core::option::Option::Some(__v) = self.type_url { - __map.serialize_entry("typeUrl", __v)?; - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for AdmissibilityDetailView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "AdmissibilityDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.AdmissibilityDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.AdmissibilityDetail"; -} -::buffa::impl_default_view_instance!(AdmissibilityDetailView); -::buffa::impl_view_reborrow!(AdmissibilityDetailView); -/** Self-contained, `'static` owned view of a `AdmissibilityDetail` message. - - Wraps [`::buffa::OwnedView`]`<`[`AdmissibilityDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`AdmissibilityDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct AdmissibilityDetailOwnedView( - ::buffa::OwnedView>, -); -impl AdmissibilityDetailOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AdmissibilityDetailOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AdmissibilityDetailOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::AdmissibilityDetail, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AdmissibilityDetailOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`AdmissibilityDetailView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &AdmissibilityDetailView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::AdmissibilityDetail { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// The source position that triggered the refusal, where one did. - /// - /// Field 2: `ordinal` - #[must_use] - pub fn ordinal(&self) -> ::core::option::Option { - self.0.reborrow().ordinal - } - /// The source event type that triggered it, where one did. - /// - /// Field 3: `type_url` - #[must_use] - pub fn type_url(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().type_url - } - /// Field 4: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for AdmissibilityDetailOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - AdmissibilityDetailOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: AdmissibilityDetailOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for AdmissibilityDetailOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::AdmissibilityDetail { - type View<'a> = AdmissibilityDetailView<'a>; - type ViewHandle = AdmissibilityDetailOwnedView; -} -impl ::serde::Serialize for AdmissibilityDetailOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.migration.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.migration.rs deleted file mode 100644 index 1336f53b2..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.migration.rs +++ /dev/null @@ -1,1478 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/migration.proto - -/// MigrationResult is the disposition of one MigrateSession call. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum MigrationResult { - MIGRATION_RESULT_UNSPECIFIED = 0i32, - /// This call performed the migration. - MIGRATION_RESULT_MIGRATED = 1i32, - /// The session was already at the target schema version and no work was - /// needed. Distinct from MIGRATED so a fleet run can report how much it - /// actually rewrote. - MIGRATION_RESULT_ALREADY_CURRENT = 2i32, - /// A prior attempt under this identity already committed. Reported instead of - /// MIGRATED so a retry never claims work it did not do, which is exactly the - /// claim the user's lost acknowledgment would otherwise produce. - MIGRATION_RESULT_ALREADY_MIGRATED = 3i32, - /// The plan was rejected before any write. Carries an AdmissibilityDetail. - MIGRATION_RESULT_NOT_ADMISSIBLE = 4i32, - /// The migration did not commit, and that is known. - MIGRATION_RESULT_FAILED = 5i32, - /// The outcome could not be classified. Carries an IndeterminateDetail on the - /// record. - MIGRATION_RESULT_INDETERMINATE = 6i32, - /// PLAN_ONLY: the plan is admissible and nothing was written. - MIGRATION_RESULT_WOULD_MIGRATE = 7i32, -} -impl MigrationResult { - ///Idiomatic alias for [`Self::MIGRATION_RESULT_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::MIGRATION_RESULT_UNSPECIFIED; - ///Idiomatic alias for [`Self::MIGRATION_RESULT_MIGRATED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Migrated: Self = Self::MIGRATION_RESULT_MIGRATED; - ///Idiomatic alias for [`Self::MIGRATION_RESULT_ALREADY_CURRENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const AlreadyCurrent: Self = Self::MIGRATION_RESULT_ALREADY_CURRENT; - ///Idiomatic alias for [`Self::MIGRATION_RESULT_ALREADY_MIGRATED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const AlreadyMigrated: Self = Self::MIGRATION_RESULT_ALREADY_MIGRATED; - ///Idiomatic alias for [`Self::MIGRATION_RESULT_NOT_ADMISSIBLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NotAdmissible: Self = Self::MIGRATION_RESULT_NOT_ADMISSIBLE; - ///Idiomatic alias for [`Self::MIGRATION_RESULT_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Failed: Self = Self::MIGRATION_RESULT_FAILED; - ///Idiomatic alias for [`Self::MIGRATION_RESULT_INDETERMINATE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Indeterminate: Self = Self::MIGRATION_RESULT_INDETERMINATE; - ///Idiomatic alias for [`Self::MIGRATION_RESULT_WOULD_MIGRATE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const WouldMigrate: Self = Self::MIGRATION_RESULT_WOULD_MIGRATE; -} -impl ::core::default::Default for MigrationResult { - fn default() -> Self { - Self::MIGRATION_RESULT_UNSPECIFIED - } -} -impl ::serde::Serialize for MigrationResult { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for MigrationResult { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = MigrationResult; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(MigrationResult) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for MigrationResult { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for MigrationResult { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::MIGRATION_RESULT_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::MIGRATION_RESULT_MIGRATED), - 2i32 => ::core::option::Option::Some(Self::MIGRATION_RESULT_ALREADY_CURRENT), - 3i32 => ::core::option::Option::Some(Self::MIGRATION_RESULT_ALREADY_MIGRATED), - 4i32 => ::core::option::Option::Some(Self::MIGRATION_RESULT_NOT_ADMISSIBLE), - 5i32 => ::core::option::Option::Some(Self::MIGRATION_RESULT_FAILED), - 6i32 => ::core::option::Option::Some(Self::MIGRATION_RESULT_INDETERMINATE), - 7i32 => ::core::option::Option::Some(Self::MIGRATION_RESULT_WOULD_MIGRATE), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::MIGRATION_RESULT_UNSPECIFIED => "MIGRATION_RESULT_UNSPECIFIED", - Self::MIGRATION_RESULT_MIGRATED => "MIGRATION_RESULT_MIGRATED", - Self::MIGRATION_RESULT_ALREADY_CURRENT => "MIGRATION_RESULT_ALREADY_CURRENT", - Self::MIGRATION_RESULT_ALREADY_MIGRATED => { - "MIGRATION_RESULT_ALREADY_MIGRATED" - } - Self::MIGRATION_RESULT_NOT_ADMISSIBLE => "MIGRATION_RESULT_NOT_ADMISSIBLE", - Self::MIGRATION_RESULT_FAILED => "MIGRATION_RESULT_FAILED", - Self::MIGRATION_RESULT_INDETERMINATE => "MIGRATION_RESULT_INDETERMINATE", - Self::MIGRATION_RESULT_WOULD_MIGRATE => "MIGRATION_RESULT_WOULD_MIGRATE", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "MIGRATION_RESULT_UNSPECIFIED" => { - ::core::option::Option::Some(Self::MIGRATION_RESULT_UNSPECIFIED) - } - "MIGRATION_RESULT_MIGRATED" => { - ::core::option::Option::Some(Self::MIGRATION_RESULT_MIGRATED) - } - "MIGRATION_RESULT_ALREADY_CURRENT" => { - ::core::option::Option::Some(Self::MIGRATION_RESULT_ALREADY_CURRENT) - } - "MIGRATION_RESULT_ALREADY_MIGRATED" => { - ::core::option::Option::Some(Self::MIGRATION_RESULT_ALREADY_MIGRATED) - } - "MIGRATION_RESULT_NOT_ADMISSIBLE" => { - ::core::option::Option::Some(Self::MIGRATION_RESULT_NOT_ADMISSIBLE) - } - "MIGRATION_RESULT_FAILED" => { - ::core::option::Option::Some(Self::MIGRATION_RESULT_FAILED) - } - "MIGRATION_RESULT_INDETERMINATE" => { - ::core::option::Option::Some(Self::MIGRATION_RESULT_INDETERMINATE) - } - "MIGRATION_RESULT_WOULD_MIGRATE" => { - ::core::option::Option::Some(Self::MIGRATION_RESULT_WOULD_MIGRATE) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::MIGRATION_RESULT_UNSPECIFIED, - Self::MIGRATION_RESULT_MIGRATED, - Self::MIGRATION_RESULT_ALREADY_CURRENT, - Self::MIGRATION_RESULT_ALREADY_MIGRATED, - Self::MIGRATION_RESULT_NOT_ADMISSIBLE, - Self::MIGRATION_RESULT_FAILED, - Self::MIGRATION_RESULT_INDETERMINATE, - Self::MIGRATION_RESULT_WOULD_MIGRATE, - ] - } -} -/// AdmissibilityReason is the specific rule a plan violated. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum AdmissibilityReason { - ADMISSIBILITY_REASON_UNSPECIFIED = 0i32, - /// An event type in the source has no representation in the target schema. - /// Dropping it would renumber ordinals, so the migration refuses. - ADMISSIBILITY_REASON_TYPE_REMOVED = 1i32, - /// An event decoded and carries a value the target schema cannot express. - ADMISSIBILITY_REASON_FIELD_UNREPRESENTABLE = 2i32, - /// Source bytes did not decode. A migration transforms events it understands; - /// recovering ones it does not is salvage. - ADMISSIBILITY_REASON_SOURCE_UNDECODABLE = 3i32, - /// The transformation could not commit to a reproducible output, so a retry - /// could not be distinguished from a divergence. - ADMISSIBILITY_REASON_NOT_BYTE_DETERMINISTIC = 4i32, - /// The source is larger than the limits allowed for a single operation. - ADMISSIBILITY_REASON_SIZE_LIMIT = 5i32, - /// The source is still being written to. A migration of a moving stream is a - /// migration of an arbitrary prefix. - ADMISSIBILITY_REASON_SOURCE_NOT_QUIESCED = 6i32, - /// Another maintenance operation holds this session. - ADMISSIBILITY_REASON_OPERATION_IN_PROGRESS = 7i32, -} -impl AdmissibilityReason { - ///Idiomatic alias for [`Self::ADMISSIBILITY_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::ADMISSIBILITY_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::ADMISSIBILITY_REASON_TYPE_REMOVED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const TypeRemoved: Self = Self::ADMISSIBILITY_REASON_TYPE_REMOVED; - ///Idiomatic alias for [`Self::ADMISSIBILITY_REASON_FIELD_UNREPRESENTABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const FieldUnrepresentable: Self = Self::ADMISSIBILITY_REASON_FIELD_UNREPRESENTABLE; - ///Idiomatic alias for [`Self::ADMISSIBILITY_REASON_SOURCE_UNDECODABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SourceUndecodable: Self = Self::ADMISSIBILITY_REASON_SOURCE_UNDECODABLE; - ///Idiomatic alias for [`Self::ADMISSIBILITY_REASON_NOT_BYTE_DETERMINISTIC`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NotByteDeterministic: Self = Self::ADMISSIBILITY_REASON_NOT_BYTE_DETERMINISTIC; - ///Idiomatic alias for [`Self::ADMISSIBILITY_REASON_SIZE_LIMIT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SizeLimit: Self = Self::ADMISSIBILITY_REASON_SIZE_LIMIT; - ///Idiomatic alias for [`Self::ADMISSIBILITY_REASON_SOURCE_NOT_QUIESCED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SourceNotQuiesced: Self = Self::ADMISSIBILITY_REASON_SOURCE_NOT_QUIESCED; - ///Idiomatic alias for [`Self::ADMISSIBILITY_REASON_OPERATION_IN_PROGRESS`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const OperationInProgress: Self = Self::ADMISSIBILITY_REASON_OPERATION_IN_PROGRESS; -} -impl ::core::default::Default for AdmissibilityReason { - fn default() -> Self { - Self::ADMISSIBILITY_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for AdmissibilityReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for AdmissibilityReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = AdmissibilityReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(AdmissibilityReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for AdmissibilityReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for AdmissibilityReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::ADMISSIBILITY_REASON_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::ADMISSIBILITY_REASON_TYPE_REMOVED), - 2i32 => { - ::core::option::Option::Some( - Self::ADMISSIBILITY_REASON_FIELD_UNREPRESENTABLE, - ) - } - 3i32 => { - ::core::option::Option::Some( - Self::ADMISSIBILITY_REASON_SOURCE_UNDECODABLE, - ) - } - 4i32 => { - ::core::option::Option::Some( - Self::ADMISSIBILITY_REASON_NOT_BYTE_DETERMINISTIC, - ) - } - 5i32 => ::core::option::Option::Some(Self::ADMISSIBILITY_REASON_SIZE_LIMIT), - 6i32 => { - ::core::option::Option::Some( - Self::ADMISSIBILITY_REASON_SOURCE_NOT_QUIESCED, - ) - } - 7i32 => { - ::core::option::Option::Some( - Self::ADMISSIBILITY_REASON_OPERATION_IN_PROGRESS, - ) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::ADMISSIBILITY_REASON_UNSPECIFIED => "ADMISSIBILITY_REASON_UNSPECIFIED", - Self::ADMISSIBILITY_REASON_TYPE_REMOVED => { - "ADMISSIBILITY_REASON_TYPE_REMOVED" - } - Self::ADMISSIBILITY_REASON_FIELD_UNREPRESENTABLE => { - "ADMISSIBILITY_REASON_FIELD_UNREPRESENTABLE" - } - Self::ADMISSIBILITY_REASON_SOURCE_UNDECODABLE => { - "ADMISSIBILITY_REASON_SOURCE_UNDECODABLE" - } - Self::ADMISSIBILITY_REASON_NOT_BYTE_DETERMINISTIC => { - "ADMISSIBILITY_REASON_NOT_BYTE_DETERMINISTIC" - } - Self::ADMISSIBILITY_REASON_SIZE_LIMIT => "ADMISSIBILITY_REASON_SIZE_LIMIT", - Self::ADMISSIBILITY_REASON_SOURCE_NOT_QUIESCED => { - "ADMISSIBILITY_REASON_SOURCE_NOT_QUIESCED" - } - Self::ADMISSIBILITY_REASON_OPERATION_IN_PROGRESS => { - "ADMISSIBILITY_REASON_OPERATION_IN_PROGRESS" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "ADMISSIBILITY_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::ADMISSIBILITY_REASON_UNSPECIFIED) - } - "ADMISSIBILITY_REASON_TYPE_REMOVED" => { - ::core::option::Option::Some(Self::ADMISSIBILITY_REASON_TYPE_REMOVED) - } - "ADMISSIBILITY_REASON_FIELD_UNREPRESENTABLE" => { - ::core::option::Option::Some( - Self::ADMISSIBILITY_REASON_FIELD_UNREPRESENTABLE, - ) - } - "ADMISSIBILITY_REASON_SOURCE_UNDECODABLE" => { - ::core::option::Option::Some( - Self::ADMISSIBILITY_REASON_SOURCE_UNDECODABLE, - ) - } - "ADMISSIBILITY_REASON_NOT_BYTE_DETERMINISTIC" => { - ::core::option::Option::Some( - Self::ADMISSIBILITY_REASON_NOT_BYTE_DETERMINISTIC, - ) - } - "ADMISSIBILITY_REASON_SIZE_LIMIT" => { - ::core::option::Option::Some(Self::ADMISSIBILITY_REASON_SIZE_LIMIT) - } - "ADMISSIBILITY_REASON_SOURCE_NOT_QUIESCED" => { - ::core::option::Option::Some( - Self::ADMISSIBILITY_REASON_SOURCE_NOT_QUIESCED, - ) - } - "ADMISSIBILITY_REASON_OPERATION_IN_PROGRESS" => { - ::core::option::Option::Some( - Self::ADMISSIBILITY_REASON_OPERATION_IN_PROGRESS, - ) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::ADMISSIBILITY_REASON_UNSPECIFIED, - Self::ADMISSIBILITY_REASON_TYPE_REMOVED, - Self::ADMISSIBILITY_REASON_FIELD_UNREPRESENTABLE, - Self::ADMISSIBILITY_REASON_SOURCE_UNDECODABLE, - Self::ADMISSIBILITY_REASON_NOT_BYTE_DETERMINISTIC, - Self::ADMISSIBILITY_REASON_SIZE_LIMIT, - Self::ADMISSIBILITY_REASON_SOURCE_NOT_QUIESCED, - Self::ADMISSIBILITY_REASON_OPERATION_IN_PROGRESS, - ] - } -} -/// The durable record of a Session migration. -/// -/// A migration rewrites one session's stored events under a newer storage schema -/// and keeps the session's identity. Two rules make that safe, and both are -/// admissibility requirements rather than best effort: -/// -/// 1. Ordinals are preserved exactly. The target has the same event count as the -/// ```text -/// source, one transformed payload per source position. Inserting or removing -/// an event would renumber every following SessionOrdinal, and ordinals are -/// referenced from outside this stream: fork context boundaries on child -/// sessions, checkpoint evidence, consistency tokens, and page cursors would -/// all silently come to mean something else. -/// ``` -/// 2. The transformation is byte-deterministic. Given the same source bytes and -/// ```text -/// the same implementation_version, it produces the same target bytes. -/// ``` -/// -/// The second rule is what makes a lost commit acknowledgment recoverable: the -/// expected target digest can be written down before the commit, so a later look -/// at the target answers "did my write land" instead of "did some write land." -/// A transformation that cannot reproduce its own output is not a migration. It -/// is a salvage, and it must mint a new identity. -/// -/// MigrationIdentity is the retry identity of a migration. -/// -/// Two attempts sharing this tuple are the same migration and the second is -/// idempotent. Two attempts differing anywhere in it are different migrations, -/// and treating the second as a retry of the first is how a session gets -/// migrated twice. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct MigrationIdentity { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Digest of the source cut. Part of identity because a migration of different - /// source content is a different migration even under the same version pair. - /// - /// Field 2: `source_digest` - #[serde(rename = "sourceDigest", alias = "source_digest")] - pub source_digest: ::buffa::MessageField< - ContentDigest, - ::buffa::Inline, - >, - /// Pins the transformation, including its encoder. Byte-determinism is scoped - /// to this value: a new encoder is a new implementation_version, because the - /// output bytes are part of what it promises. - /// - /// Field 3: `implementation_version` - #[serde( - rename = "implementationVersion", - alias = "implementation_version", - with = "::buffa::json_helpers::proto_string" - )] - pub implementation_version: ::buffa::alloc::string::String, - /// Field 4: `source_schema_version` - #[serde( - rename = "sourceSchemaVersion", - alias = "source_schema_version", - with = "::buffa::json_helpers::uint32" - )] - pub source_schema_version: u32, - /// Field 5: `target_schema_version` - #[serde( - rename = "targetSchemaVersion", - alias = "target_schema_version", - with = "::buffa::json_helpers::uint32" - )] - pub target_schema_version: u32, -} -impl ::core::fmt::Debug for MigrationIdentity { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("MigrationIdentity") - .field("session_id", &self.session_id) - .field("source_digest", &self.source_digest) - .field("implementation_version", &self.implementation_version) - .field("source_schema_version", &self.source_schema_version) - .field("target_schema_version", &self.target_schema_version) - .finish() - } -} -impl MigrationIdentity { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationIdentity"; -} -::buffa::impl_default_instance!(MigrationIdentity); -impl ::buffa::MessageName for MigrationIdentity { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MigrationIdentity"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MigrationIdentity"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationIdentity"; -} -impl ::buffa::Message for MigrationIdentity { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.source_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.implementation_version) - as u64; - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.source_schema_version) as u64; - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.target_schema_version) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.source_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(3u32, &self.implementation_version, buf); - ::buffa::types::put_uint32_field(4u32, self.source_schema_version, buf); - ::buffa::types::put_uint32_field(5u32, self.target_schema_version, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.source_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.implementation_version, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.source_schema_version = ::buffa::types::decode_uint32(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.target_schema_version = ::buffa::types::decode_uint32(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.source_digest = ::buffa::MessageField::none(); - self.implementation_version.clear(); - self.source_schema_version = 0u32; - self.target_schema_version = 0u32; - } -} -impl ::buffa::json_helpers::ProtoElemJson for MigrationIdentity { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __MIGRATION_IDENTITY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationIdentity", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// MigrationIntent is written durably before any target byte is written. -/// -/// This is the load-bearing record of the whole workflow. Reconciliation is a -/// comparison, and a comparison needs something recorded on the near side of the -/// crash. Without an intent, a process that dies mid-commit leaves a target that -/// nobody can attribute and nobody can safely replace. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct MigrationIntent { - /// Field 1: `identity` - #[serde(rename = "identity")] - pub identity: ::buffa::MessageField< - MigrationIdentity, - ::buffa::Inline, - >, - /// Field 2: `source` - #[serde(rename = "source")] - pub source: ::buffa::MessageField>, - /// The boundary the target will have if the commit lands, computed before the - /// commit is attempted. `expected_target.ordinal` always equals - /// `source.ordinal`; a plan where they differ is not admissible. - /// - /// Field 3: `expected_target` - #[serde(rename = "expectedTarget", alias = "expected_target")] - pub expected_target: ::buffa::MessageField< - StreamBoundary, - ::buffa::Inline, - >, - /// Field 4: `actor` - #[serde(rename = "actor", with = "::buffa::json_helpers::proto_string")] - pub actor: ::buffa::alloc::string::String, - /// Why this migration was run. A migration is a rewrite of durable history, - /// and an unattributed rewrite is not auditable. - /// - /// Field 5: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_string")] - pub reason: ::buffa::alloc::string::String, - /// Field 6: `planned_at` - #[serde(rename = "plannedAt", alias = "planned_at")] - pub planned_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for MigrationIntent { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("MigrationIntent") - .field("identity", &self.identity) - .field("source", &self.source) - .field("expected_target", &self.expected_target) - .field("actor", &self.actor) - .field("reason", &self.reason) - .field("planned_at", &self.planned_at) - .finish() - } -} -impl MigrationIntent { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationIntent"; -} -::buffa::impl_default_instance!(MigrationIntent); -impl ::buffa::MessageName for MigrationIntent { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MigrationIntent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MigrationIntent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationIntent"; -} -impl ::buffa::Message for MigrationIntent { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.identity.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.identity.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.source.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.expected_target.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.expected_target.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.actor) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.reason) as u64; - if self.planned_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.planned_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.identity.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.identity.write_to(__cache, buf); - } - if self.source.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source.write_to(__cache, buf); - } - if self.expected_target.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.expected_target.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.actor, buf); - ::buffa::types::put_string_field(5u32, &self.reason, buf); - if self.planned_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.planned_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.identity.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.source.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.expected_target.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.actor, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.reason, buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.planned_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.identity = ::buffa::MessageField::none(); - self.source = ::buffa::MessageField::none(); - self.expected_target = ::buffa::MessageField::none(); - self.actor.clear(); - self.reason.clear(); - self.planned_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for MigrationIntent { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __MIGRATION_INTENT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationIntent", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// MigrationRecord is the intent plus everything learned since. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct MigrationRecord { - /// Field 1: `intent` - #[serde(rename = "intent")] - pub intent: ::buffa::MessageField>, - /// Field 2: `state` - #[serde(rename = "state", with = "::buffa::json_helpers::proto_enum")] - pub state: ::buffa::EnumValue, - /// Set only for MAINTENANCE_STATE_INDETERMINATE. - /// - /// Field 3: `indeterminate` - #[serde( - rename = "indeterminate", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub indeterminate: ::buffa::MessageField< - IndeterminateDetail, - ::buffa::Inline, - >, - /// The target as actually observed. Unset before any commit was attempted, and - /// unset after a reconciliation that found no target. - /// - /// Field 4: `observed_target` - #[serde( - rename = "observedTarget", - alias = "observed_target", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub observed_target: ::buffa::MessageField< - StreamBoundary, - ::buffa::Inline, - >, - /// Attempts made under this identity. A rising count against an unchanged - /// state is the signal that a retry loop is not converging. - /// - /// Field 5: `attempt_count` - #[serde( - rename = "attemptCount", - alias = "attempt_count", - with = "::buffa::json_helpers::uint32" - )] - pub attempt_count: u32, - /// Field 6: `updated_at` - #[serde(rename = "updatedAt", alias = "updated_at")] - pub updated_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for MigrationRecord { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("MigrationRecord") - .field("intent", &self.intent) - .field("state", &self.state) - .field("indeterminate", &self.indeterminate) - .field("observed_target", &self.observed_target) - .field("attempt_count", &self.attempt_count) - .field("updated_at", &self.updated_at) - .finish() - } -} -impl MigrationRecord { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationRecord"; -} -::buffa::impl_default_instance!(MigrationRecord); -impl ::buffa::MessageName for MigrationRecord { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "MigrationRecord"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.MigrationRecord"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationRecord"; -} -impl ::buffa::Message for MigrationRecord { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.intent.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.intent.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.state.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.indeterminate.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.indeterminate.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_target.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_target.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.attempt_count) as u64; - if self.updated_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.updated_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.intent.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.intent.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(2u32, self.state.to_i32(), buf); - if self.indeterminate.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.indeterminate.write_to(__cache, buf); - } - if self.observed_target.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_target.write_to(__cache, buf); - } - ::buffa::types::put_uint32_field(5u32, self.attempt_count, buf); - if self.updated_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.updated_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.intent.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.state = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.indeterminate.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_target.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.attempt_count = ::buffa::types::decode_uint32(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.updated_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.intent = ::buffa::MessageField::none(); - self.state = ::buffa::EnumValue::from(0); - self.indeterminate = ::buffa::MessageField::none(); - self.observed_target = ::buffa::MessageField::none(); - self.attempt_count = 0u32; - self.updated_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for MigrationRecord { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __MIGRATION_RECORD_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.MigrationRecord", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// AdmissibilityDetail is why a migration was refused before writing anything. -/// -/// Every reason here is a reason to reach for salvage instead. A migration that -/// bends any of these rules keeps the session's identity while changing what its -/// ordinals mean, and nothing downstream would notice. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct AdmissibilityDetail { - /// Field 1: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// The source position that triggered the refusal, where one did. - /// - /// Field 2: `ordinal` - #[serde( - rename = "ordinal", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub ordinal: ::core::option::Option, - /// The source event type that triggered it, where one did. - /// - /// Field 3: `type_url` - #[serde( - rename = "typeUrl", - alias = "type_url", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub type_url: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 4: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for AdmissibilityDetail { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("AdmissibilityDetail") - .field("reason", &self.reason) - .field("ordinal", &self.ordinal) - .field("type_url", &self.type_url) - .field("detail", &self.detail) - .finish() - } -} -impl AdmissibilityDetail { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.AdmissibilityDetail"; -} -impl AdmissibilityDetail { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::ordinal`] to `Some(value)`, consuming and returning `self`. - pub fn with_ordinal(mut self, value: u64) -> Self { - self.ordinal = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::type_url`] to `Some(value)`, consuming and returning `self`. - pub fn with_type_url( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.type_url = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(AdmissibilityDetail); -impl ::buffa::MessageName for AdmissibilityDetail { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "AdmissibilityDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.AdmissibilityDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.AdmissibilityDetail"; -} -impl ::buffa::Message for AdmissibilityDetail { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(v) = self.ordinal { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(ref v) = self.type_url { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - if let Some(v) = self.ordinal { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if let Some(ref v) = self.type_url { - ::buffa::types::put_string_field(3u32, v, buf); - } - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.ordinal = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .type_url - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.reason = ::buffa::EnumValue::from(0); - self.ordinal = ::core::option::Option::None; - self.type_url = ::core::option::Option::None; - self.detail = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for AdmissibilityDetail { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ADMISSIBILITY_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.AdmissibilityDetail", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.mod.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.mod.rs deleted file mode 100644 index 7967426ad..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.mod.rs +++ /dev/null @@ -1,157 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. - -include!("trogonai.session.sessions.maintenance.v1alpha1.maintenance_error.rs"); -include!("trogonai.session.sessions.maintenance.v1alpha1.stream_boundary.rs"); -include!("trogonai.session.sessions.maintenance.v1alpha1.outcome.rs"); -include!("trogonai.session.sessions.maintenance.v1alpha1.migration.rs"); -include!("trogonai.session.sessions.maintenance.v1alpha1.migrate_session.rs"); -include!("trogonai.session.sessions.maintenance.v1alpha1.reconcile_migration.rs"); -include!("trogonai.session.sessions.maintenance.v1alpha1.salvage.rs"); -include!("trogonai.session.sessions.maintenance.v1alpha1.salvage_session.rs"); -#[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception -)] -pub mod __buffa { - #[allow(unused_imports)] - use super::*; - pub mod view { - #[allow(unused_imports)] - use super::*; - include!( - "trogonai.session.sessions.maintenance.v1alpha1.maintenance_error.__view.rs" - ); - include!( - "trogonai.session.sessions.maintenance.v1alpha1.stream_boundary.__view.rs" - ); - include!("trogonai.session.sessions.maintenance.v1alpha1.outcome.__view.rs"); - include!("trogonai.session.sessions.maintenance.v1alpha1.migration.__view.rs"); - include!( - "trogonai.session.sessions.maintenance.v1alpha1.migrate_session.__view.rs" - ); - include!( - "trogonai.session.sessions.maintenance.v1alpha1.reconcile_migration.__view.rs" - ); - include!("trogonai.session.sessions.maintenance.v1alpha1.salvage.__view.rs"); - include!( - "trogonai.session.sessions.maintenance.v1alpha1.salvage_session.__view.rs" - ); - } - /// Register this package's `Any` type entries and extension entries. - pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) { - reg.register_json_any(super::__MAINTENANCE_ERROR_JSON_ANY); - reg.register_json_any(super::__STREAM_BOUNDARY_JSON_ANY); - reg.register_json_any(super::__CONTENT_DIGEST_JSON_ANY); - reg.register_json_any(super::__INDETERMINATE_DETAIL_JSON_ANY); - reg.register_json_any(super::__MIGRATION_IDENTITY_JSON_ANY); - reg.register_json_any(super::__MIGRATION_INTENT_JSON_ANY); - reg.register_json_any(super::__MIGRATION_RECORD_JSON_ANY); - reg.register_json_any(super::__ADMISSIBILITY_DETAIL_JSON_ANY); - reg.register_json_any(super::__MIGRATE_SESSION_REQUEST_JSON_ANY); - reg.register_json_any(super::__MIGRATION_LIMITS_JSON_ANY); - reg.register_json_any(super::__MIGRATE_SESSION_RESPONSE_JSON_ANY); - reg.register_json_any(super::__RECONCILE_MIGRATION_REQUEST_JSON_ANY); - reg.register_json_any(super::__RECONCILE_MIGRATION_RESPONSE_JSON_ANY); - reg.register_json_any(super::__SALVAGE_IDENTITY_JSON_ANY); - reg.register_json_any(super::__SALVAGE_INTENT_JSON_ANY); - reg.register_json_any(super::__SALVAGE_RECORD_JSON_ANY); - reg.register_json_any(super::__OMITTED_ITEM_JSON_ANY); - reg.register_json_any(super::__REFUSAL_DETAIL_JSON_ANY); - reg.register_json_any(super::__SALVAGE_SESSION_REQUEST_JSON_ANY); - reg.register_json_any(super::__SALVAGE_LIMITS_JSON_ANY); - reg.register_json_any(super::__SALVAGE_SESSION_RESPONSE_JSON_ANY); - } -} -#[doc(inline)] -pub use self::__buffa::view::MaintenanceErrorView; -#[doc(inline)] -pub use self::__buffa::view::MaintenanceErrorOwnedView; -#[doc(inline)] -pub use self::__buffa::view::StreamBoundaryView; -#[doc(inline)] -pub use self::__buffa::view::StreamBoundaryOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ContentDigestView; -#[doc(inline)] -pub use self::__buffa::view::ContentDigestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::IndeterminateDetailView; -#[doc(inline)] -pub use self::__buffa::view::IndeterminateDetailOwnedView; -#[doc(inline)] -pub use self::__buffa::view::MigrationIdentityView; -#[doc(inline)] -pub use self::__buffa::view::MigrationIdentityOwnedView; -#[doc(inline)] -pub use self::__buffa::view::MigrationIntentView; -#[doc(inline)] -pub use self::__buffa::view::MigrationIntentOwnedView; -#[doc(inline)] -pub use self::__buffa::view::MigrationRecordView; -#[doc(inline)] -pub use self::__buffa::view::MigrationRecordOwnedView; -#[doc(inline)] -pub use self::__buffa::view::AdmissibilityDetailView; -#[doc(inline)] -pub use self::__buffa::view::AdmissibilityDetailOwnedView; -#[doc(inline)] -pub use self::__buffa::view::MigrateSessionRequestView; -#[doc(inline)] -pub use self::__buffa::view::MigrateSessionRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::MigrationLimitsView; -#[doc(inline)] -pub use self::__buffa::view::MigrationLimitsOwnedView; -#[doc(inline)] -pub use self::__buffa::view::MigrateSessionResponseView; -#[doc(inline)] -pub use self::__buffa::view::MigrateSessionResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReconcileMigrationRequestView; -#[doc(inline)] -pub use self::__buffa::view::ReconcileMigrationRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReconcileMigrationResponseView; -#[doc(inline)] -pub use self::__buffa::view::ReconcileMigrationResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SalvageIdentityView; -#[doc(inline)] -pub use self::__buffa::view::SalvageIdentityOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SalvageIntentView; -#[doc(inline)] -pub use self::__buffa::view::SalvageIntentOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SalvageRecordView; -#[doc(inline)] -pub use self::__buffa::view::SalvageRecordOwnedView; -#[doc(inline)] -pub use self::__buffa::view::OmittedItemView; -#[doc(inline)] -pub use self::__buffa::view::OmittedItemOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RefusalDetailView; -#[doc(inline)] -pub use self::__buffa::view::RefusalDetailOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SalvageSessionRequestView; -#[doc(inline)] -pub use self::__buffa::view::SalvageSessionRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SalvageLimitsView; -#[doc(inline)] -pub use self::__buffa::view::SalvageLimitsOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SalvageSessionResponseView; -#[doc(inline)] -pub use self::__buffa::view::SalvageSessionResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::register_types; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.outcome.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.outcome.__view.rs deleted file mode 100644 index 4b04fa138..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.outcome.__view.rs +++ /dev/null @@ -1,438 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/outcome.proto - -/// IndeterminateDetail is why an outcome could not be classified. -/// -/// COMMIT_UNKNOWN and INDETERMINATE are deliberately different states. -/// COMMIT_UNKNOWN says nobody has looked yet, and looking is a mechanical step -/// the workflow performs on its own. INDETERMINATE says the workflow looked and -/// the evidence does not decide. Indeterminate is a conclusion, not the absence -/// of one, and collapsing the two would make an unattended retry loop -/// indistinguishable from a problem that needs a human. -#[derive(Clone, Debug, Default)] -pub struct IndeterminateDetailView<'a> { - /// Field 1: `reason` - pub reason: ::buffa::EnumValue, - /// What the intent said should be there. - /// - /// Field 2: `expected` - pub expected: ::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'a>, - >, - /// What was found. Unset means nothing was found, which is a different fact - /// from finding an empty stream, and the two lead to opposite actions. - /// - /// Field 3: `observed` - pub observed: ::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'a>, - >, - /// For an operator. Never parsed. - /// - /// Field 4: `detail` - pub detail: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> IndeterminateDetailView<'a> { - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for IndeterminateDetailView<'a> { - type Owned = super::super::IndeterminateDetail; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.expected.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.expected = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::IndeterminateDetail, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::IndeterminateDetail, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::IndeterminateDetail { - reason: self.reason, - expected: match self.expected.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::StreamBoundary, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - observed: match self.observed.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::StreamBoundary, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - detail: self.detail.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for IndeterminateDetailView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.expected.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.expected.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - if self.expected.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.expected.write_to(__cache, buf); - } - if self.observed.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed.write_to(__cache, buf); - } - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for IndeterminateDetailView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("reason", &self.reason)?; - } - { - if let ::core::option::Option::Some(__v) = self.expected.as_option() { - __map.serialize_entry("expected", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.observed.as_option() { - __map.serialize_entry("observed", __v)?; - } - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for IndeterminateDetailView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "IndeterminateDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.IndeterminateDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.IndeterminateDetail"; -} -::buffa::impl_default_view_instance!(IndeterminateDetailView); -::buffa::impl_view_reborrow!(IndeterminateDetailView); -/** Self-contained, `'static` owned view of a `IndeterminateDetail` message. - - Wraps [`::buffa::OwnedView`]`<`[`IndeterminateDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`IndeterminateDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct IndeterminateDetailOwnedView( - ::buffa::OwnedView>, -); -impl IndeterminateDetailOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - IndeterminateDetailOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - IndeterminateDetailOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::IndeterminateDetail, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - IndeterminateDetailOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`IndeterminateDetailView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &IndeterminateDetailView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::IndeterminateDetail { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// What the intent said should be there. - /// - /// Field 2: `expected` - #[must_use] - pub fn expected( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'_>, - > { - &self.0.reborrow().expected - } - /// What was found. Unset means nothing was found, which is a different fact - /// from finding an empty stream, and the two lead to opposite actions. - /// - /// Field 3: `observed` - #[must_use] - pub fn observed( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'_>, - > { - &self.0.reborrow().observed - } - /// For an operator. Never parsed. - /// - /// Field 4: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for IndeterminateDetailOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - IndeterminateDetailOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: IndeterminateDetailOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for IndeterminateDetailOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::IndeterminateDetail { - type View<'a> = IndeterminateDetailView<'a>; - type ViewHandle = IndeterminateDetailOwnedView; -} -impl ::serde::Serialize for IndeterminateDetailOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.outcome.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.outcome.rs deleted file mode 100644 index aac698bca..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.outcome.rs +++ /dev/null @@ -1,711 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/outcome.proto - -/// MaintenanceState is the lifecycle shared by migration and salvage. -/// -/// The two workflows differ in almost everything else and share this because -/// they share the same crash-exposed middle: durable work that is staged but not -/// yet authoritative, and a commit whose acknowledgment can be lost after the -/// commit itself succeeded. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum MaintenanceState { - MAINTENANCE_STATE_UNSPECIFIED = 0i32, - /// The intent is durable and no target write has been attempted. Recovering - /// from a crash here is free: nothing was written. - MAINTENANCE_STATE_PLANNED = 1i32, - /// Target content exists and is not yet the authoritative answer. - MAINTENANCE_STATE_STAGED = 2i32, - /// A commit was attempted and its outcome is not known. This is where a lost - /// acknowledgment lands. It is neither success nor failure, and the whole - /// reason the intent is written first is so this state can be left. - MAINTENANCE_STATE_COMMIT_UNKNOWN = 3i32, - MAINTENANCE_STATE_COMMITTED = 4i32, - /// The committed target was read back and matched the intent. - MAINTENANCE_STATE_VALIDATED = 5i32, - /// The workflow ended without committing, and that is known. - MAINTENANCE_STATE_FAILED = 6i32, - /// Reconciliation ran and could not classify the outcome. Terminal until an - /// operator acts. - MAINTENANCE_STATE_INDETERMINATE = 7i32, -} -impl MaintenanceState { - ///Idiomatic alias for [`Self::MAINTENANCE_STATE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::MAINTENANCE_STATE_UNSPECIFIED; - ///Idiomatic alias for [`Self::MAINTENANCE_STATE_PLANNED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Planned: Self = Self::MAINTENANCE_STATE_PLANNED; - ///Idiomatic alias for [`Self::MAINTENANCE_STATE_STAGED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Staged: Self = Self::MAINTENANCE_STATE_STAGED; - ///Idiomatic alias for [`Self::MAINTENANCE_STATE_COMMIT_UNKNOWN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const CommitUnknown: Self = Self::MAINTENANCE_STATE_COMMIT_UNKNOWN; - ///Idiomatic alias for [`Self::MAINTENANCE_STATE_COMMITTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Committed: Self = Self::MAINTENANCE_STATE_COMMITTED; - ///Idiomatic alias for [`Self::MAINTENANCE_STATE_VALIDATED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Validated: Self = Self::MAINTENANCE_STATE_VALIDATED; - ///Idiomatic alias for [`Self::MAINTENANCE_STATE_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Failed: Self = Self::MAINTENANCE_STATE_FAILED; - ///Idiomatic alias for [`Self::MAINTENANCE_STATE_INDETERMINATE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Indeterminate: Self = Self::MAINTENANCE_STATE_INDETERMINATE; -} -impl ::core::default::Default for MaintenanceState { - fn default() -> Self { - Self::MAINTENANCE_STATE_UNSPECIFIED - } -} -impl ::serde::Serialize for MaintenanceState { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for MaintenanceState { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = MaintenanceState; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(MaintenanceState) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for MaintenanceState { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for MaintenanceState { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::MAINTENANCE_STATE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::MAINTENANCE_STATE_PLANNED), - 2i32 => ::core::option::Option::Some(Self::MAINTENANCE_STATE_STAGED), - 3i32 => ::core::option::Option::Some(Self::MAINTENANCE_STATE_COMMIT_UNKNOWN), - 4i32 => ::core::option::Option::Some(Self::MAINTENANCE_STATE_COMMITTED), - 5i32 => ::core::option::Option::Some(Self::MAINTENANCE_STATE_VALIDATED), - 6i32 => ::core::option::Option::Some(Self::MAINTENANCE_STATE_FAILED), - 7i32 => ::core::option::Option::Some(Self::MAINTENANCE_STATE_INDETERMINATE), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::MAINTENANCE_STATE_UNSPECIFIED => "MAINTENANCE_STATE_UNSPECIFIED", - Self::MAINTENANCE_STATE_PLANNED => "MAINTENANCE_STATE_PLANNED", - Self::MAINTENANCE_STATE_STAGED => "MAINTENANCE_STATE_STAGED", - Self::MAINTENANCE_STATE_COMMIT_UNKNOWN => "MAINTENANCE_STATE_COMMIT_UNKNOWN", - Self::MAINTENANCE_STATE_COMMITTED => "MAINTENANCE_STATE_COMMITTED", - Self::MAINTENANCE_STATE_VALIDATED => "MAINTENANCE_STATE_VALIDATED", - Self::MAINTENANCE_STATE_FAILED => "MAINTENANCE_STATE_FAILED", - Self::MAINTENANCE_STATE_INDETERMINATE => "MAINTENANCE_STATE_INDETERMINATE", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "MAINTENANCE_STATE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::MAINTENANCE_STATE_UNSPECIFIED) - } - "MAINTENANCE_STATE_PLANNED" => { - ::core::option::Option::Some(Self::MAINTENANCE_STATE_PLANNED) - } - "MAINTENANCE_STATE_STAGED" => { - ::core::option::Option::Some(Self::MAINTENANCE_STATE_STAGED) - } - "MAINTENANCE_STATE_COMMIT_UNKNOWN" => { - ::core::option::Option::Some(Self::MAINTENANCE_STATE_COMMIT_UNKNOWN) - } - "MAINTENANCE_STATE_COMMITTED" => { - ::core::option::Option::Some(Self::MAINTENANCE_STATE_COMMITTED) - } - "MAINTENANCE_STATE_VALIDATED" => { - ::core::option::Option::Some(Self::MAINTENANCE_STATE_VALIDATED) - } - "MAINTENANCE_STATE_FAILED" => { - ::core::option::Option::Some(Self::MAINTENANCE_STATE_FAILED) - } - "MAINTENANCE_STATE_INDETERMINATE" => { - ::core::option::Option::Some(Self::MAINTENANCE_STATE_INDETERMINATE) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::MAINTENANCE_STATE_UNSPECIFIED, - Self::MAINTENANCE_STATE_PLANNED, - Self::MAINTENANCE_STATE_STAGED, - Self::MAINTENANCE_STATE_COMMIT_UNKNOWN, - Self::MAINTENANCE_STATE_COMMITTED, - Self::MAINTENANCE_STATE_VALIDATED, - Self::MAINTENANCE_STATE_FAILED, - Self::MAINTENANCE_STATE_INDETERMINATE, - ] - } -} -/// IndeterminateReason is the specific evidence gap. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum IndeterminateReason { - INDETERMINATE_REASON_UNSPECIFIED = 0i32, - /// A target exists where the intent said one would, and its content is not the - /// content this operation would have produced. Either something else wrote it - /// or a prior attempt wrote a truncated copy. Never overwrite: this is the one - /// reason that most invites a "just run it again" reflex and most punishes it. - INDETERMINATE_REASON_TARGET_CONTENT_MISMATCH = 1i32, - /// The target exists and could not be read well enough to compare. Unreadable - /// is not absent, so nothing may be written on the strength of it. - INDETERMINATE_REASON_TARGET_UNREADABLE = 2i32, - /// The source advanced between the intent and the commit, so the staged target - /// is a transformation of a prefix. Committing it would silently discard every - /// event appended in between. - INDETERMINATE_REASON_SOURCE_ADVANCED = 3i32, - /// The source is no longer the stream incarnation the intent was cut from. - INDETERMINATE_REASON_SOURCE_INCARNATION_CHANGED = 4i32, - /// The authoritative order of source events could not be established. - INDETERMINATE_REASON_ORDER_UNPROVEN = 5i32, - /// Exclusive ownership of the target could not be proven, so a commit might - /// overwrite a concurrent writer. - INDETERMINATE_REASON_OWNERSHIP_UNPROVEN = 6i32, - /// No intent record was found for an operation that durable state shows was - /// started. There is nothing to compare against, which is what skipping the - /// intent-first rule costs. Named so its absence is a reportable condition - /// rather than a mystery. - INDETERMINATE_REASON_INTENT_MISSING = 7i32, -} -impl IndeterminateReason { - ///Idiomatic alias for [`Self::INDETERMINATE_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::INDETERMINATE_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::INDETERMINATE_REASON_TARGET_CONTENT_MISMATCH`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const TargetContentMismatch: Self = Self::INDETERMINATE_REASON_TARGET_CONTENT_MISMATCH; - ///Idiomatic alias for [`Self::INDETERMINATE_REASON_TARGET_UNREADABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const TargetUnreadable: Self = Self::INDETERMINATE_REASON_TARGET_UNREADABLE; - ///Idiomatic alias for [`Self::INDETERMINATE_REASON_SOURCE_ADVANCED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SourceAdvanced: Self = Self::INDETERMINATE_REASON_SOURCE_ADVANCED; - ///Idiomatic alias for [`Self::INDETERMINATE_REASON_SOURCE_INCARNATION_CHANGED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SourceIncarnationChanged: Self = Self::INDETERMINATE_REASON_SOURCE_INCARNATION_CHANGED; - ///Idiomatic alias for [`Self::INDETERMINATE_REASON_ORDER_UNPROVEN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const OrderUnproven: Self = Self::INDETERMINATE_REASON_ORDER_UNPROVEN; - ///Idiomatic alias for [`Self::INDETERMINATE_REASON_OWNERSHIP_UNPROVEN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const OwnershipUnproven: Self = Self::INDETERMINATE_REASON_OWNERSHIP_UNPROVEN; - ///Idiomatic alias for [`Self::INDETERMINATE_REASON_INTENT_MISSING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const IntentMissing: Self = Self::INDETERMINATE_REASON_INTENT_MISSING; -} -impl ::core::default::Default for IndeterminateReason { - fn default() -> Self { - Self::INDETERMINATE_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for IndeterminateReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for IndeterminateReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = IndeterminateReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(IndeterminateReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for IndeterminateReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for IndeterminateReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::INDETERMINATE_REASON_UNSPECIFIED), - 1i32 => { - ::core::option::Option::Some( - Self::INDETERMINATE_REASON_TARGET_CONTENT_MISMATCH, - ) - } - 2i32 => { - ::core::option::Option::Some( - Self::INDETERMINATE_REASON_TARGET_UNREADABLE, - ) - } - 3i32 => { - ::core::option::Option::Some(Self::INDETERMINATE_REASON_SOURCE_ADVANCED) - } - 4i32 => { - ::core::option::Option::Some( - Self::INDETERMINATE_REASON_SOURCE_INCARNATION_CHANGED, - ) - } - 5i32 => { - ::core::option::Option::Some(Self::INDETERMINATE_REASON_ORDER_UNPROVEN) - } - 6i32 => { - ::core::option::Option::Some( - Self::INDETERMINATE_REASON_OWNERSHIP_UNPROVEN, - ) - } - 7i32 => { - ::core::option::Option::Some(Self::INDETERMINATE_REASON_INTENT_MISSING) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::INDETERMINATE_REASON_UNSPECIFIED => "INDETERMINATE_REASON_UNSPECIFIED", - Self::INDETERMINATE_REASON_TARGET_CONTENT_MISMATCH => { - "INDETERMINATE_REASON_TARGET_CONTENT_MISMATCH" - } - Self::INDETERMINATE_REASON_TARGET_UNREADABLE => { - "INDETERMINATE_REASON_TARGET_UNREADABLE" - } - Self::INDETERMINATE_REASON_SOURCE_ADVANCED => { - "INDETERMINATE_REASON_SOURCE_ADVANCED" - } - Self::INDETERMINATE_REASON_SOURCE_INCARNATION_CHANGED => { - "INDETERMINATE_REASON_SOURCE_INCARNATION_CHANGED" - } - Self::INDETERMINATE_REASON_ORDER_UNPROVEN => { - "INDETERMINATE_REASON_ORDER_UNPROVEN" - } - Self::INDETERMINATE_REASON_OWNERSHIP_UNPROVEN => { - "INDETERMINATE_REASON_OWNERSHIP_UNPROVEN" - } - Self::INDETERMINATE_REASON_INTENT_MISSING => { - "INDETERMINATE_REASON_INTENT_MISSING" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "INDETERMINATE_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::INDETERMINATE_REASON_UNSPECIFIED) - } - "INDETERMINATE_REASON_TARGET_CONTENT_MISMATCH" => { - ::core::option::Option::Some( - Self::INDETERMINATE_REASON_TARGET_CONTENT_MISMATCH, - ) - } - "INDETERMINATE_REASON_TARGET_UNREADABLE" => { - ::core::option::Option::Some( - Self::INDETERMINATE_REASON_TARGET_UNREADABLE, - ) - } - "INDETERMINATE_REASON_SOURCE_ADVANCED" => { - ::core::option::Option::Some(Self::INDETERMINATE_REASON_SOURCE_ADVANCED) - } - "INDETERMINATE_REASON_SOURCE_INCARNATION_CHANGED" => { - ::core::option::Option::Some( - Self::INDETERMINATE_REASON_SOURCE_INCARNATION_CHANGED, - ) - } - "INDETERMINATE_REASON_ORDER_UNPROVEN" => { - ::core::option::Option::Some(Self::INDETERMINATE_REASON_ORDER_UNPROVEN) - } - "INDETERMINATE_REASON_OWNERSHIP_UNPROVEN" => { - ::core::option::Option::Some( - Self::INDETERMINATE_REASON_OWNERSHIP_UNPROVEN, - ) - } - "INDETERMINATE_REASON_INTENT_MISSING" => { - ::core::option::Option::Some(Self::INDETERMINATE_REASON_INTENT_MISSING) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::INDETERMINATE_REASON_UNSPECIFIED, - Self::INDETERMINATE_REASON_TARGET_CONTENT_MISMATCH, - Self::INDETERMINATE_REASON_TARGET_UNREADABLE, - Self::INDETERMINATE_REASON_SOURCE_ADVANCED, - Self::INDETERMINATE_REASON_SOURCE_INCARNATION_CHANGED, - Self::INDETERMINATE_REASON_ORDER_UNPROVEN, - Self::INDETERMINATE_REASON_OWNERSHIP_UNPROVEN, - Self::INDETERMINATE_REASON_INTENT_MISSING, - ] - } -} -/// IndeterminateDetail is why an outcome could not be classified. -/// -/// COMMIT_UNKNOWN and INDETERMINATE are deliberately different states. -/// COMMIT_UNKNOWN says nobody has looked yet, and looking is a mechanical step -/// the workflow performs on its own. INDETERMINATE says the workflow looked and -/// the evidence does not decide. Indeterminate is a conclusion, not the absence -/// of one, and collapsing the two would make an unattended retry loop -/// indistinguishable from a problem that needs a human. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct IndeterminateDetail { - /// Field 1: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// What the intent said should be there. - /// - /// Field 2: `expected` - #[serde( - rename = "expected", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub expected: ::buffa::MessageField>, - /// What was found. Unset means nothing was found, which is a different fact - /// from finding an empty stream, and the two lead to opposite actions. - /// - /// Field 3: `observed` - #[serde( - rename = "observed", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub observed: ::buffa::MessageField>, - /// For an operator. Never parsed. - /// - /// Field 4: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for IndeterminateDetail { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("IndeterminateDetail") - .field("reason", &self.reason) - .field("expected", &self.expected) - .field("observed", &self.observed) - .field("detail", &self.detail) - .finish() - } -} -impl IndeterminateDetail { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.IndeterminateDetail"; -} -impl IndeterminateDetail { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(IndeterminateDetail); -impl ::buffa::MessageName for IndeterminateDetail { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "IndeterminateDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.IndeterminateDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.IndeterminateDetail"; -} -impl ::buffa::Message for IndeterminateDetail { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.expected.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.expected.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - if self.expected.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.expected.write_to(__cache, buf); - } - if self.observed.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed.write_to(__cache, buf); - } - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.expected.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.reason = ::buffa::EnumValue::from(0); - self.expected = ::buffa::MessageField::none(); - self.observed = ::buffa::MessageField::none(); - self.detail = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for IndeterminateDetail { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __INDETERMINATE_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.IndeterminateDetail", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.reconcile_migration.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.reconcile_migration.__view.rs deleted file mode 100644 index 4a0b7fe3e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.reconcile_migration.__view.rs +++ /dev/null @@ -1,855 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/reconcile_migration.proto - -/// ReconcileMigration resolves a migration whose commit outcome is unknown. -/// -/// It reads. There is no mode, no force, and no field that could make it write, -/// for the same reason DiagnoseSession has none: a reconciler that can also -/// commit is a reconciler that can blindly commit, and blindly copying a session -/// again is precisely the failure this workflow exists to prevent. Acting on a -/// verdict is a separate MigrateSession call, made by whoever read the verdict. -#[derive(Clone, Debug, Default)] -pub struct ReconcileMigrationRequestView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// The identity from the recorded intent. Reconciliation compares against what - /// was planned, so a caller with no intent has nothing to reconcile and gets - /// INDETERMINATE_REASON_INTENT_MISSING rather than a guess. - /// - /// Field 2: `identity` - pub identity: ::buffa::MessageFieldView< - super::super::__buffa::view::MigrationIdentityView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReconcileMigrationRequestView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `identity` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_identity(&self) -> bool { - self.identity.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ReconcileMigrationRequestView<'a> { - type Owned = super::super::ReconcileMigrationRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.identity.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.identity = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ReconcileMigrationRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ReconcileMigrationRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReconcileMigrationRequest { - session_id: self.session_id.to_string(), - identity: match self.identity.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::MigrationIdentity, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReconcileMigrationRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.identity.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.identity.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.identity.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.identity.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReconcileMigrationRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.identity.as_option() { - __map.serialize_entry("identity", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReconcileMigrationRequestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "ReconcileMigrationRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.ReconcileMigrationRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.ReconcileMigrationRequest"; -} -::buffa::impl_default_view_instance!(ReconcileMigrationRequestView); -::buffa::impl_view_reborrow!(ReconcileMigrationRequestView); -/** Self-contained, `'static` owned view of a `ReconcileMigrationRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReconcileMigrationRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReconcileMigrationRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReconcileMigrationRequestOwnedView( - ::buffa::OwnedView>, -); -impl ReconcileMigrationRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileMigrationRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileMigrationRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReconcileMigrationRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileMigrationRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReconcileMigrationRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReconcileMigrationRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReconcileMigrationRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// The identity from the recorded intent. Reconciliation compares against what - /// was planned, so a caller with no intent has nothing to reconcile and gets - /// INDETERMINATE_REASON_INTENT_MISSING rather than a guess. - /// - /// Field 2: `identity` - #[must_use] - pub fn identity( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::MigrationIdentityView<'_>, - > { - &self.0.reborrow().identity - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReconcileMigrationRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReconcileMigrationRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReconcileMigrationRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReconcileMigrationRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReconcileMigrationRequest { - type View<'a> = ReconcileMigrationRequestView<'a>; - type ViewHandle = ReconcileMigrationRequestOwnedView; -} -impl ::serde::Serialize for ReconcileMigrationRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -#[derive(Clone, Debug, Default)] -pub struct ReconcileMigrationResponseView<'a> { - /// Field 1: `verdict` - pub verdict: ::buffa::EnumValue, - /// The state the record should be moved to. Reported rather than applied, - /// because applying it is a write. - /// - /// Field 2: `resolved_state` - pub resolved_state: ::buffa::EnumValue, - /// What was found at the target location. Unset when nothing was found. - /// - /// Field 3: `observed_target` - pub observed_target: ::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'a>, - >, - /// Set only for RECONCILIATION_VERDICT_UNRESOLVED. - /// - /// Field 4: `indeterminate` - pub indeterminate: ::buffa::MessageFieldView< - super::super::__buffa::view::IndeterminateDetailView<'a>, - >, - /// Field 5: `observed_at` - pub observed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReconcileMigrationResponseView<'a> { - /**Whether required field `verdict` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_verdict(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `resolved_state` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_resolved_state(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `observed_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_observed_at(&self) -> bool { - self.observed_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ReconcileMigrationResponseView<'a> { - type Owned = super::super::ReconcileMigrationResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.verdict = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.resolved_state = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_target.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_target = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.indeterminate.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.indeterminate = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ReconcileMigrationResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ReconcileMigrationResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReconcileMigrationResponse { - verdict: self.verdict, - resolved_state: self.resolved_state, - observed_target: match self.observed_target.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::StreamBoundary, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - indeterminate: match self.indeterminate.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::IndeterminateDetail, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - observed_at: match self.observed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReconcileMigrationResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.verdict.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - { - let val = self.resolved_state.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.observed_target.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_target.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.indeterminate.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.indeterminate.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.verdict.to_i32(), buf); - ::buffa::types::put_int32_field(2u32, self.resolved_state.to_i32(), buf); - if self.observed_target.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_target.write_to(__cache, buf); - } - if self.indeterminate.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.indeterminate.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReconcileMigrationResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("verdict", &self.verdict)?; - } - { - __map.serialize_entry("resolvedState", &self.resolved_state)?; - } - { - if let ::core::option::Option::Some(__v) = self.observed_target.as_option() { - __map.serialize_entry("observedTarget", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.indeterminate.as_option() { - __map.serialize_entry("indeterminate", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.observed_at.as_option() { - __map.serialize_entry("observedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReconcileMigrationResponseView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "ReconcileMigrationResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.ReconcileMigrationResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.ReconcileMigrationResponse"; -} -::buffa::impl_default_view_instance!(ReconcileMigrationResponseView); -::buffa::impl_view_reborrow!(ReconcileMigrationResponseView); -/** Self-contained, `'static` owned view of a `ReconcileMigrationResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReconcileMigrationResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReconcileMigrationResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReconcileMigrationResponseOwnedView( - ::buffa::OwnedView>, -); -impl ReconcileMigrationResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileMigrationResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileMigrationResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReconcileMigrationResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileMigrationResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReconcileMigrationResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReconcileMigrationResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReconcileMigrationResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `verdict` - #[must_use] - pub fn verdict(&self) -> ::buffa::EnumValue { - self.0.reborrow().verdict - } - /// The state the record should be moved to. Reported rather than applied, - /// because applying it is a write. - /// - /// Field 2: `resolved_state` - #[must_use] - pub fn resolved_state(&self) -> ::buffa::EnumValue { - self.0.reborrow().resolved_state - } - /// What was found at the target location. Unset when nothing was found. - /// - /// Field 3: `observed_target` - #[must_use] - pub fn observed_target( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'_>, - > { - &self.0.reborrow().observed_target - } - /// Set only for RECONCILIATION_VERDICT_UNRESOLVED. - /// - /// Field 4: `indeterminate` - #[must_use] - pub fn indeterminate( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::IndeterminateDetailView<'_>, - > { - &self.0.reborrow().indeterminate - } - /// Field 5: `observed_at` - #[must_use] - pub fn observed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().observed_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReconcileMigrationResponseOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReconcileMigrationResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReconcileMigrationResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReconcileMigrationResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReconcileMigrationResponse { - type View<'a> = ReconcileMigrationResponseView<'a>; - type ViewHandle = ReconcileMigrationResponseOwnedView; -} -impl ::serde::Serialize for ReconcileMigrationResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.reconcile_migration.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.reconcile_migration.rs deleted file mode 100644 index 340199884..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.reconcile_migration.rs +++ /dev/null @@ -1,597 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/reconcile_migration.proto - -/// ReconciliationVerdict is what the durable evidence says happened. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ReconciliationVerdict { - RECONCILIATION_VERDICT_UNSPECIFIED = 0i32, - /// No target exists. The commit did not land, and a retry under the same - /// identity is safe. - RECONCILIATION_VERDICT_NOT_COMMITTED = 1i32, - /// A target exists and its boundary matches the intent exactly. The commit - /// landed and the acknowledgment was the only thing lost. The correct action - /// is to record success, not to migrate again. - RECONCILIATION_VERDICT_COMMITTED = 2i32, - /// A target exists and does not match the intent. Fail closed: no automated - /// action may resolve this, because both readings, a truncated copy of ours - /// and an intact copy of somebody else's, look identical from here. - RECONCILIATION_VERDICT_DIVERGED = 3i32, - /// The comparison itself could not be made. - RECONCILIATION_VERDICT_UNRESOLVED = 4i32, -} -impl ReconciliationVerdict { - ///Idiomatic alias for [`Self::RECONCILIATION_VERDICT_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::RECONCILIATION_VERDICT_UNSPECIFIED; - ///Idiomatic alias for [`Self::RECONCILIATION_VERDICT_NOT_COMMITTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NotCommitted: Self = Self::RECONCILIATION_VERDICT_NOT_COMMITTED; - ///Idiomatic alias for [`Self::RECONCILIATION_VERDICT_COMMITTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Committed: Self = Self::RECONCILIATION_VERDICT_COMMITTED; - ///Idiomatic alias for [`Self::RECONCILIATION_VERDICT_DIVERGED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Diverged: Self = Self::RECONCILIATION_VERDICT_DIVERGED; - ///Idiomatic alias for [`Self::RECONCILIATION_VERDICT_UNRESOLVED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unresolved: Self = Self::RECONCILIATION_VERDICT_UNRESOLVED; -} -impl ::core::default::Default for ReconciliationVerdict { - fn default() -> Self { - Self::RECONCILIATION_VERDICT_UNSPECIFIED - } -} -impl ::serde::Serialize for ReconciliationVerdict { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ReconciliationVerdict { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ReconciliationVerdict; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(ReconciliationVerdict) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReconciliationVerdict { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ReconciliationVerdict { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some(Self::RECONCILIATION_VERDICT_UNSPECIFIED) - } - 1i32 => { - ::core::option::Option::Some(Self::RECONCILIATION_VERDICT_NOT_COMMITTED) - } - 2i32 => ::core::option::Option::Some(Self::RECONCILIATION_VERDICT_COMMITTED), - 3i32 => ::core::option::Option::Some(Self::RECONCILIATION_VERDICT_DIVERGED), - 4i32 => ::core::option::Option::Some(Self::RECONCILIATION_VERDICT_UNRESOLVED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::RECONCILIATION_VERDICT_UNSPECIFIED => { - "RECONCILIATION_VERDICT_UNSPECIFIED" - } - Self::RECONCILIATION_VERDICT_NOT_COMMITTED => { - "RECONCILIATION_VERDICT_NOT_COMMITTED" - } - Self::RECONCILIATION_VERDICT_COMMITTED => "RECONCILIATION_VERDICT_COMMITTED", - Self::RECONCILIATION_VERDICT_DIVERGED => "RECONCILIATION_VERDICT_DIVERGED", - Self::RECONCILIATION_VERDICT_UNRESOLVED => { - "RECONCILIATION_VERDICT_UNRESOLVED" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "RECONCILIATION_VERDICT_UNSPECIFIED" => { - ::core::option::Option::Some(Self::RECONCILIATION_VERDICT_UNSPECIFIED) - } - "RECONCILIATION_VERDICT_NOT_COMMITTED" => { - ::core::option::Option::Some(Self::RECONCILIATION_VERDICT_NOT_COMMITTED) - } - "RECONCILIATION_VERDICT_COMMITTED" => { - ::core::option::Option::Some(Self::RECONCILIATION_VERDICT_COMMITTED) - } - "RECONCILIATION_VERDICT_DIVERGED" => { - ::core::option::Option::Some(Self::RECONCILIATION_VERDICT_DIVERGED) - } - "RECONCILIATION_VERDICT_UNRESOLVED" => { - ::core::option::Option::Some(Self::RECONCILIATION_VERDICT_UNRESOLVED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::RECONCILIATION_VERDICT_UNSPECIFIED, - Self::RECONCILIATION_VERDICT_NOT_COMMITTED, - Self::RECONCILIATION_VERDICT_COMMITTED, - Self::RECONCILIATION_VERDICT_DIVERGED, - Self::RECONCILIATION_VERDICT_UNRESOLVED, - ] - } -} -/// ReconcileMigration resolves a migration whose commit outcome is unknown. -/// -/// It reads. There is no mode, no force, and no field that could make it write, -/// for the same reason DiagnoseSession has none: a reconciler that can also -/// commit is a reconciler that can blindly commit, and blindly copying a session -/// again is precisely the failure this workflow exists to prevent. Acting on a -/// verdict is a separate MigrateSession call, made by whoever read the verdict. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReconcileMigrationRequest { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// The identity from the recorded intent. Reconciliation compares against what - /// was planned, so a caller with no intent has nothing to reconcile and gets - /// INDETERMINATE_REASON_INTENT_MISSING rather than a guess. - /// - /// Field 2: `identity` - #[serde(rename = "identity")] - pub identity: ::buffa::MessageField< - MigrationIdentity, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for ReconcileMigrationRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReconcileMigrationRequest") - .field("session_id", &self.session_id) - .field("identity", &self.identity) - .finish() - } -} -impl ReconcileMigrationRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.ReconcileMigrationRequest"; -} -::buffa::impl_default_instance!(ReconcileMigrationRequest); -impl ::buffa::MessageName for ReconcileMigrationRequest { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "ReconcileMigrationRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.ReconcileMigrationRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.ReconcileMigrationRequest"; -} -impl ::buffa::Message for ReconcileMigrationRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.identity.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.identity.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.identity.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.identity.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.identity.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.identity = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReconcileMigrationRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECONCILE_MIGRATION_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.ReconcileMigrationRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReconcileMigrationResponse { - /// Field 1: `verdict` - #[serde(rename = "verdict", with = "::buffa::json_helpers::proto_enum")] - pub verdict: ::buffa::EnumValue, - /// The state the record should be moved to. Reported rather than applied, - /// because applying it is a write. - /// - /// Field 2: `resolved_state` - #[serde( - rename = "resolvedState", - alias = "resolved_state", - with = "::buffa::json_helpers::proto_enum" - )] - pub resolved_state: ::buffa::EnumValue, - /// What was found at the target location. Unset when nothing was found. - /// - /// Field 3: `observed_target` - #[serde( - rename = "observedTarget", - alias = "observed_target", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub observed_target: ::buffa::MessageField< - StreamBoundary, - ::buffa::Inline, - >, - /// Set only for RECONCILIATION_VERDICT_UNRESOLVED. - /// - /// Field 4: `indeterminate` - #[serde( - rename = "indeterminate", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub indeterminate: ::buffa::MessageField< - IndeterminateDetail, - ::buffa::Inline, - >, - /// Field 5: `observed_at` - #[serde(rename = "observedAt", alias = "observed_at")] - pub observed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for ReconcileMigrationResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReconcileMigrationResponse") - .field("verdict", &self.verdict) - .field("resolved_state", &self.resolved_state) - .field("observed_target", &self.observed_target) - .field("indeterminate", &self.indeterminate) - .field("observed_at", &self.observed_at) - .finish() - } -} -impl ReconcileMigrationResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.ReconcileMigrationResponse"; -} -::buffa::impl_default_instance!(ReconcileMigrationResponse); -impl ::buffa::MessageName for ReconcileMigrationResponse { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "ReconcileMigrationResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.ReconcileMigrationResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.ReconcileMigrationResponse"; -} -impl ::buffa::Message for ReconcileMigrationResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.verdict.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - { - let val = self.resolved_state.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.observed_target.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_target.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.indeterminate.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.indeterminate.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.verdict.to_i32(), buf); - ::buffa::types::put_int32_field(2u32, self.resolved_state.to_i32(), buf); - if self.observed_target.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_target.write_to(__cache, buf); - } - if self.indeterminate.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.indeterminate.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.verdict = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.resolved_state = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_target.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.indeterminate.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.verdict = ::buffa::EnumValue::from(0); - self.resolved_state = ::buffa::EnumValue::from(0); - self.observed_target = ::buffa::MessageField::none(); - self.indeterminate = ::buffa::MessageField::none(); - self.observed_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReconcileMigrationResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECONCILE_MIGRATION_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.ReconcileMigrationResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.salvage.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.salvage.__view.rs deleted file mode 100644 index e9881e951..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.salvage.__view.rs +++ /dev/null @@ -1,2064 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/salvage.proto - -/// The durable record of a Session salvage. -/// -/// A salvage copies what can be read from a damaged session into a new session -/// identity. It is the opposite of a migration on every axis that matters: -/// -/// | | migration | salvage | -/// | identity | preserved | new | -/// | ordinals | preserved exactly | not preserved | -/// | source | must be intact | is damaged | -/// | source after | replaced | untouched | -/// | loss | inadmissible | expected and enumerated | -/// -/// It is also not ForkSession. A fork inherits a prefix it assumes is valid and -/// references it in place, so the source must stay readable forever. A salvage -/// exists because the source's validity is incomplete, so it copies, and the -/// copy is a different session that must never be presented as the original. -/// -/// SalvageIdentity is the retry identity of a salvage. -#[derive(Clone, Debug, Default)] -pub struct SalvageIdentityView<'a> { - /// Field 1: `source_session_id` - pub source_session_id: &'a str, - /// Chosen by the operator or orchestrator. Two salvages of one damaged source - /// are legitimately different operations, so identity cannot be derived from - /// the source alone. - /// - /// Field 2: `salvage_key` - pub salvage_key: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SalvageIdentityView<'a> { - /**Whether required field `source_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `salvage_key` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_salvage_key(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SalvageIdentityView<'a> { - type Owned = super::super::SalvageIdentity; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.salvage_key = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SalvageIdentity { - source_session_id: self.source_session_id.to_string(), - salvage_key: self.salvage_key.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SalvageIdentityView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.salvage_key) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - ::buffa::types::put_string_field(2u32, &self.salvage_key, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SalvageIdentityView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sourceSessionId", self.source_session_id)?; - } - { - __map.serialize_entry("salvageKey", self.salvage_key)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SalvageIdentityView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "SalvageIdentity"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.SalvageIdentity"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageIdentity"; -} -::buffa::impl_default_view_instance!(SalvageIdentityView); -::buffa::impl_view_reborrow!(SalvageIdentityView); -/** Self-contained, `'static` owned view of a `SalvageIdentity` message. - - Wraps [`::buffa::OwnedView`]`<`[`SalvageIdentityView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SalvageIdentityView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SalvageIdentityOwnedView(::buffa::OwnedView>); -impl SalvageIdentityOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageIdentityOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageIdentityOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SalvageIdentity, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageIdentityOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SalvageIdentityView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SalvageIdentityView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SalvageIdentity { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `source_session_id` - #[must_use] - pub fn source_session_id(&self) -> &'_ str { - self.0.reborrow().source_session_id - } - /// Chosen by the operator or orchestrator. Two salvages of one damaged source - /// are legitimately different operations, so identity cannot be derived from - /// the source alone. - /// - /// Field 2: `salvage_key` - #[must_use] - pub fn salvage_key(&self) -> &'_ str { - self.0.reborrow().salvage_key - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SalvageIdentityOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SalvageIdentityOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SalvageIdentityOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SalvageIdentityOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SalvageIdentity { - type View<'a> = SalvageIdentityView<'a>; - type ViewHandle = SalvageIdentityOwnedView; -} -impl ::serde::Serialize for SalvageIdentityOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// SalvageIntent is written durably before the target session is created. -#[derive(Clone, Debug, Default)] -pub struct SalvageIntentView<'a> { - /// Field 1: `identity` - pub identity: ::buffa::MessageFieldView< - super::super::__buffa::view::SalvageIdentityView<'a>, - >, - /// Field 2: `source` - pub source: ::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'a>, - >, - /// The id the salvaged session will have, derived from the identity before any - /// write is attempted. - /// - /// Deriving it is what makes a retry safe. The salvaged session is created by - /// an atomic batch under a NoStream precondition, so a retry that lands on the - /// same id sees a visible conflict instead of producing a second copy. A - /// randomly minted id would leave a retry unable to find its own prior work, - /// which is the same trap the migration reconciler exists to escape, closed - /// here by the write precondition rather than by a later comparison. - /// - /// Field 3: `target_session_id` - pub target_session_id: &'a str, - /// Field 4: `order_proof` - pub order_proof: ::buffa::EnumValue, - /// Field 5: `actor` - pub actor: &'a str, - /// Field 6: `reason` - pub reason: &'a str, - /// Field 7: `planned_at` - pub planned_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SalvageIntentView<'a> { - /**Whether required field `identity` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_identity(&self) -> bool { - self.identity.is_set() - } - /**Whether required field `source` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source(&self) -> bool { - self.source.is_set() - } - /**Whether required field `target_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_target_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `order_proof` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_order_proof(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `actor` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_actor(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `planned_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_planned_at(&self) -> bool { - self.planned_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for SalvageIntentView<'a> { - type Owned = super::super::SalvageIntent; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.identity.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.identity = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.source.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.source = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.target_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.order_proof = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.actor = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.planned_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.planned_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SalvageIntent { - identity: match self.identity.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SalvageIdentity, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - source: match self.source.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::StreamBoundary, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - target_session_id: self.target_session_id.to_string(), - order_proof: self.order_proof, - actor: self.actor.to_string(), - reason: self.reason.to_string(), - planned_at: match self.planned_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SalvageIntentView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.identity.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.identity.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.source.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.target_session_id) as u64; - { - let val = self.order_proof.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.actor) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.reason) as u64; - if self.planned_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.planned_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.identity.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.identity.write_to(__cache, buf); - } - if self.source.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source.write_to(__cache, buf); - } - ::buffa::types::put_string_field(3u32, &self.target_session_id, buf); - ::buffa::types::put_int32_field(4u32, self.order_proof.to_i32(), buf); - ::buffa::types::put_string_field(5u32, &self.actor, buf); - ::buffa::types::put_string_field(6u32, &self.reason, buf); - if self.planned_at.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.planned_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SalvageIntentView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.identity.as_option() { - __map.serialize_entry("identity", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.source.as_option() { - __map.serialize_entry("source", __v)?; - } - } - { - __map.serialize_entry("targetSessionId", self.target_session_id)?; - } - { - __map.serialize_entry("orderProof", &self.order_proof)?; - } - { - __map.serialize_entry("actor", self.actor)?; - } - { - __map.serialize_entry("reason", self.reason)?; - } - { - if let ::core::option::Option::Some(__v) = self.planned_at.as_option() { - __map.serialize_entry("plannedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SalvageIntentView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "SalvageIntent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.SalvageIntent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageIntent"; -} -::buffa::impl_default_view_instance!(SalvageIntentView); -::buffa::impl_view_reborrow!(SalvageIntentView); -/** Self-contained, `'static` owned view of a `SalvageIntent` message. - - Wraps [`::buffa::OwnedView`]`<`[`SalvageIntentView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SalvageIntentView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SalvageIntentOwnedView(::buffa::OwnedView>); -impl SalvageIntentOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageIntentOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageIntentOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SalvageIntent, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageIntentOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SalvageIntentView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SalvageIntentView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SalvageIntent { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `identity` - #[must_use] - pub fn identity( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SalvageIdentityView<'_>, - > { - &self.0.reborrow().identity - } - /// Field 2: `source` - #[must_use] - pub fn source( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::StreamBoundaryView<'_>, - > { - &self.0.reborrow().source - } - /// The id the salvaged session will have, derived from the identity before any - /// write is attempted. - /// - /// Deriving it is what makes a retry safe. The salvaged session is created by - /// an atomic batch under a NoStream precondition, so a retry that lands on the - /// same id sees a visible conflict instead of producing a second copy. A - /// randomly minted id would leave a retry unable to find its own prior work, - /// which is the same trap the migration reconciler exists to escape, closed - /// here by the write precondition rather than by a later comparison. - /// - /// Field 3: `target_session_id` - #[must_use] - pub fn target_session_id(&self) -> &'_ str { - self.0.reborrow().target_session_id - } - /// Field 4: `order_proof` - #[must_use] - pub fn order_proof(&self) -> ::buffa::EnumValue { - self.0.reborrow().order_proof - } - /// Field 5: `actor` - #[must_use] - pub fn actor(&self) -> &'_ str { - self.0.reborrow().actor - } - /// Field 6: `reason` - #[must_use] - pub fn reason(&self) -> &'_ str { - self.0.reborrow().reason - } - /// Field 7: `planned_at` - #[must_use] - pub fn planned_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().planned_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SalvageIntentOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SalvageIntentOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SalvageIntentOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SalvageIntentOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SalvageIntent { - type View<'a> = SalvageIntentView<'a>; - type ViewHandle = SalvageIntentOwnedView; -} -impl ::serde::Serialize for SalvageIntentOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// SalvageRecord is the intent plus everything learned since. -#[derive(Clone, Debug, Default)] -pub struct SalvageRecordView<'a> { - /// Field 1: `intent` - pub intent: ::buffa::MessageFieldView< - super::super::__buffa::view::SalvageIntentView<'a>, - >, - /// Field 2: `state` - pub state: ::buffa::EnumValue, - /// Set only for MAINTENANCE_STATE_INDETERMINATE. - /// - /// Field 3: `indeterminate` - pub indeterminate: ::buffa::MessageFieldView< - super::super::__buffa::view::IndeterminateDetailView<'a>, - >, - /// Everything the source held that the salvaged session does not. - /// - /// Field 4: `omitted` - pub omitted: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::OmittedItemView<'a>, - >, - /// Field 5: `attempt_count` - pub attempt_count: u32, - /// Field 6: `updated_at` - pub updated_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SalvageRecordView<'a> { - /**Whether required field `intent` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_intent(&self) -> bool { - self.intent.is_set() - } - /**Whether required field `state` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_state(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `attempt_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_attempt_count(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `updated_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_updated_at(&self) -> bool { - self.updated_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for SalvageRecordView<'a> { - type Owned = super::super::SalvageRecord; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.intent.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.intent = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.state = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.indeterminate.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.indeterminate = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.attempt_count = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.updated_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.updated_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::OmittedItemView, - >(), - )?; - view.omitted - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SalvageRecord { - intent: match self.intent.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SalvageIntent, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - state: self.state, - indeterminate: match self.indeterminate.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::IndeterminateDetail, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - omitted: self - .omitted - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - attempt_count: self.attempt_count, - updated_at: match self.updated_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SalvageRecordView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.intent.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.intent.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.state.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.indeterminate.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.indeterminate.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.omitted { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.attempt_count) as u64; - if self.updated_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.updated_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.intent.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.intent.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(2u32, self.state.to_i32(), buf); - if self.indeterminate.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.indeterminate.write_to(__cache, buf); - } - for v in &self.omitted { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - ::buffa::types::put_uint32_field(5u32, self.attempt_count, buf); - if self.updated_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.updated_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SalvageRecordView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.intent.as_option() { - __map.serialize_entry("intent", __v)?; - } - } - { - __map.serialize_entry("state", &self.state)?; - } - { - if let ::core::option::Option::Some(__v) = self.indeterminate.as_option() { - __map.serialize_entry("indeterminate", __v)?; - } - } - if !self.omitted.is_empty() { - __map.serialize_entry("omitted", &*self.omitted)?; - } - { - __map - .serialize_entry( - "attemptCount", - &::buffa::json_helpers::ProtoJson(&self.attempt_count), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.updated_at.as_option() { - __map.serialize_entry("updatedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SalvageRecordView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "SalvageRecord"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.SalvageRecord"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageRecord"; -} -::buffa::impl_default_view_instance!(SalvageRecordView); -::buffa::impl_view_reborrow!(SalvageRecordView); -/** Self-contained, `'static` owned view of a `SalvageRecord` message. - - Wraps [`::buffa::OwnedView`]`<`[`SalvageRecordView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SalvageRecordView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SalvageRecordOwnedView(::buffa::OwnedView>); -impl SalvageRecordOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageRecordOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageRecordOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SalvageRecord, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageRecordOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SalvageRecordView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SalvageRecordView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SalvageRecord { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `intent` - #[must_use] - pub fn intent( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().intent - } - /// Field 2: `state` - #[must_use] - pub fn state(&self) -> ::buffa::EnumValue { - self.0.reborrow().state - } - /// Set only for MAINTENANCE_STATE_INDETERMINATE. - /// - /// Field 3: `indeterminate` - #[must_use] - pub fn indeterminate( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::IndeterminateDetailView<'_>, - > { - &self.0.reborrow().indeterminate - } - /// Everything the source held that the salvaged session does not. - /// - /// Field 4: `omitted` - #[must_use] - pub fn omitted( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::OmittedItemView<'_>> { - &self.0.reborrow().omitted - } - /// Field 5: `attempt_count` - #[must_use] - pub fn attempt_count(&self) -> u32 { - self.0.reborrow().attempt_count - } - /// Field 6: `updated_at` - #[must_use] - pub fn updated_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().updated_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SalvageRecordOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SalvageRecordOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SalvageRecordOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SalvageRecordOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SalvageRecord { - type View<'a> = SalvageRecordView<'a>; - type ViewHandle = SalvageRecordOwnedView; -} -impl ::serde::Serialize for SalvageRecordOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// OmittedItem is one thing the salvage could not carry. -/// -/// Enumerated rather than counted. An operator told that three things were lost -/// cannot tell whether they were three tool results or three user messages, and -/// that difference decides whether the salvaged session is worth keeping. -#[derive(Clone, Debug, Default)] -pub struct OmittedItemView<'a> { - /// Field 1: `kind` - pub kind: ::buffa::EnumValue, - /// The source position, for an omission that had one. - /// - /// Field 2: `source_ordinal` - pub source_ordinal: ::core::option::Option, - /// The artifact, checkpoint, or child session id, for an omission that had one. - /// - /// Field 3: `entity_id` - pub entity_id: ::core::option::Option<&'a str>, - /// Field 4: `reason` - pub reason: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> OmittedItemView<'a> { - /**Whether required field `kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_kind(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for OmittedItemView<'a> { - type Owned = super::super::OmittedItem; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.source_ordinal = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.entity_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::OmittedItem { - kind: self.kind, - source_ordinal: self.source_ordinal, - entity_id: self.entity_id.map(|s| s.to_string()), - reason: self.reason, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for OmittedItemView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(v) = self.source_ordinal { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(ref v) = self.entity_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.kind.to_i32(), buf); - if let Some(v) = self.source_ordinal { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if let Some(ref v) = self.entity_id { - ::buffa::types::put_string_field(3u32, v, buf); - } - ::buffa::types::put_int32_field(4u32, self.reason.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for OmittedItemView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("kind", &self.kind)?; - } - if let ::core::option::Option::Some(__v) = self.source_ordinal { - __map - .serialize_entry( - "sourceOrdinal", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.entity_id { - __map.serialize_entry("entityId", __v)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for OmittedItemView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "OmittedItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.OmittedItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.OmittedItem"; -} -::buffa::impl_default_view_instance!(OmittedItemView); -::buffa::impl_view_reborrow!(OmittedItemView); -/** Self-contained, `'static` owned view of a `OmittedItem` message. - - Wraps [`::buffa::OwnedView`]`<`[`OmittedItemView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`OmittedItemView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct OmittedItemOwnedView(::buffa::OwnedView>); -impl OmittedItemOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OmittedItemOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OmittedItemOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::OmittedItem, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OmittedItemOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`OmittedItemView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &OmittedItemView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::OmittedItem { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `kind` - #[must_use] - pub fn kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().kind - } - /// The source position, for an omission that had one. - /// - /// Field 2: `source_ordinal` - #[must_use] - pub fn source_ordinal(&self) -> ::core::option::Option { - self.0.reborrow().source_ordinal - } - /// The artifact, checkpoint, or child session id, for an omission that had one. - /// - /// Field 3: `entity_id` - #[must_use] - pub fn entity_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().entity_id - } - /// Field 4: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for OmittedItemOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - OmittedItemOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: OmittedItemOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for OmittedItemOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::OmittedItem { - type View<'a> = OmittedItemView<'a>; - type ViewHandle = OmittedItemOwnedView; -} -impl ::serde::Serialize for OmittedItemOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// RefusalDetail is why a salvage wrote nothing. -#[derive(Clone, Debug, Default)] -pub struct RefusalDetailView<'a> { - /// Field 1: `reason` - pub reason: ::buffa::EnumValue, - /// Field 2: `detail` - pub detail: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RefusalDetailView<'a> { - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RefusalDetailView<'a> { - type Owned = super::super::RefusalDetail; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RefusalDetail { - reason: self.reason, - detail: self.detail.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RefusalDetailView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(2u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RefusalDetailView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("reason", &self.reason)?; - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RefusalDetailView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "RefusalDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.RefusalDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.RefusalDetail"; -} -::buffa::impl_default_view_instance!(RefusalDetailView); -::buffa::impl_view_reborrow!(RefusalDetailView); -/** Self-contained, `'static` owned view of a `RefusalDetail` message. - - Wraps [`::buffa::OwnedView`]`<`[`RefusalDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RefusalDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RefusalDetailOwnedView(::buffa::OwnedView>); -impl RefusalDetailOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RefusalDetailOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RefusalDetailOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RefusalDetail, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RefusalDetailOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RefusalDetailView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RefusalDetailView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RefusalDetail { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// Field 2: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RefusalDetailOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RefusalDetailOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RefusalDetailOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RefusalDetailOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RefusalDetail { - type View<'a> = RefusalDetailView<'a>; - type ViewHandle = RefusalDetailOwnedView; -} -impl ::serde::Serialize for RefusalDetailOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.salvage.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.salvage.rs deleted file mode 100644 index 646c23be9..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.salvage.rs +++ /dev/null @@ -1,1816 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/salvage.proto - -/// OmittedKind is what sort of thing was lost. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum OmittedKind { - OMITTED_KIND_UNSPECIFIED = 0i32, - OMITTED_KIND_EVENT = 1i32, - OMITTED_KIND_ARTIFACT = 2i32, - OMITTED_KIND_CHECKPOINT = 3i32, - OMITTED_KIND_CHILD_SESSION = 4i32, -} -impl OmittedKind { - ///Idiomatic alias for [`Self::OMITTED_KIND_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::OMITTED_KIND_UNSPECIFIED; - ///Idiomatic alias for [`Self::OMITTED_KIND_EVENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Event: Self = Self::OMITTED_KIND_EVENT; - ///Idiomatic alias for [`Self::OMITTED_KIND_ARTIFACT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Artifact: Self = Self::OMITTED_KIND_ARTIFACT; - ///Idiomatic alias for [`Self::OMITTED_KIND_CHECKPOINT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Checkpoint: Self = Self::OMITTED_KIND_CHECKPOINT; - ///Idiomatic alias for [`Self::OMITTED_KIND_CHILD_SESSION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ChildSession: Self = Self::OMITTED_KIND_CHILD_SESSION; -} -impl ::core::default::Default for OmittedKind { - fn default() -> Self { - Self::OMITTED_KIND_UNSPECIFIED - } -} -impl ::serde::Serialize for OmittedKind { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for OmittedKind { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = OmittedKind; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(OmittedKind)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for OmittedKind { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for OmittedKind { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::OMITTED_KIND_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::OMITTED_KIND_EVENT), - 2i32 => ::core::option::Option::Some(Self::OMITTED_KIND_ARTIFACT), - 3i32 => ::core::option::Option::Some(Self::OMITTED_KIND_CHECKPOINT), - 4i32 => ::core::option::Option::Some(Self::OMITTED_KIND_CHILD_SESSION), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::OMITTED_KIND_UNSPECIFIED => "OMITTED_KIND_UNSPECIFIED", - Self::OMITTED_KIND_EVENT => "OMITTED_KIND_EVENT", - Self::OMITTED_KIND_ARTIFACT => "OMITTED_KIND_ARTIFACT", - Self::OMITTED_KIND_CHECKPOINT => "OMITTED_KIND_CHECKPOINT", - Self::OMITTED_KIND_CHILD_SESSION => "OMITTED_KIND_CHILD_SESSION", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "OMITTED_KIND_UNSPECIFIED" => { - ::core::option::Option::Some(Self::OMITTED_KIND_UNSPECIFIED) - } - "OMITTED_KIND_EVENT" => { - ::core::option::Option::Some(Self::OMITTED_KIND_EVENT) - } - "OMITTED_KIND_ARTIFACT" => { - ::core::option::Option::Some(Self::OMITTED_KIND_ARTIFACT) - } - "OMITTED_KIND_CHECKPOINT" => { - ::core::option::Option::Some(Self::OMITTED_KIND_CHECKPOINT) - } - "OMITTED_KIND_CHILD_SESSION" => { - ::core::option::Option::Some(Self::OMITTED_KIND_CHILD_SESSION) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::OMITTED_KIND_UNSPECIFIED, - Self::OMITTED_KIND_EVENT, - Self::OMITTED_KIND_ARTIFACT, - Self::OMITTED_KIND_CHECKPOINT, - Self::OMITTED_KIND_CHILD_SESSION, - ] - } -} -/// OmissionReason is why it was lost. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum OmissionReason { - OMISSION_REASON_UNSPECIFIED = 0i32, - /// Present in the source and did not decode. - OMISSION_REASON_UNDECODABLE = 1i32, - /// Referenced by the source and not there. - OMISSION_REASON_MISSING = 2i32, - /// Present, and its content did not match its recorded digest. Deliberately - /// never carried: a salvage that copied content failing its own integrity - /// check would launder corruption into a session that looks healthy. - OMISSION_REASON_DIGEST_MISMATCH = 3i32, - /// Present and could not be read well enough to verify. Not the same as - /// absent, and not evidence of corruption, matching the doctor's three-way - /// artifact observation. - OMISSION_REASON_UNVERIFIABLE = 4i32, - /// Erased under a privacy obligation. It was not lost, and a salvage must not - /// resurrect it. Recorded so the gap in the salvaged history is explained - /// rather than read as further damage. - OMISSION_REASON_ERASED = 5i32, -} -impl OmissionReason { - ///Idiomatic alias for [`Self::OMISSION_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::OMISSION_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::OMISSION_REASON_UNDECODABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Undecodable: Self = Self::OMISSION_REASON_UNDECODABLE; - ///Idiomatic alias for [`Self::OMISSION_REASON_MISSING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Missing: Self = Self::OMISSION_REASON_MISSING; - ///Idiomatic alias for [`Self::OMISSION_REASON_DIGEST_MISMATCH`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const DigestMismatch: Self = Self::OMISSION_REASON_DIGEST_MISMATCH; - ///Idiomatic alias for [`Self::OMISSION_REASON_UNVERIFIABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unverifiable: Self = Self::OMISSION_REASON_UNVERIFIABLE; - ///Idiomatic alias for [`Self::OMISSION_REASON_ERASED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Erased: Self = Self::OMISSION_REASON_ERASED; -} -impl ::core::default::Default for OmissionReason { - fn default() -> Self { - Self::OMISSION_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for OmissionReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for OmissionReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = OmissionReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(OmissionReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for OmissionReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for OmissionReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::OMISSION_REASON_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::OMISSION_REASON_UNDECODABLE), - 2i32 => ::core::option::Option::Some(Self::OMISSION_REASON_MISSING), - 3i32 => ::core::option::Option::Some(Self::OMISSION_REASON_DIGEST_MISMATCH), - 4i32 => ::core::option::Option::Some(Self::OMISSION_REASON_UNVERIFIABLE), - 5i32 => ::core::option::Option::Some(Self::OMISSION_REASON_ERASED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::OMISSION_REASON_UNSPECIFIED => "OMISSION_REASON_UNSPECIFIED", - Self::OMISSION_REASON_UNDECODABLE => "OMISSION_REASON_UNDECODABLE", - Self::OMISSION_REASON_MISSING => "OMISSION_REASON_MISSING", - Self::OMISSION_REASON_DIGEST_MISMATCH => "OMISSION_REASON_DIGEST_MISMATCH", - Self::OMISSION_REASON_UNVERIFIABLE => "OMISSION_REASON_UNVERIFIABLE", - Self::OMISSION_REASON_ERASED => "OMISSION_REASON_ERASED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "OMISSION_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::OMISSION_REASON_UNSPECIFIED) - } - "OMISSION_REASON_UNDECODABLE" => { - ::core::option::Option::Some(Self::OMISSION_REASON_UNDECODABLE) - } - "OMISSION_REASON_MISSING" => { - ::core::option::Option::Some(Self::OMISSION_REASON_MISSING) - } - "OMISSION_REASON_DIGEST_MISMATCH" => { - ::core::option::Option::Some(Self::OMISSION_REASON_DIGEST_MISMATCH) - } - "OMISSION_REASON_UNVERIFIABLE" => { - ::core::option::Option::Some(Self::OMISSION_REASON_UNVERIFIABLE) - } - "OMISSION_REASON_ERASED" => { - ::core::option::Option::Some(Self::OMISSION_REASON_ERASED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::OMISSION_REASON_UNSPECIFIED, - Self::OMISSION_REASON_UNDECODABLE, - Self::OMISSION_REASON_MISSING, - Self::OMISSION_REASON_DIGEST_MISMATCH, - Self::OMISSION_REASON_UNVERIFIABLE, - Self::OMISSION_REASON_ERASED, - ] - } -} -/// SalvageResult is the disposition of one SalvageSession call. -/// -/// There is no separate "recovered with unverified artifacts" value, which is a -/// deliberate departure from the shape Fx uses. History completeness and -/// artifact verification are independent axes, and one flat enum forces the -/// server to choose which of the two facts to report. The omissions carry both, -/// and a second signal that could disagree with them would only invite a caller -/// to pick. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum SalvageResult { - SALVAGE_RESULT_UNSPECIFIED = 0i32, - /// Every source event decoded and every referenced artifact verified. - SALVAGE_RESULT_COMPLETE = 1i32, - /// A session was produced and items are missing. They are enumerated. - SALVAGE_RESULT_PARTIAL = 2i32, - /// A prior attempt under this identity already produced the target session. - SALVAGE_RESULT_ALREADY_SALVAGED = 3i32, - /// Refused before writing. Carries a RefusalDetail. - SALVAGE_RESULT_REFUSED = 4i32, - /// The outcome could not be classified. - SALVAGE_RESULT_INDETERMINATE = 5i32, - /// PLAN_ONLY: a salvage would run and nothing was written. The planned - /// omissions are on the record, so an operator can see what would be lost - /// before deciding. - SALVAGE_RESULT_WOULD_SALVAGE = 6i32, -} -impl SalvageResult { - ///Idiomatic alias for [`Self::SALVAGE_RESULT_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::SALVAGE_RESULT_UNSPECIFIED; - ///Idiomatic alias for [`Self::SALVAGE_RESULT_COMPLETE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Complete: Self = Self::SALVAGE_RESULT_COMPLETE; - ///Idiomatic alias for [`Self::SALVAGE_RESULT_PARTIAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Partial: Self = Self::SALVAGE_RESULT_PARTIAL; - ///Idiomatic alias for [`Self::SALVAGE_RESULT_ALREADY_SALVAGED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const AlreadySalvaged: Self = Self::SALVAGE_RESULT_ALREADY_SALVAGED; - ///Idiomatic alias for [`Self::SALVAGE_RESULT_REFUSED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Refused: Self = Self::SALVAGE_RESULT_REFUSED; - ///Idiomatic alias for [`Self::SALVAGE_RESULT_INDETERMINATE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Indeterminate: Self = Self::SALVAGE_RESULT_INDETERMINATE; - ///Idiomatic alias for [`Self::SALVAGE_RESULT_WOULD_SALVAGE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const WouldSalvage: Self = Self::SALVAGE_RESULT_WOULD_SALVAGE; -} -impl ::core::default::Default for SalvageResult { - fn default() -> Self { - Self::SALVAGE_RESULT_UNSPECIFIED - } -} -impl ::serde::Serialize for SalvageResult { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for SalvageResult { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = SalvageResult; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(SalvageResult)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for SalvageResult { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for SalvageResult { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::SALVAGE_RESULT_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::SALVAGE_RESULT_COMPLETE), - 2i32 => ::core::option::Option::Some(Self::SALVAGE_RESULT_PARTIAL), - 3i32 => ::core::option::Option::Some(Self::SALVAGE_RESULT_ALREADY_SALVAGED), - 4i32 => ::core::option::Option::Some(Self::SALVAGE_RESULT_REFUSED), - 5i32 => ::core::option::Option::Some(Self::SALVAGE_RESULT_INDETERMINATE), - 6i32 => ::core::option::Option::Some(Self::SALVAGE_RESULT_WOULD_SALVAGE), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::SALVAGE_RESULT_UNSPECIFIED => "SALVAGE_RESULT_UNSPECIFIED", - Self::SALVAGE_RESULT_COMPLETE => "SALVAGE_RESULT_COMPLETE", - Self::SALVAGE_RESULT_PARTIAL => "SALVAGE_RESULT_PARTIAL", - Self::SALVAGE_RESULT_ALREADY_SALVAGED => "SALVAGE_RESULT_ALREADY_SALVAGED", - Self::SALVAGE_RESULT_REFUSED => "SALVAGE_RESULT_REFUSED", - Self::SALVAGE_RESULT_INDETERMINATE => "SALVAGE_RESULT_INDETERMINATE", - Self::SALVAGE_RESULT_WOULD_SALVAGE => "SALVAGE_RESULT_WOULD_SALVAGE", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "SALVAGE_RESULT_UNSPECIFIED" => { - ::core::option::Option::Some(Self::SALVAGE_RESULT_UNSPECIFIED) - } - "SALVAGE_RESULT_COMPLETE" => { - ::core::option::Option::Some(Self::SALVAGE_RESULT_COMPLETE) - } - "SALVAGE_RESULT_PARTIAL" => { - ::core::option::Option::Some(Self::SALVAGE_RESULT_PARTIAL) - } - "SALVAGE_RESULT_ALREADY_SALVAGED" => { - ::core::option::Option::Some(Self::SALVAGE_RESULT_ALREADY_SALVAGED) - } - "SALVAGE_RESULT_REFUSED" => { - ::core::option::Option::Some(Self::SALVAGE_RESULT_REFUSED) - } - "SALVAGE_RESULT_INDETERMINATE" => { - ::core::option::Option::Some(Self::SALVAGE_RESULT_INDETERMINATE) - } - "SALVAGE_RESULT_WOULD_SALVAGE" => { - ::core::option::Option::Some(Self::SALVAGE_RESULT_WOULD_SALVAGE) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::SALVAGE_RESULT_UNSPECIFIED, - Self::SALVAGE_RESULT_COMPLETE, - Self::SALVAGE_RESULT_PARTIAL, - Self::SALVAGE_RESULT_ALREADY_SALVAGED, - Self::SALVAGE_RESULT_REFUSED, - Self::SALVAGE_RESULT_INDETERMINATE, - Self::SALVAGE_RESULT_WOULD_SALVAGE, - ] - } -} -/// RefusalReason is the specific refusal. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum RefusalReason { - REFUSAL_REASON_UNSPECIFIED = 0i32, - REFUSAL_REASON_SOURCE_NOT_FOUND = 1i32, - /// Event order could not be established, so any session produced would be a - /// plausible-looking transcript in an order that never happened. - REFUSAL_REASON_ORDER_UNPROVEN = 2i32, - /// Nothing in the source could be read. An empty salvaged session would be a - /// new artifact claiming provenance it cannot support. - REFUSAL_REASON_NOTHING_RECOVERABLE = 3i32, - /// The source exceeds the limits allowed for one operation. - REFUSAL_REASON_SIZE_LIMIT = 4i32, - /// A stream already exists at the derived target id and is not the target this - /// identity would have produced. - REFUSAL_REASON_TARGET_DIVERGED = 5i32, - /// Another maintenance operation holds this session. - REFUSAL_REASON_OPERATION_IN_PROGRESS = 6i32, -} -impl RefusalReason { - ///Idiomatic alias for [`Self::REFUSAL_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::REFUSAL_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::REFUSAL_REASON_SOURCE_NOT_FOUND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SourceNotFound: Self = Self::REFUSAL_REASON_SOURCE_NOT_FOUND; - ///Idiomatic alias for [`Self::REFUSAL_REASON_ORDER_UNPROVEN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const OrderUnproven: Self = Self::REFUSAL_REASON_ORDER_UNPROVEN; - ///Idiomatic alias for [`Self::REFUSAL_REASON_NOTHING_RECOVERABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NothingRecoverable: Self = Self::REFUSAL_REASON_NOTHING_RECOVERABLE; - ///Idiomatic alias for [`Self::REFUSAL_REASON_SIZE_LIMIT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SizeLimit: Self = Self::REFUSAL_REASON_SIZE_LIMIT; - ///Idiomatic alias for [`Self::REFUSAL_REASON_TARGET_DIVERGED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const TargetDiverged: Self = Self::REFUSAL_REASON_TARGET_DIVERGED; - ///Idiomatic alias for [`Self::REFUSAL_REASON_OPERATION_IN_PROGRESS`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const OperationInProgress: Self = Self::REFUSAL_REASON_OPERATION_IN_PROGRESS; -} -impl ::core::default::Default for RefusalReason { - fn default() -> Self { - Self::REFUSAL_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for RefusalReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for RefusalReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = RefusalReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(RefusalReason)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for RefusalReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for RefusalReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::REFUSAL_REASON_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::REFUSAL_REASON_SOURCE_NOT_FOUND), - 2i32 => ::core::option::Option::Some(Self::REFUSAL_REASON_ORDER_UNPROVEN), - 3i32 => { - ::core::option::Option::Some(Self::REFUSAL_REASON_NOTHING_RECOVERABLE) - } - 4i32 => ::core::option::Option::Some(Self::REFUSAL_REASON_SIZE_LIMIT), - 5i32 => ::core::option::Option::Some(Self::REFUSAL_REASON_TARGET_DIVERGED), - 6i32 => { - ::core::option::Option::Some(Self::REFUSAL_REASON_OPERATION_IN_PROGRESS) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::REFUSAL_REASON_UNSPECIFIED => "REFUSAL_REASON_UNSPECIFIED", - Self::REFUSAL_REASON_SOURCE_NOT_FOUND => "REFUSAL_REASON_SOURCE_NOT_FOUND", - Self::REFUSAL_REASON_ORDER_UNPROVEN => "REFUSAL_REASON_ORDER_UNPROVEN", - Self::REFUSAL_REASON_NOTHING_RECOVERABLE => { - "REFUSAL_REASON_NOTHING_RECOVERABLE" - } - Self::REFUSAL_REASON_SIZE_LIMIT => "REFUSAL_REASON_SIZE_LIMIT", - Self::REFUSAL_REASON_TARGET_DIVERGED => "REFUSAL_REASON_TARGET_DIVERGED", - Self::REFUSAL_REASON_OPERATION_IN_PROGRESS => { - "REFUSAL_REASON_OPERATION_IN_PROGRESS" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "REFUSAL_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::REFUSAL_REASON_UNSPECIFIED) - } - "REFUSAL_REASON_SOURCE_NOT_FOUND" => { - ::core::option::Option::Some(Self::REFUSAL_REASON_SOURCE_NOT_FOUND) - } - "REFUSAL_REASON_ORDER_UNPROVEN" => { - ::core::option::Option::Some(Self::REFUSAL_REASON_ORDER_UNPROVEN) - } - "REFUSAL_REASON_NOTHING_RECOVERABLE" => { - ::core::option::Option::Some(Self::REFUSAL_REASON_NOTHING_RECOVERABLE) - } - "REFUSAL_REASON_SIZE_LIMIT" => { - ::core::option::Option::Some(Self::REFUSAL_REASON_SIZE_LIMIT) - } - "REFUSAL_REASON_TARGET_DIVERGED" => { - ::core::option::Option::Some(Self::REFUSAL_REASON_TARGET_DIVERGED) - } - "REFUSAL_REASON_OPERATION_IN_PROGRESS" => { - ::core::option::Option::Some(Self::REFUSAL_REASON_OPERATION_IN_PROGRESS) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::REFUSAL_REASON_UNSPECIFIED, - Self::REFUSAL_REASON_SOURCE_NOT_FOUND, - Self::REFUSAL_REASON_ORDER_UNPROVEN, - Self::REFUSAL_REASON_NOTHING_RECOVERABLE, - Self::REFUSAL_REASON_SIZE_LIMIT, - Self::REFUSAL_REASON_TARGET_DIVERGED, - Self::REFUSAL_REASON_OPERATION_IN_PROGRESS, - ] - } -} -/// The durable record of a Session salvage. -/// -/// A salvage copies what can be read from a damaged session into a new session -/// identity. It is the opposite of a migration on every axis that matters: -/// -/// | | migration | salvage | -/// | identity | preserved | new | -/// | ordinals | preserved exactly | not preserved | -/// | source | must be intact | is damaged | -/// | source after | replaced | untouched | -/// | loss | inadmissible | expected and enumerated | -/// -/// It is also not ForkSession. A fork inherits a prefix it assumes is valid and -/// references it in place, so the source must stay readable forever. A salvage -/// exists because the source's validity is incomplete, so it copies, and the -/// copy is a different session that must never be presented as the original. -/// -/// SalvageIdentity is the retry identity of a salvage. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SalvageIdentity { - /// Field 1: `source_session_id` - #[serde( - rename = "sourceSessionId", - alias = "source_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub source_session_id: ::buffa::alloc::string::String, - /// Chosen by the operator or orchestrator. Two salvages of one damaged source - /// are legitimately different operations, so identity cannot be derived from - /// the source alone. - /// - /// Field 2: `salvage_key` - #[serde( - rename = "salvageKey", - alias = "salvage_key", - with = "::buffa::json_helpers::proto_string" - )] - pub salvage_key: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for SalvageIdentity { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SalvageIdentity") - .field("source_session_id", &self.source_session_id) - .field("salvage_key", &self.salvage_key) - .finish() - } -} -impl SalvageIdentity { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageIdentity"; -} -::buffa::impl_default_instance!(SalvageIdentity); -impl ::buffa::MessageName for SalvageIdentity { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "SalvageIdentity"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.SalvageIdentity"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageIdentity"; -} -impl ::buffa::Message for SalvageIdentity { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.salvage_key) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - ::buffa::types::put_string_field(2u32, &self.salvage_key, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.source_session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.salvage_key, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.source_session_id.clear(); - self.salvage_key.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SalvageIdentity { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SALVAGE_IDENTITY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageIdentity", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// SalvageIntent is written durably before the target session is created. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SalvageIntent { - /// Field 1: `identity` - #[serde(rename = "identity")] - pub identity: ::buffa::MessageField< - SalvageIdentity, - ::buffa::Inline, - >, - /// Field 2: `source` - #[serde(rename = "source")] - pub source: ::buffa::MessageField>, - /// The id the salvaged session will have, derived from the identity before any - /// write is attempted. - /// - /// Deriving it is what makes a retry safe. The salvaged session is created by - /// an atomic batch under a NoStream precondition, so a retry that lands on the - /// same id sees a visible conflict instead of producing a second copy. A - /// randomly minted id would leave a retry unable to find its own prior work, - /// which is the same trap the migration reconciler exists to escape, closed - /// here by the write precondition rather than by a later comparison. - /// - /// Field 3: `target_session_id` - #[serde( - rename = "targetSessionId", - alias = "target_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub target_session_id: ::buffa::alloc::string::String, - /// Field 4: `order_proof` - #[serde( - rename = "orderProof", - alias = "order_proof", - with = "::buffa::json_helpers::proto_enum" - )] - pub order_proof: ::buffa::EnumValue, - /// Field 5: `actor` - #[serde(rename = "actor", with = "::buffa::json_helpers::proto_string")] - pub actor: ::buffa::alloc::string::String, - /// Field 6: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_string")] - pub reason: ::buffa::alloc::string::String, - /// Field 7: `planned_at` - #[serde(rename = "plannedAt", alias = "planned_at")] - pub planned_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for SalvageIntent { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SalvageIntent") - .field("identity", &self.identity) - .field("source", &self.source) - .field("target_session_id", &self.target_session_id) - .field("order_proof", &self.order_proof) - .field("actor", &self.actor) - .field("reason", &self.reason) - .field("planned_at", &self.planned_at) - .finish() - } -} -impl SalvageIntent { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageIntent"; -} -::buffa::impl_default_instance!(SalvageIntent); -impl ::buffa::MessageName for SalvageIntent { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "SalvageIntent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.SalvageIntent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageIntent"; -} -impl ::buffa::Message for SalvageIntent { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.identity.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.identity.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.source.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.target_session_id) as u64; - { - let val = self.order_proof.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.actor) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.reason) as u64; - if self.planned_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.planned_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.identity.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.identity.write_to(__cache, buf); - } - if self.source.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source.write_to(__cache, buf); - } - ::buffa::types::put_string_field(3u32, &self.target_session_id, buf); - ::buffa::types::put_int32_field(4u32, self.order_proof.to_i32(), buf); - ::buffa::types::put_string_field(5u32, &self.actor, buf); - ::buffa::types::put_string_field(6u32, &self.reason, buf); - if self.planned_at.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.planned_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.identity.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.source.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.target_session_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.order_proof = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.actor, buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.reason, buf)?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.planned_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.identity = ::buffa::MessageField::none(); - self.source = ::buffa::MessageField::none(); - self.target_session_id.clear(); - self.order_proof = ::buffa::EnumValue::from(0); - self.actor.clear(); - self.reason.clear(); - self.planned_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SalvageIntent { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SALVAGE_INTENT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageIntent", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// SalvageRecord is the intent plus everything learned since. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SalvageRecord { - /// Field 1: `intent` - #[serde(rename = "intent")] - pub intent: ::buffa::MessageField>, - /// Field 2: `state` - #[serde(rename = "state", with = "::buffa::json_helpers::proto_enum")] - pub state: ::buffa::EnumValue, - /// Set only for MAINTENANCE_STATE_INDETERMINATE. - /// - /// Field 3: `indeterminate` - #[serde( - rename = "indeterminate", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub indeterminate: ::buffa::MessageField< - IndeterminateDetail, - ::buffa::Inline, - >, - /// Everything the source held that the salvaged session does not. - /// - /// Field 4: `omitted` - #[serde( - rename = "omitted", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub omitted: ::buffa::alloc::vec::Vec, - /// Field 5: `attempt_count` - #[serde( - rename = "attemptCount", - alias = "attempt_count", - with = "::buffa::json_helpers::uint32" - )] - pub attempt_count: u32, - /// Field 6: `updated_at` - #[serde(rename = "updatedAt", alias = "updated_at")] - pub updated_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for SalvageRecord { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SalvageRecord") - .field("intent", &self.intent) - .field("state", &self.state) - .field("indeterminate", &self.indeterminate) - .field("omitted", &self.omitted) - .field("attempt_count", &self.attempt_count) - .field("updated_at", &self.updated_at) - .finish() - } -} -impl SalvageRecord { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageRecord"; -} -::buffa::impl_default_instance!(SalvageRecord); -impl ::buffa::MessageName for SalvageRecord { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "SalvageRecord"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.SalvageRecord"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageRecord"; -} -impl ::buffa::Message for SalvageRecord { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.intent.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.intent.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.state.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.indeterminate.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.indeterminate.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.omitted { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.attempt_count) as u64; - if self.updated_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.updated_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.intent.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.intent.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(2u32, self.state.to_i32(), buf); - if self.indeterminate.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.indeterminate.write_to(__cache, buf); - } - for v in &self.omitted { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - ::buffa::types::put_uint32_field(5u32, self.attempt_count, buf); - if self.updated_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.updated_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.intent.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.state = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.indeterminate.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.omitted.push(elem); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.attempt_count = ::buffa::types::decode_uint32(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.updated_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.intent = ::buffa::MessageField::none(); - self.state = ::buffa::EnumValue::from(0); - self.indeterminate = ::buffa::MessageField::none(); - self.omitted.clear(); - self.attempt_count = 0u32; - self.updated_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SalvageRecord { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SALVAGE_RECORD_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageRecord", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// OmittedItem is one thing the salvage could not carry. -/// -/// Enumerated rather than counted. An operator told that three things were lost -/// cannot tell whether they were three tool results or three user messages, and -/// that difference decides whether the salvaged session is worth keeping. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct OmittedItem { - /// Field 1: `kind` - #[serde(rename = "kind", with = "::buffa::json_helpers::proto_enum")] - pub kind: ::buffa::EnumValue, - /// The source position, for an omission that had one. - /// - /// Field 2: `source_ordinal` - #[serde( - rename = "sourceOrdinal", - alias = "source_ordinal", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub source_ordinal: ::core::option::Option, - /// The artifact, checkpoint, or child session id, for an omission that had one. - /// - /// Field 3: `entity_id` - #[serde( - rename = "entityId", - alias = "entity_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub entity_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 4: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for OmittedItem { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("OmittedItem") - .field("kind", &self.kind) - .field("source_ordinal", &self.source_ordinal) - .field("entity_id", &self.entity_id) - .field("reason", &self.reason) - .finish() - } -} -impl OmittedItem { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.OmittedItem"; -} -impl OmittedItem { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::source_ordinal`] to `Some(value)`, consuming and returning `self`. - pub fn with_source_ordinal(mut self, value: u64) -> Self { - self.source_ordinal = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::entity_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_entity_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.entity_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(OmittedItem); -impl ::buffa::MessageName for OmittedItem { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "OmittedItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.OmittedItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.OmittedItem"; -} -impl ::buffa::Message for OmittedItem { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(v) = self.source_ordinal { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(ref v) = self.entity_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.kind.to_i32(), buf); - if let Some(v) = self.source_ordinal { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if let Some(ref v) = self.entity_id { - ::buffa::types::put_string_field(3u32, v, buf); - } - ::buffa::types::put_int32_field(4u32, self.reason.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.kind = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.source_ordinal = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .entity_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.kind = ::buffa::EnumValue::from(0); - self.source_ordinal = ::core::option::Option::None; - self.entity_id = ::core::option::Option::None; - self.reason = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for OmittedItem { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __OMITTED_ITEM_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.OmittedItem", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// RefusalDetail is why a salvage wrote nothing. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RefusalDetail { - /// Field 1: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// Field 2: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for RefusalDetail { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RefusalDetail") - .field("reason", &self.reason) - .field("detail", &self.detail) - .finish() - } -} -impl RefusalDetail { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.RefusalDetail"; -} -impl RefusalDetail { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(RefusalDetail); -impl ::buffa::MessageName for RefusalDetail { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "RefusalDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.RefusalDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.RefusalDetail"; -} -impl ::buffa::Message for RefusalDetail { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(2u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.reason = ::buffa::EnumValue::from(0); - self.detail = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for RefusalDetail { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REFUSAL_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.RefusalDetail", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.salvage_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.salvage_session.__view.rs deleted file mode 100644 index 99757981f..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.salvage_session.__view.rs +++ /dev/null @@ -1,1361 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/salvage_session.proto - -/// SalvageSession copies what can be read from a damaged session into a new -/// session identity, leaving the source untouched. -/// -/// Ordering of effects matches the migration and for the same reason: record the -/// intent, stage the copied artifacts, create the target session as one atomic -/// batch, validate. The source is never written to at any point, so a salvage -/// that fails halfway costs a partially staged target and nothing else. -#[derive(Clone, Debug, Default)] -pub struct SalvageSessionRequestView<'a> { - /// Field 1: `source_session_id` - pub source_session_id: &'a str, - /// Distinguishes this salvage from another salvage of the same source, and is - /// what the target session id is derived from. A caller retrying a salvage - /// must reuse it; a caller wanting a second, independent salvage must not. - /// - /// Field 2: `salvage_key` - pub salvage_key: &'a str, - /// Field 3: `actor` - pub actor: &'a str, - /// Field 4: `reason` - pub reason: &'a str, - /// Unset is PLAN_ONLY. - /// - /// Field 5: `mode` - pub mode: ::core::option::Option<::buffa::EnumValue>, - /// Workspace for the salvaged session. Needed only when the source's own - /// workspace could not be read, which is exactly the case a damaged source - /// makes likely. - /// - /// Field 6: `workspace_id` - pub workspace_id: ::core::option::Option<&'a str>, - /// Field 7: `limits` - pub limits: ::buffa::MessageFieldView< - super::super::__buffa::view::SalvageLimitsView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SalvageSessionRequestView<'a> { - /**Whether required field `source_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `salvage_key` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_salvage_key(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `actor` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_actor(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SalvageSessionRequestView<'a> { - type Owned = super::super::SalvageSessionRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.salvage_key = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.actor = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.mode = Some( - ::buffa::EnumValue::from(::buffa::types::decode_int32(&mut cur)?), - ); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.workspace_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.limits.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.limits = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::SalvageSessionRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::SalvageSessionRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SalvageSessionRequest { - source_session_id: self.source_session_id.to_string(), - salvage_key: self.salvage_key.to_string(), - actor: self.actor.to_string(), - reason: self.reason.to_string(), - mode: self.mode, - workspace_id: self.workspace_id.map(|s| s.to_string()), - limits: match self.limits.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SalvageLimits, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SalvageSessionRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.salvage_key) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.actor) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.reason) as u64; - if let Some(ref v) = self.mode { - size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; - } - if let Some(ref v) = self.workspace_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.limits.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.limits.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - ::buffa::types::put_string_field(2u32, &self.salvage_key, buf); - ::buffa::types::put_string_field(3u32, &self.actor, buf); - ::buffa::types::put_string_field(4u32, &self.reason, buf); - if let Some(ref v) = self.mode { - ::buffa::types::put_int32_field(5u32, v.to_i32(), buf); - } - if let Some(ref v) = self.workspace_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - if self.limits.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.limits.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SalvageSessionRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sourceSessionId", self.source_session_id)?; - } - { - __map.serialize_entry("salvageKey", self.salvage_key)?; - } - { - __map.serialize_entry("actor", self.actor)?; - } - { - __map.serialize_entry("reason", self.reason)?; - } - if let ::core::option::Option::Some(ref __v) = self.mode { - __map.serialize_entry("mode", __v)?; - } - if let ::core::option::Option::Some(__v) = self.workspace_id { - __map.serialize_entry("workspaceId", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.limits.as_option() { - __map.serialize_entry("limits", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SalvageSessionRequestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "SalvageSessionRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.SalvageSessionRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageSessionRequest"; -} -::buffa::impl_default_view_instance!(SalvageSessionRequestView); -::buffa::impl_view_reborrow!(SalvageSessionRequestView); -/** Self-contained, `'static` owned view of a `SalvageSessionRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`SalvageSessionRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SalvageSessionRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SalvageSessionRequestOwnedView( - ::buffa::OwnedView>, -); -impl SalvageSessionRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageSessionRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageSessionRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SalvageSessionRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageSessionRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SalvageSessionRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SalvageSessionRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SalvageSessionRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `source_session_id` - #[must_use] - pub fn source_session_id(&self) -> &'_ str { - self.0.reborrow().source_session_id - } - /// Distinguishes this salvage from another salvage of the same source, and is - /// what the target session id is derived from. A caller retrying a salvage - /// must reuse it; a caller wanting a second, independent salvage must not. - /// - /// Field 2: `salvage_key` - #[must_use] - pub fn salvage_key(&self) -> &'_ str { - self.0.reborrow().salvage_key - } - /// Field 3: `actor` - #[must_use] - pub fn actor(&self) -> &'_ str { - self.0.reborrow().actor - } - /// Field 4: `reason` - #[must_use] - pub fn reason(&self) -> &'_ str { - self.0.reborrow().reason - } - /// Unset is PLAN_ONLY. - /// - /// Field 5: `mode` - #[must_use] - pub fn mode( - &self, - ) -> ::core::option::Option<::buffa::EnumValue> { - self.0.reborrow().mode - } - /// Workspace for the salvaged session. Needed only when the source's own - /// workspace could not be read, which is exactly the case a damaged source - /// makes likely. - /// - /// Field 6: `workspace_id` - #[must_use] - pub fn workspace_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().workspace_id - } - /// Field 7: `limits` - #[must_use] - pub fn limits( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().limits - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SalvageSessionRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SalvageSessionRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SalvageSessionRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SalvageSessionRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SalvageSessionRequest { - type View<'a> = SalvageSessionRequestView<'a>; - type ViewHandle = SalvageSessionRequestOwnedView; -} -impl ::serde::Serialize for SalvageSessionRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// SalvageLimits bounds one call. -#[derive(Clone, Debug, Default)] -pub struct SalvageLimitsView<'a> { - /// Field 1: `max_source_events` - pub max_source_events: ::core::option::Option, - /// Field 2: `max_source_bytes` - pub max_source_bytes: ::core::option::Option, - /// Field 3: `max_artifacts_verified` - pub max_artifacts_verified: ::core::option::Option, - /// Field 4: `max_duration` - pub max_duration: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, -} -impl<'a> ::buffa::MessageView<'a> for SalvageLimitsView<'a> { - type Owned = super::super::SalvageLimits; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.max_source_events = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.max_source_bytes = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.max_artifacts_verified = Some( - ::buffa::types::decode_uint64(&mut cur)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.max_duration.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.max_duration = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SalvageLimits { - max_source_events: self.max_source_events, - max_source_bytes: self.max_source_bytes, - max_artifacts_verified: self.max_artifacts_verified, - max_duration: match self.max_duration.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SalvageLimitsView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(v) = self.max_source_events { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.max_source_bytes { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.max_artifacts_verified { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.max_duration.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.max_duration.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(v) = self.max_source_events { - ::buffa::types::put_uint64_field(1u32, v, buf); - } - if let Some(v) = self.max_source_bytes { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if let Some(v) = self.max_artifacts_verified { - ::buffa::types::put_uint64_field(3u32, v, buf); - } - if self.max_duration.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.max_duration.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SalvageLimitsView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - if let ::core::option::Option::Some(__v) = self.max_source_events { - __map - .serialize_entry( - "maxSourceEvents", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.max_source_bytes { - __map - .serialize_entry( - "maxSourceBytes", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.max_artifacts_verified { - __map - .serialize_entry( - "maxArtifactsVerified", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.max_duration.as_option() { - __map.serialize_entry("maxDuration", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SalvageLimitsView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "SalvageLimits"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.SalvageLimits"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageLimits"; -} -::buffa::impl_default_view_instance!(SalvageLimitsView); -::buffa::impl_view_reborrow!(SalvageLimitsView); -/** Self-contained, `'static` owned view of a `SalvageLimits` message. - - Wraps [`::buffa::OwnedView`]`<`[`SalvageLimitsView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SalvageLimitsView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SalvageLimitsOwnedView(::buffa::OwnedView>); -impl SalvageLimitsOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageLimitsOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageLimitsOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SalvageLimits, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageLimitsOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SalvageLimitsView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SalvageLimitsView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SalvageLimits { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `max_source_events` - #[must_use] - pub fn max_source_events(&self) -> ::core::option::Option { - self.0.reborrow().max_source_events - } - /// Field 2: `max_source_bytes` - #[must_use] - pub fn max_source_bytes(&self) -> ::core::option::Option { - self.0.reborrow().max_source_bytes - } - /// Field 3: `max_artifacts_verified` - #[must_use] - pub fn max_artifacts_verified(&self) -> ::core::option::Option { - self.0.reborrow().max_artifacts_verified - } - /// Field 4: `max_duration` - #[must_use] - pub fn max_duration( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().max_duration - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SalvageLimitsOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SalvageLimitsOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SalvageLimitsOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SalvageLimitsOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SalvageLimits { - type View<'a> = SalvageLimitsView<'a>; - type ViewHandle = SalvageLimitsOwnedView; -} -impl ::serde::Serialize for SalvageLimitsOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -#[derive(Clone, Debug, Default)] -pub struct SalvageSessionResponseView<'a> { - /// Field 1: `result` - pub result: ::buffa::EnumValue, - /// Always present, including on refusal. - /// - /// Field 2: `record` - pub record: ::buffa::MessageFieldView< - super::super::__buffa::view::SalvageRecordView<'a>, - >, - /// The derived id, present even when nothing was written, so a caller can find - /// the target of a call whose response it never received. - /// - /// Field 3: `target_session_id` - pub target_session_id: &'a str, - /// Set only for SALVAGE_RESULT_REFUSED. - /// - /// Field 4: `refused` - pub refused: ::buffa::MessageFieldView< - super::super::__buffa::view::RefusalDetailView<'a>, - >, - /// Field 5: `observed_at` - pub observed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SalvageSessionResponseView<'a> { - /**Whether required field `result` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_result(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `record` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_record(&self) -> bool { - self.record.is_set() - } - /**Whether required field `target_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_target_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `observed_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_observed_at(&self) -> bool { - self.observed_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for SalvageSessionResponseView<'a> { - type Owned = super::super::SalvageSessionResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.result = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.record.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.record = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.target_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.refused.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.refused = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::SalvageSessionResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::SalvageSessionResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SalvageSessionResponse { - result: self.result, - record: match self.record.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SalvageRecord, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - target_session_id: self.target_session_id.to_string(), - refused: match self.refused.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::RefusalDetail, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - observed_at: match self.observed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SalvageSessionResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.result.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.record.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.record.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.target_session_id) as u64; - if self.refused.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.refused.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.result.to_i32(), buf); - if self.record.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.record.write_to(__cache, buf); - } - ::buffa::types::put_string_field(3u32, &self.target_session_id, buf); - if self.refused.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.refused.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SalvageSessionResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("result", &self.result)?; - } - { - if let ::core::option::Option::Some(__v) = self.record.as_option() { - __map.serialize_entry("record", __v)?; - } - } - { - __map.serialize_entry("targetSessionId", self.target_session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.refused.as_option() { - __map.serialize_entry("refused", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.observed_at.as_option() { - __map.serialize_entry("observedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SalvageSessionResponseView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "SalvageSessionResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.SalvageSessionResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageSessionResponse"; -} -::buffa::impl_default_view_instance!(SalvageSessionResponseView); -::buffa::impl_view_reborrow!(SalvageSessionResponseView); -/** Self-contained, `'static` owned view of a `SalvageSessionResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`SalvageSessionResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SalvageSessionResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SalvageSessionResponseOwnedView( - ::buffa::OwnedView>, -); -impl SalvageSessionResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageSessionResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageSessionResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SalvageSessionResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SalvageSessionResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SalvageSessionResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SalvageSessionResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SalvageSessionResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `result` - #[must_use] - pub fn result(&self) -> ::buffa::EnumValue { - self.0.reborrow().result - } - /// Always present, including on refusal. - /// - /// Field 2: `record` - #[must_use] - pub fn record( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().record - } - /// The derived id, present even when nothing was written, so a caller can find - /// the target of a call whose response it never received. - /// - /// Field 3: `target_session_id` - #[must_use] - pub fn target_session_id(&self) -> &'_ str { - self.0.reborrow().target_session_id - } - /// Set only for SALVAGE_RESULT_REFUSED. - /// - /// Field 4: `refused` - #[must_use] - pub fn refused( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().refused - } - /// Field 5: `observed_at` - #[must_use] - pub fn observed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().observed_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SalvageSessionResponseOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SalvageSessionResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SalvageSessionResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SalvageSessionResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SalvageSessionResponse { - type View<'a> = SalvageSessionResponseView<'a>; - type ViewHandle = SalvageSessionResponseOwnedView; -} -impl ::serde::Serialize for SalvageSessionResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.salvage_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.salvage_session.rs deleted file mode 100644 index f5578c7d6..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.salvage_session.rs +++ /dev/null @@ -1,894 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/salvage_session.proto - -/// SalvageMode is whether this call may write. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum SalvageMode { - SALVAGE_MODE_UNSPECIFIED = 0i32, - /// Read the source, decide what would be carried, write nothing. - SALVAGE_MODE_PLAN_ONLY = 1i32, - SALVAGE_MODE_COMMIT = 2i32, -} -impl SalvageMode { - ///Idiomatic alias for [`Self::SALVAGE_MODE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::SALVAGE_MODE_UNSPECIFIED; - ///Idiomatic alias for [`Self::SALVAGE_MODE_PLAN_ONLY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const PlanOnly: Self = Self::SALVAGE_MODE_PLAN_ONLY; - ///Idiomatic alias for [`Self::SALVAGE_MODE_COMMIT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Commit: Self = Self::SALVAGE_MODE_COMMIT; -} -impl ::core::default::Default for SalvageMode { - fn default() -> Self { - Self::SALVAGE_MODE_UNSPECIFIED - } -} -impl ::serde::Serialize for SalvageMode { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for SalvageMode { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = SalvageMode; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(SalvageMode)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for SalvageMode { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for SalvageMode { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::SALVAGE_MODE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::SALVAGE_MODE_PLAN_ONLY), - 2i32 => ::core::option::Option::Some(Self::SALVAGE_MODE_COMMIT), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::SALVAGE_MODE_UNSPECIFIED => "SALVAGE_MODE_UNSPECIFIED", - Self::SALVAGE_MODE_PLAN_ONLY => "SALVAGE_MODE_PLAN_ONLY", - Self::SALVAGE_MODE_COMMIT => "SALVAGE_MODE_COMMIT", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "SALVAGE_MODE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::SALVAGE_MODE_UNSPECIFIED) - } - "SALVAGE_MODE_PLAN_ONLY" => { - ::core::option::Option::Some(Self::SALVAGE_MODE_PLAN_ONLY) - } - "SALVAGE_MODE_COMMIT" => { - ::core::option::Option::Some(Self::SALVAGE_MODE_COMMIT) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::SALVAGE_MODE_UNSPECIFIED, - Self::SALVAGE_MODE_PLAN_ONLY, - Self::SALVAGE_MODE_COMMIT, - ] - } -} -/// SalvageSession copies what can be read from a damaged session into a new -/// session identity, leaving the source untouched. -/// -/// Ordering of effects matches the migration and for the same reason: record the -/// intent, stage the copied artifacts, create the target session as one atomic -/// batch, validate. The source is never written to at any point, so a salvage -/// that fails halfway costs a partially staged target and nothing else. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SalvageSessionRequest { - /// Field 1: `source_session_id` - #[serde( - rename = "sourceSessionId", - alias = "source_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub source_session_id: ::buffa::alloc::string::String, - /// Distinguishes this salvage from another salvage of the same source, and is - /// what the target session id is derived from. A caller retrying a salvage - /// must reuse it; a caller wanting a second, independent salvage must not. - /// - /// Field 2: `salvage_key` - #[serde( - rename = "salvageKey", - alias = "salvage_key", - with = "::buffa::json_helpers::proto_string" - )] - pub salvage_key: ::buffa::alloc::string::String, - /// Field 3: `actor` - #[serde(rename = "actor", with = "::buffa::json_helpers::proto_string")] - pub actor: ::buffa::alloc::string::String, - /// Field 4: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_string")] - pub reason: ::buffa::alloc::string::String, - /// Unset is PLAN_ONLY. - /// - /// Field 5: `mode` - #[serde( - rename = "mode", - with = "::buffa::json_helpers::opt_enum", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub mode: ::core::option::Option<::buffa::EnumValue>, - /// Workspace for the salvaged session. Needed only when the source's own - /// workspace could not be read, which is exactly the case a damaged source - /// makes likely. - /// - /// Field 6: `workspace_id` - #[serde( - rename = "workspaceId", - alias = "workspace_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub workspace_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 7: `limits` - #[serde( - rename = "limits", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub limits: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for SalvageSessionRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SalvageSessionRequest") - .field("source_session_id", &self.source_session_id) - .field("salvage_key", &self.salvage_key) - .field("actor", &self.actor) - .field("reason", &self.reason) - .field("mode", &self.mode) - .field("workspace_id", &self.workspace_id) - .field("limits", &self.limits) - .finish() - } -} -impl SalvageSessionRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageSessionRequest"; -} -impl SalvageSessionRequest { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::mode`] to `Some(value)`, consuming and returning `self`. - pub fn with_mode( - mut self, - value: impl Into<::buffa::EnumValue>, - ) -> Self { - self.mode = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::workspace_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_workspace_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.workspace_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(SalvageSessionRequest); -impl ::buffa::MessageName for SalvageSessionRequest { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "SalvageSessionRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.SalvageSessionRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageSessionRequest"; -} -impl ::buffa::Message for SalvageSessionRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.salvage_key) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.actor) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.reason) as u64; - if let Some(ref v) = self.mode { - size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; - } - if let Some(ref v) = self.workspace_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.limits.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.limits.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - ::buffa::types::put_string_field(2u32, &self.salvage_key, buf); - ::buffa::types::put_string_field(3u32, &self.actor, buf); - ::buffa::types::put_string_field(4u32, &self.reason, buf); - if let Some(ref v) = self.mode { - ::buffa::types::put_int32_field(5u32, v.to_i32(), buf); - } - if let Some(ref v) = self.workspace_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - if self.limits.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.limits.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.source_session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.salvage_key, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.actor, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.reason, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.mode = ::core::option::Option::Some( - ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?), - ); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .workspace_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.limits.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.source_session_id.clear(); - self.salvage_key.clear(); - self.actor.clear(); - self.reason.clear(); - self.mode = ::core::option::Option::None; - self.workspace_id = ::core::option::Option::None; - self.limits = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SalvageSessionRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SALVAGE_SESSION_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageSessionRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// SalvageLimits bounds one call. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SalvageLimits { - /// Field 1: `max_source_events` - #[serde( - rename = "maxSourceEvents", - alias = "max_source_events", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub max_source_events: ::core::option::Option, - /// Field 2: `max_source_bytes` - #[serde( - rename = "maxSourceBytes", - alias = "max_source_bytes", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub max_source_bytes: ::core::option::Option, - /// Field 3: `max_artifacts_verified` - #[serde( - rename = "maxArtifactsVerified", - alias = "max_artifacts_verified", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub max_artifacts_verified: ::core::option::Option, - /// Field 4: `max_duration` - #[serde( - rename = "maxDuration", - alias = "max_duration", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub max_duration: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, -} -impl ::core::fmt::Debug for SalvageLimits { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SalvageLimits") - .field("max_source_events", &self.max_source_events) - .field("max_source_bytes", &self.max_source_bytes) - .field("max_artifacts_verified", &self.max_artifacts_verified) - .field("max_duration", &self.max_duration) - .finish() - } -} -impl SalvageLimits { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageLimits"; -} -impl SalvageLimits { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::max_source_events`] to `Some(value)`, consuming and returning `self`. - pub fn with_max_source_events(mut self, value: u64) -> Self { - self.max_source_events = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::max_source_bytes`] to `Some(value)`, consuming and returning `self`. - pub fn with_max_source_bytes(mut self, value: u64) -> Self { - self.max_source_bytes = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::max_artifacts_verified`] to `Some(value)`, consuming and returning `self`. - pub fn with_max_artifacts_verified(mut self, value: u64) -> Self { - self.max_artifacts_verified = Some(value); - self - } -} -::buffa::impl_default_instance!(SalvageLimits); -impl ::buffa::MessageName for SalvageLimits { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "SalvageLimits"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.SalvageLimits"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageLimits"; -} -impl ::buffa::Message for SalvageLimits { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(v) = self.max_source_events { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.max_source_bytes { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.max_artifacts_verified { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.max_duration.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.max_duration.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(v) = self.max_source_events { - ::buffa::types::put_uint64_field(1u32, v, buf); - } - if let Some(v) = self.max_source_bytes { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if let Some(v) = self.max_artifacts_verified { - ::buffa::types::put_uint64_field(3u32, v, buf); - } - if self.max_duration.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.max_duration.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.max_source_events = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.max_source_bytes = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.max_artifacts_verified = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.max_duration.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.max_source_events = ::core::option::Option::None; - self.max_source_bytes = ::core::option::Option::None; - self.max_artifacts_verified = ::core::option::Option::None; - self.max_duration = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SalvageLimits { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SALVAGE_LIMITS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageLimits", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SalvageSessionResponse { - /// Field 1: `result` - #[serde(rename = "result", with = "::buffa::json_helpers::proto_enum")] - pub result: ::buffa::EnumValue, - /// Always present, including on refusal. - /// - /// Field 2: `record` - #[serde(rename = "record")] - pub record: ::buffa::MessageField>, - /// The derived id, present even when nothing was written, so a caller can find - /// the target of a call whose response it never received. - /// - /// Field 3: `target_session_id` - #[serde( - rename = "targetSessionId", - alias = "target_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub target_session_id: ::buffa::alloc::string::String, - /// Set only for SALVAGE_RESULT_REFUSED. - /// - /// Field 4: `refused` - #[serde( - rename = "refused", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub refused: ::buffa::MessageField>, - /// Field 5: `observed_at` - #[serde(rename = "observedAt", alias = "observed_at")] - pub observed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for SalvageSessionResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SalvageSessionResponse") - .field("result", &self.result) - .field("record", &self.record) - .field("target_session_id", &self.target_session_id) - .field("refused", &self.refused) - .field("observed_at", &self.observed_at) - .finish() - } -} -impl SalvageSessionResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageSessionResponse"; -} -::buffa::impl_default_instance!(SalvageSessionResponse); -impl ::buffa::MessageName for SalvageSessionResponse { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "SalvageSessionResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.SalvageSessionResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageSessionResponse"; -} -impl ::buffa::Message for SalvageSessionResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.result.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.record.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.record.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.target_session_id) as u64; - if self.refused.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.refused.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.result.to_i32(), buf); - if self.record.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.record.write_to(__cache, buf); - } - ::buffa::types::put_string_field(3u32, &self.target_session_id, buf); - if self.refused.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.refused.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.result = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.record.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.target_session_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.refused.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.result = ::buffa::EnumValue::from(0); - self.record = ::buffa::MessageField::none(); - self.target_session_id.clear(); - self.refused = ::buffa::MessageField::none(); - self.observed_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SalvageSessionResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SALVAGE_SESSION_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.SalvageSessionResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.stream_boundary.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.stream_boundary.__view.rs deleted file mode 100644 index 16728624c..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.stream_boundary.__view.rs +++ /dev/null @@ -1,708 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/stream_boundary.proto - -/// Value types shared by the Session maintenance workflows: migration and -/// salvage. -/// -/// Redefined here rather than imported from the write side, following the rule -/// ADR#0035 facet 3 applies to the state, projections, and checkpoints subtrees. -/// A maintenance record outlives the schema it was written under -- that is the -/// entire point of migration provenance -- so it must not be pinned to a -/// write-side type that a migration is free to change. -/// -/// StreamBoundary names an exact cut of one session's own logical stream: how -/// far it extends and what the content at that extent is. -/// -/// Both workflows pin against one, and every indeterminate outcome is ultimately -/// the statement that an observed boundary did not match an expected one. -#[derive(Clone, Debug, Default)] -pub struct StreamBoundaryView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// The 1-indexed SessionOrdinal of the last event in the cut. Fold-derived, - /// never a JetStream sequence, so it survives restore and relocation. - /// - /// Field 2: `ordinal` - pub ordinal: u64, - /// Field 3: `content_digest` - pub content_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::ContentDigestView<'a>, - >, - /// Which incarnation of the physical stream this cut was taken from: the - /// subject token that isolates one incarnation's subject space from the next, - /// per ADR#0059. Required, because an unset incarnation is not "the same - /// incarnation" and a comparison against one can never fail. - /// - /// A migration's source names the retiring incarnation and its expected target - /// names the new one. Two boundaries carrying different incarnations are not - /// comparable by ordinal, and treating them as comparable is the failure - /// INDETERMINATE_REASON_SOURCE_INCARNATION_CHANGED exists to report. - /// - /// Field 4: `incarnation` - pub incarnation: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> StreamBoundaryView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `ordinal` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ordinal(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `content_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_content_digest(&self) -> bool { - self.content_digest.is_set() - } - /**Whether required field `incarnation` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_incarnation(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for StreamBoundaryView<'a> { - type Owned = super::super::StreamBoundary; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.ordinal = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.content_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.content_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.incarnation = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::StreamBoundary { - session_id: self.session_id.to_string(), - ordinal: self.ordinal, - content_digest: match self.content_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContentDigest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - incarnation: self.incarnation.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for StreamBoundaryView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.ordinal) as u64; - if self.content_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.content_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.incarnation) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_uint64_field(2u32, self.ordinal, buf); - if self.content_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.content_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.incarnation, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for StreamBoundaryView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map - .serialize_entry( - "ordinal", - &::buffa::json_helpers::ProtoJson(&self.ordinal), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.content_digest.as_option() { - __map.serialize_entry("contentDigest", __v)?; - } - } - { - __map.serialize_entry("incarnation", self.incarnation)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for StreamBoundaryView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "StreamBoundary"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.StreamBoundary"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.StreamBoundary"; -} -::buffa::impl_default_view_instance!(StreamBoundaryView); -::buffa::impl_view_reborrow!(StreamBoundaryView); -/** Self-contained, `'static` owned view of a `StreamBoundary` message. - - Wraps [`::buffa::OwnedView`]`<`[`StreamBoundaryView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`StreamBoundaryView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct StreamBoundaryOwnedView(::buffa::OwnedView>); -impl StreamBoundaryOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StreamBoundaryOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StreamBoundaryOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::StreamBoundary, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StreamBoundaryOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`StreamBoundaryView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &StreamBoundaryView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::StreamBoundary { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// The 1-indexed SessionOrdinal of the last event in the cut. Fold-derived, - /// never a JetStream sequence, so it survives restore and relocation. - /// - /// Field 2: `ordinal` - #[must_use] - pub fn ordinal(&self) -> u64 { - self.0.reborrow().ordinal - } - /// Field 3: `content_digest` - #[must_use] - pub fn content_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().content_digest - } - /// Which incarnation of the physical stream this cut was taken from: the - /// subject token that isolates one incarnation's subject space from the next, - /// per ADR#0059. Required, because an unset incarnation is not "the same - /// incarnation" and a comparison against one can never fail. - /// - /// A migration's source names the retiring incarnation and its expected target - /// names the new one. Two boundaries carrying different incarnations are not - /// comparable by ordinal, and treating them as comparable is the failure - /// INDETERMINATE_REASON_SOURCE_INCARNATION_CHANGED exists to report. - /// - /// Field 4: `incarnation` - #[must_use] - pub fn incarnation(&self) -> &'_ str { - self.0.reborrow().incarnation - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for StreamBoundaryOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - StreamBoundaryOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: StreamBoundaryOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for StreamBoundaryOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::StreamBoundary { - type View<'a> = StreamBoundaryView<'a>; - type ViewHandle = StreamBoundaryOwnedView; -} -impl ::serde::Serialize for StreamBoundaryOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ContentDigest commits to the event bytes exactly as the log stores them. -/// -/// Never to a re-serialization. Protobuf encoding is not canonical, so a digest -/// taken over a decode-then-re-encode round trip would not reproduce, and a -/// workflow whose central check is "is this the same content" cannot be built on -/// a comparison that fails against bytes the system itself wrote. -#[derive(Clone, Debug, Default)] -pub struct ContentDigestView<'a> { - /// Field 1: `algorithm` - pub algorithm: &'a str, - /// Field 2: `value` - pub value: &'a [u8], - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ContentDigestView<'a> { - /**Whether required field `algorithm` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_algorithm(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `value` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_value(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ContentDigestView<'a> { - type Owned = super::super::ContentDigest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.algorithm = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.value = ::buffa::types::borrow_bytes(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ContentDigest { - algorithm: self.algorithm.to_string(), - value: (self.value).to_vec(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ContentDigestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.algorithm) as u64; - size += 1u64 + ::buffa::types::bytes_encoded_len(&self.value) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.algorithm, buf); - ::buffa::types::put_shared_bytes_field(2u32, &self.value, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ContentDigestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("algorithm", self.algorithm)?; - } - { - __map - .serialize_entry( - "value", - &::buffa::json_helpers::BytesJson(self.value), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ContentDigestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "ContentDigest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.ContentDigest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.ContentDigest"; -} -::buffa::impl_default_view_instance!(ContentDigestView); -::buffa::impl_view_reborrow!(ContentDigestView); -/** Self-contained, `'static` owned view of a `ContentDigest` message. - - Wraps [`::buffa::OwnedView`]`<`[`ContentDigestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ContentDigestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ContentDigestOwnedView(::buffa::OwnedView>); -impl ContentDigestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContentDigestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContentDigestOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ContentDigest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContentDigestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ContentDigestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ContentDigestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ContentDigest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `algorithm` - #[must_use] - pub fn algorithm(&self) -> &'_ str { - self.0.reborrow().algorithm - } - /// Field 2: `value` - #[must_use] - pub fn value(&self) -> &'_ [u8] { - self.0.reborrow().value - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ContentDigestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ContentDigestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ContentDigestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ContentDigestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ContentDigest { - type View<'a> = ContentDigestView<'a>; - type ViewHandle = ContentDigestOwnedView; -} -impl ::serde::Serialize for ContentDigestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.stream_boundary.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.stream_boundary.rs deleted file mode 100644 index 054af3987..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.maintenance.v1alpha1.stream_boundary.rs +++ /dev/null @@ -1,491 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/maintenance/v1alpha1/stream_boundary.proto - -/// OrderProof is how well the authoritative order of a source cut is known. -/// -/// A salvage that cannot establish order cannot produce a session, because a -/// transcript in the wrong order is worse than no transcript: it reads as -/// authoritative and is wrong. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum OrderProof { - ORDER_PROOF_UNSPECIFIED = 0i32, - /// Every position from 1 to the boundary is present and decoded. - ORDER_PROOF_CONTIGUOUS = 1i32, - /// Positions are missing, and every surviving event decoded and carries its - /// own position, so the relative order of what survives is known. The missing - /// positions are enumerated as omissions. - ORDER_PROOF_GAPPED = 2i32, - /// Order could not be established. Fail closed. - ORDER_PROOF_UNPROVEN = 3i32, -} -impl OrderProof { - ///Idiomatic alias for [`Self::ORDER_PROOF_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::ORDER_PROOF_UNSPECIFIED; - ///Idiomatic alias for [`Self::ORDER_PROOF_CONTIGUOUS`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Contiguous: Self = Self::ORDER_PROOF_CONTIGUOUS; - ///Idiomatic alias for [`Self::ORDER_PROOF_GAPPED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Gapped: Self = Self::ORDER_PROOF_GAPPED; - ///Idiomatic alias for [`Self::ORDER_PROOF_UNPROVEN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unproven: Self = Self::ORDER_PROOF_UNPROVEN; -} -impl ::core::default::Default for OrderProof { - fn default() -> Self { - Self::ORDER_PROOF_UNSPECIFIED - } -} -impl ::serde::Serialize for OrderProof { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for OrderProof { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = OrderProof; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(OrderProof)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for OrderProof { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for OrderProof { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::ORDER_PROOF_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::ORDER_PROOF_CONTIGUOUS), - 2i32 => ::core::option::Option::Some(Self::ORDER_PROOF_GAPPED), - 3i32 => ::core::option::Option::Some(Self::ORDER_PROOF_UNPROVEN), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::ORDER_PROOF_UNSPECIFIED => "ORDER_PROOF_UNSPECIFIED", - Self::ORDER_PROOF_CONTIGUOUS => "ORDER_PROOF_CONTIGUOUS", - Self::ORDER_PROOF_GAPPED => "ORDER_PROOF_GAPPED", - Self::ORDER_PROOF_UNPROVEN => "ORDER_PROOF_UNPROVEN", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "ORDER_PROOF_UNSPECIFIED" => { - ::core::option::Option::Some(Self::ORDER_PROOF_UNSPECIFIED) - } - "ORDER_PROOF_CONTIGUOUS" => { - ::core::option::Option::Some(Self::ORDER_PROOF_CONTIGUOUS) - } - "ORDER_PROOF_GAPPED" => { - ::core::option::Option::Some(Self::ORDER_PROOF_GAPPED) - } - "ORDER_PROOF_UNPROVEN" => { - ::core::option::Option::Some(Self::ORDER_PROOF_UNPROVEN) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::ORDER_PROOF_UNSPECIFIED, - Self::ORDER_PROOF_CONTIGUOUS, - Self::ORDER_PROOF_GAPPED, - Self::ORDER_PROOF_UNPROVEN, - ] - } -} -/// Value types shared by the Session maintenance workflows: migration and -/// salvage. -/// -/// Redefined here rather than imported from the write side, following the rule -/// ADR#0035 facet 3 applies to the state, projections, and checkpoints subtrees. -/// A maintenance record outlives the schema it was written under -- that is the -/// entire point of migration provenance -- so it must not be pinned to a -/// write-side type that a migration is free to change. -/// -/// StreamBoundary names an exact cut of one session's own logical stream: how -/// far it extends and what the content at that extent is. -/// -/// Both workflows pin against one, and every indeterminate outcome is ultimately -/// the statement that an observed boundary did not match an expected one. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct StreamBoundary { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// The 1-indexed SessionOrdinal of the last event in the cut. Fold-derived, - /// never a JetStream sequence, so it survives restore and relocation. - /// - /// Field 2: `ordinal` - #[serde(rename = "ordinal", with = "::buffa::json_helpers::uint64")] - pub ordinal: u64, - /// Field 3: `content_digest` - #[serde(rename = "contentDigest", alias = "content_digest")] - pub content_digest: ::buffa::MessageField< - ContentDigest, - ::buffa::Inline, - >, - /// Which incarnation of the physical stream this cut was taken from: the - /// subject token that isolates one incarnation's subject space from the next, - /// per ADR#0059. Required, because an unset incarnation is not "the same - /// incarnation" and a comparison against one can never fail. - /// - /// A migration's source names the retiring incarnation and its expected target - /// names the new one. Two boundaries carrying different incarnations are not - /// comparable by ordinal, and treating them as comparable is the failure - /// INDETERMINATE_REASON_SOURCE_INCARNATION_CHANGED exists to report. - /// - /// Field 4: `incarnation` - #[serde(rename = "incarnation", with = "::buffa::json_helpers::proto_string")] - pub incarnation: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for StreamBoundary { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("StreamBoundary") - .field("session_id", &self.session_id) - .field("ordinal", &self.ordinal) - .field("content_digest", &self.content_digest) - .field("incarnation", &self.incarnation) - .finish() - } -} -impl StreamBoundary { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.StreamBoundary"; -} -::buffa::impl_default_instance!(StreamBoundary); -impl ::buffa::MessageName for StreamBoundary { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "StreamBoundary"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.StreamBoundary"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.StreamBoundary"; -} -impl ::buffa::Message for StreamBoundary { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.ordinal) as u64; - if self.content_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.content_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.incarnation) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_uint64_field(2u32, self.ordinal, buf); - if self.content_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.content_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.incarnation, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.ordinal = ::buffa::types::decode_uint64(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.content_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.incarnation, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.ordinal = 0u64; - self.content_digest = ::buffa::MessageField::none(); - self.incarnation.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for StreamBoundary { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __STREAM_BOUNDARY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.StreamBoundary", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ContentDigest commits to the event bytes exactly as the log stores them. -/// -/// Never to a re-serialization. Protobuf encoding is not canonical, so a digest -/// taken over a decode-then-re-encode round trip would not reproduce, and a -/// workflow whose central check is "is this the same content" cannot be built on -/// a comparison that fails against bytes the system itself wrote. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ContentDigest { - /// Field 1: `algorithm` - #[serde(rename = "algorithm", with = "::buffa::json_helpers::proto_string")] - pub algorithm: ::buffa::alloc::string::String, - /// Field 2: `value` - #[serde(rename = "value", with = "::buffa::json_helpers::bytes")] - pub value: ::buffa::alloc::vec::Vec, -} -impl ::core::fmt::Debug for ContentDigest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ContentDigest") - .field("algorithm", &self.algorithm) - .field("value", &self.value) - .finish() - } -} -impl ContentDigest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.ContentDigest"; -} -::buffa::impl_default_instance!(ContentDigest); -impl ::buffa::MessageName for ContentDigest { - const PACKAGE: &'static str = "trogonai.session.sessions.maintenance.v1alpha1"; - const NAME: &'static str = "ContentDigest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.maintenance.v1alpha1.ContentDigest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.ContentDigest"; -} -impl ::buffa::Message for ContentDigest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.algorithm) as u64; - size += 1u64 + ::buffa::types::bytes_encoded_len(&self.value) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.algorithm, buf); - ::buffa::types::put_shared_bytes_field(2u32, &self.value, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.algorithm, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes(&mut self.value, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.algorithm.clear(); - self.value.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ContentDigest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CONTENT_DIGEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.maintenance.v1alpha1.ContentDigest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.contract_version.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.contract_version.__view.rs deleted file mode 100644 index b80e3400e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.contract_version.__view.rs +++ /dev/null @@ -1,715 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/contract_version.proto - -/// ContractVersion identifies a revision of the Session query contract. -/// -/// Every request declares the highest version its caller understands, and every -/// response reports the version it was actually rendered at. Without both halves -/// a client can only discover an incompatibility by failing to parse a response, -/// which is exactly the outcome this contract exists to prevent. -/// -/// Compatibility rule: -/// -/// - Same `major`: compatible. Anything added within a major is additive, so a -/// ```text -/// caller built against an earlier `minor` can still decode the response. -/// ``` -/// - Different `major`: unsupported. The caller must not attempt to interpret -/// ```text -/// the response, and the server must refuse the request with -/// QUERY_ERROR_CODE_UNSUPPORTED_CONTRACT_VERSION rather than answer in a -/// shape the caller cannot read. -/// ``` -/// -/// `minor` increments for additive changes only: a new optional field, a new -/// enum value, a new variant in a discriminated union. `major` increments for -/// anything a caller built against the prior version could misread: a removed -/// field, a narrowed type, a changed meaning. -#[derive(Clone, Debug, Default)] -pub struct ContractVersionView<'a> { - /// Incompatible revision. A caller must refuse a response whose major it does - /// not know, rather than interpret the fields it happens to recognize. - /// - /// Field 1: `major` - pub major: u32, - /// Additive revision within a major. - /// - /// Field 2: `minor` - pub minor: u32, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, - #[doc(hidden)] - pub __buffa_phantom: ::core::marker::PhantomData<&'a ()>, -} -impl<'a> ContractVersionView<'a> { - /**Whether required field `major` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_major(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `minor` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_minor(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ContractVersionView<'a> { - type Owned = super::super::ContractVersion; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.major = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.minor = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ContractVersion { - major: self.major, - minor: self.minor, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ContractVersionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.major) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.minor) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.major, buf); - ::buffa::types::put_uint32_field(2u32, self.minor, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ContractVersionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "major", - &::buffa::json_helpers::ProtoJson(&self.major), - )?; - } - { - __map - .serialize_entry( - "minor", - &::buffa::json_helpers::ProtoJson(&self.minor), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ContractVersionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ContractVersion"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ContractVersion"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ContractVersion"; -} -::buffa::impl_default_view_instance!(ContractVersionView); -::buffa::impl_view_reborrow!(ContractVersionView); -/** Self-contained, `'static` owned view of a `ContractVersion` message. - - Wraps [`::buffa::OwnedView`]`<`[`ContractVersionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ContractVersionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ContractVersionOwnedView(::buffa::OwnedView>); -impl ContractVersionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContractVersionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContractVersionOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ContractVersion, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContractVersionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ContractVersionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ContractVersionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ContractVersion { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Incompatible revision. A caller must refuse a response whose major it does - /// not know, rather than interpret the fields it happens to recognize. - /// - /// Field 1: `major` - #[must_use] - pub fn major(&self) -> u32 { - self.0.reborrow().major - } - /// Additive revision within a major. - /// - /// Field 2: `minor` - #[must_use] - pub fn minor(&self) -> u32 { - self.0.reborrow().minor - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ContractVersionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ContractVersionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ContractVersionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ContractVersionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ContractVersion { - type View<'a> = ContractVersionView<'a>; - type ViewHandle = ContractVersionOwnedView; -} -impl ::serde::Serialize for ContractVersionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ContractNegotiation is the version block every query response carries. -/// -/// It exists so that "the server understands more than I do" is a fact the -/// caller reads, rather than something it infers from a field it cannot see. -#[derive(Clone, Debug, Default)] -pub struct ContractNegotiationView<'a> { - /// The version this response was rendered at. It is never greater than the - /// caller's declared `accepted_contract`, because the server clamps its output - /// rather than emitting variants the caller cannot decode. - /// - /// Field 1: `rendered` - pub rendered: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'a>, - >, - /// The highest version this server can render. When it exceeds `rendered`, the - /// caller is reading a deliberately narrowed view and an upgrade would show - /// more; the elision counters on the response say whether anything was - /// actually withheld from this particular answer. - /// - /// Field 2: `server_max` - pub server_max: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'a>, - >, -} -impl<'a> ContractNegotiationView<'a> { - /**Whether required field `rendered` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_rendered(&self) -> bool { - self.rendered.is_set() - } - /**Whether required field `server_max` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_server_max(&self) -> bool { - self.server_max.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ContractNegotiationView<'a> { - type Owned = super::super::ContractNegotiation; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.rendered.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.rendered = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.server_max.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.server_max = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ContractNegotiation, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ContractNegotiation, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ContractNegotiation { - rendered: match self.rendered.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractVersion, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - server_max: match self.server_max.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractVersion, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ContractNegotiationView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.rendered.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.rendered.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.server_max.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.server_max.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.rendered.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.rendered.write_to(__cache, buf); - } - if self.server_max.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.server_max.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ContractNegotiationView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.rendered.as_option() { - __map.serialize_entry("rendered", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.server_max.as_option() { - __map.serialize_entry("serverMax", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ContractNegotiationView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ContractNegotiation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ContractNegotiation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ContractNegotiation"; -} -::buffa::impl_default_view_instance!(ContractNegotiationView); -::buffa::impl_view_reborrow!(ContractNegotiationView); -/** Self-contained, `'static` owned view of a `ContractNegotiation` message. - - Wraps [`::buffa::OwnedView`]`<`[`ContractNegotiationView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ContractNegotiationView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ContractNegotiationOwnedView( - ::buffa::OwnedView>, -); -impl ContractNegotiationOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContractNegotiationOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContractNegotiationOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ContractNegotiation, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContractNegotiationOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ContractNegotiationView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ContractNegotiationView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ContractNegotiation { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The version this response was rendered at. It is never greater than the - /// caller's declared `accepted_contract`, because the server clamps its output - /// rather than emitting variants the caller cannot decode. - /// - /// Field 1: `rendered` - #[must_use] - pub fn rendered( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'_>, - > { - &self.0.reborrow().rendered - } - /// The highest version this server can render. When it exceeds `rendered`, the - /// caller is reading a deliberately narrowed view and an upgrade would show - /// more; the elision counters on the response say whether anything was - /// actually withheld from this particular answer. - /// - /// Field 2: `server_max` - #[must_use] - pub fn server_max( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'_>, - > { - &self.0.reborrow().server_max - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ContractNegotiationOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ContractNegotiationOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ContractNegotiationOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ContractNegotiationOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ContractNegotiation { - type View<'a> = ContractNegotiationView<'a>; - type ViewHandle = ContractNegotiationOwnedView; -} -impl ::serde::Serialize for ContractNegotiationOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.contract_version.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.contract_version.rs deleted file mode 100644 index 6b020938a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.contract_version.rs +++ /dev/null @@ -1,319 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/contract_version.proto - -/// ContractVersion identifies a revision of the Session query contract. -/// -/// Every request declares the highest version its caller understands, and every -/// response reports the version it was actually rendered at. Without both halves -/// a client can only discover an incompatibility by failing to parse a response, -/// which is exactly the outcome this contract exists to prevent. -/// -/// Compatibility rule: -/// -/// - Same `major`: compatible. Anything added within a major is additive, so a -/// ```text -/// caller built against an earlier `minor` can still decode the response. -/// ``` -/// - Different `major`: unsupported. The caller must not attempt to interpret -/// ```text -/// the response, and the server must refuse the request with -/// QUERY_ERROR_CODE_UNSUPPORTED_CONTRACT_VERSION rather than answer in a -/// shape the caller cannot read. -/// ``` -/// -/// `minor` increments for additive changes only: a new optional field, a new -/// enum value, a new variant in a discriminated union. `major` increments for -/// anything a caller built against the prior version could misread: a removed -/// field, a narrowed type, a changed meaning. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ContractVersion { - /// Incompatible revision. A caller must refuse a response whose major it does - /// not know, rather than interpret the fields it happens to recognize. - /// - /// Field 1: `major` - #[serde(rename = "major", with = "::buffa::json_helpers::uint32")] - pub major: u32, - /// Additive revision within a major. - /// - /// Field 2: `minor` - #[serde(rename = "minor", with = "::buffa::json_helpers::uint32")] - pub minor: u32, -} -impl ::core::fmt::Debug for ContractVersion { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ContractVersion") - .field("major", &self.major) - .field("minor", &self.minor) - .finish() - } -} -impl ContractVersion { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ContractVersion"; -} -::buffa::impl_default_instance!(ContractVersion); -impl ::buffa::MessageName for ContractVersion { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ContractVersion"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ContractVersion"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ContractVersion"; -} -impl ::buffa::Message for ContractVersion { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.major) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.minor) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.major, buf); - ::buffa::types::put_uint32_field(2u32, self.minor, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.major = ::buffa::types::decode_uint32(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.minor = ::buffa::types::decode_uint32(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.major = 0u32; - self.minor = 0u32; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ContractVersion { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CONTRACT_VERSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ContractVersion", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ContractNegotiation is the version block every query response carries. -/// -/// It exists so that "the server understands more than I do" is a fact the -/// caller reads, rather than something it infers from a field it cannot see. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ContractNegotiation { - /// The version this response was rendered at. It is never greater than the - /// caller's declared `accepted_contract`, because the server clamps its output - /// rather than emitting variants the caller cannot decode. - /// - /// Field 1: `rendered` - #[serde(rename = "rendered")] - pub rendered: ::buffa::MessageField< - ContractVersion, - ::buffa::Inline, - >, - /// The highest version this server can render. When it exceeds `rendered`, the - /// caller is reading a deliberately narrowed view and an upgrade would show - /// more; the elision counters on the response say whether anything was - /// actually withheld from this particular answer. - /// - /// Field 2: `server_max` - #[serde(rename = "serverMax", alias = "server_max")] - pub server_max: ::buffa::MessageField< - ContractVersion, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for ContractNegotiation { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ContractNegotiation") - .field("rendered", &self.rendered) - .field("server_max", &self.server_max) - .finish() - } -} -impl ContractNegotiation { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ContractNegotiation"; -} -::buffa::impl_default_instance!(ContractNegotiation); -impl ::buffa::MessageName for ContractNegotiation { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ContractNegotiation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ContractNegotiation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ContractNegotiation"; -} -impl ::buffa::Message for ContractNegotiation { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.rendered.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.rendered.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.server_max.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.server_max.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.rendered.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.rendered.write_to(__cache, buf); - } - if self.server_max.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.server_max.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.rendered.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.server_max.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.rendered = ::buffa::MessageField::none(); - self.server_max = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ContractNegotiation { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CONTRACT_NEGOTIATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ContractNegotiation", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.get_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.get_session.__view.rs deleted file mode 100644 index fffdb94eb..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.get_session.__view.rs +++ /dev/null @@ -1,852 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/get_session.proto - -/// GetSessionRequest reads one session's detail view. -/// -/// The caller declares the contract version it understands. This is what turns -/// an incompatibility into a typed refusal instead of a parse failure: the -/// server can see, before rendering anything, whether the caller can read the -/// answer. -#[derive(Clone, Debug, Default)] -pub struct GetSessionRequestView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// The highest contract version this caller understands. The server renders at - /// no higher than this, and refuses outright when the major does not match. - /// - /// Field 2: `accepted_contract` - pub accepted_contract: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'a>, - >, - /// Freshness the caller requires. Unset is an eventual read. - /// - /// Field 3: `consistency` - pub consistency: ::buffa::MessageFieldView< - super::super::__buffa::view::ReadConsistencyView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> GetSessionRequestView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `accepted_contract` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_accepted_contract(&self) -> bool { - self.accepted_contract.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for GetSessionRequestView<'a> { - type Owned = super::super::GetSessionRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.accepted_contract.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.accepted_contract = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.consistency.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.consistency = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::GetSessionRequest { - session_id: self.session_id.to_string(), - accepted_contract: match self.accepted_contract.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractVersion, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - consistency: match self.consistency.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ReadConsistency, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for GetSessionRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.accepted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.accepted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.consistency.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.consistency.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.accepted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.accepted_contract.write_to(__cache, buf); - } - if self.consistency.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.consistency.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for GetSessionRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.accepted_contract.as_option() - { - __map.serialize_entry("acceptedContract", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.consistency.as_option() { - __map.serialize_entry("consistency", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for GetSessionRequestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "GetSessionRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.GetSessionRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionRequest"; -} -::buffa::impl_default_view_instance!(GetSessionRequestView); -::buffa::impl_view_reborrow!(GetSessionRequestView); -/** Self-contained, `'static` owned view of a `GetSessionRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`GetSessionRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetSessionRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct GetSessionRequestOwnedView( - ::buffa::OwnedView>, -); -impl GetSessionRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetSessionRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetSessionRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::GetSessionRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetSessionRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`GetSessionRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &GetSessionRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::GetSessionRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// The highest contract version this caller understands. The server renders at - /// no higher than this, and refuses outright when the major does not match. - /// - /// Field 2: `accepted_contract` - #[must_use] - pub fn accepted_contract( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'_>, - > { - &self.0.reborrow().accepted_contract - } - /// Freshness the caller requires. Unset is an eventual read. - /// - /// Field 3: `consistency` - #[must_use] - pub fn consistency( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ReadConsistencyView<'_>, - > { - &self.0.reborrow().consistency - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for GetSessionRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - GetSessionRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: GetSessionRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for GetSessionRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::GetSessionRequest { - type View<'a> = GetSessionRequestView<'a>; - type ViewHandle = GetSessionRequestOwnedView; -} -impl ::serde::Serialize for GetSessionRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// GetSessionResponse is a session's detail view. -/// -/// A failure is not a variant here. It arrives as a QueryError on the -/// transport's error channel, so a caller can never read a zero-valued success -/// shape as an empty answer. -#[derive(Clone, Debug, Default)] -pub struct GetSessionResponseView<'a> { - /// Field 1: `contract` - pub contract: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractNegotiationView<'a>, - >, - /// Field 2: `session` - pub session: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionViewView<'a>, - >, - /// How current the read model was when it answered. Always present, including - /// on an eventual read, so currency is something the server stated rather than - /// something the caller assumed. - /// - /// Field 3: `freshness` - pub freshness: ::buffa::MessageFieldView< - super::super::__buffa::view::ProjectionFreshnessView<'a>, - >, -} -impl<'a> GetSessionResponseView<'a> { - /**Whether required field `contract` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_contract(&self) -> bool { - self.contract.is_set() - } - /**Whether required field `session` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session(&self) -> bool { - self.session.is_set() - } - /**Whether required field `freshness` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_freshness(&self) -> bool { - self.freshness.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for GetSessionResponseView<'a> { - type Owned = super::super::GetSessionResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.contract.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.contract = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.session.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.session = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.freshness.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.freshness = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::GetSessionResponse { - contract: match self.contract.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractNegotiation, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - session: match self.session.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionView, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - freshness: match self.freshness.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ProjectionFreshness, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for GetSessionResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.session.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.session.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.freshness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.freshness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.contract.write_to(__cache, buf); - } - if self.session.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.session.write_to(__cache, buf); - } - if self.freshness.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.freshness.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for GetSessionResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.contract.as_option() { - __map.serialize_entry("contract", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.session.as_option() { - __map.serialize_entry("session", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.freshness.as_option() { - __map.serialize_entry("freshness", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for GetSessionResponseView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "GetSessionResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.GetSessionResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionResponse"; -} -::buffa::impl_default_view_instance!(GetSessionResponseView); -::buffa::impl_view_reborrow!(GetSessionResponseView); -/** Self-contained, `'static` owned view of a `GetSessionResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`GetSessionResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetSessionResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct GetSessionResponseOwnedView( - ::buffa::OwnedView>, -); -impl GetSessionResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetSessionResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetSessionResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::GetSessionResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetSessionResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`GetSessionResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &GetSessionResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::GetSessionResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `contract` - #[must_use] - pub fn contract( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractNegotiationView<'_>, - > { - &self.0.reborrow().contract - } - /// Field 2: `session` - #[must_use] - pub fn session( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().session - } - /// How current the read model was when it answered. Always present, including - /// on an eventual read, so currency is something the server stated rather than - /// something the caller assumed. - /// - /// Field 3: `freshness` - #[must_use] - pub fn freshness( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ProjectionFreshnessView<'_>, - > { - &self.0.reborrow().freshness - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for GetSessionResponseOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - GetSessionResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: GetSessionResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for GetSessionResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::GetSessionResponse { - type View<'a> = GetSessionResponseView<'a>; - type ViewHandle = GetSessionResponseOwnedView; -} -impl ::serde::Serialize for GetSessionResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.get_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.get_session.rs deleted file mode 100644 index ebb372f7a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.get_session.rs +++ /dev/null @@ -1,392 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/get_session.proto - -/// GetSessionRequest reads one session's detail view. -/// -/// The caller declares the contract version it understands. This is what turns -/// an incompatibility into a typed refusal instead of a parse failure: the -/// server can see, before rendering anything, whether the caller can read the -/// answer. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct GetSessionRequest { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// The highest contract version this caller understands. The server renders at - /// no higher than this, and refuses outright when the major does not match. - /// - /// Field 2: `accepted_contract` - #[serde(rename = "acceptedContract", alias = "accepted_contract")] - pub accepted_contract: ::buffa::MessageField< - ContractVersion, - ::buffa::Inline, - >, - /// Freshness the caller requires. Unset is an eventual read. - /// - /// Field 3: `consistency` - #[serde( - rename = "consistency", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub consistency: ::buffa::MessageField< - ReadConsistency, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for GetSessionRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("GetSessionRequest") - .field("session_id", &self.session_id) - .field("accepted_contract", &self.accepted_contract) - .field("consistency", &self.consistency) - .finish() - } -} -impl GetSessionRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionRequest"; -} -::buffa::impl_default_instance!(GetSessionRequest); -impl ::buffa::MessageName for GetSessionRequest { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "GetSessionRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.GetSessionRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionRequest"; -} -impl ::buffa::Message for GetSessionRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.accepted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.accepted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.consistency.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.consistency.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.accepted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.accepted_contract.write_to(__cache, buf); - } - if self.consistency.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.consistency.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.accepted_contract.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.consistency.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.accepted_contract = ::buffa::MessageField::none(); - self.consistency = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for GetSessionRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __GET_SESSION_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// GetSessionResponse is a session's detail view. -/// -/// A failure is not a variant here. It arrives as a QueryError on the -/// transport's error channel, so a caller can never read a zero-valued success -/// shape as an empty answer. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct GetSessionResponse { - /// Field 1: `contract` - #[serde(rename = "contract")] - pub contract: ::buffa::MessageField< - ContractNegotiation, - ::buffa::Inline, - >, - /// Field 2: `session` - #[serde(rename = "session")] - pub session: ::buffa::MessageField>, - /// How current the read model was when it answered. Always present, including - /// on an eventual read, so currency is something the server stated rather than - /// something the caller assumed. - /// - /// Field 3: `freshness` - #[serde(rename = "freshness")] - pub freshness: ::buffa::MessageField< - ProjectionFreshness, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for GetSessionResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("GetSessionResponse") - .field("contract", &self.contract) - .field("session", &self.session) - .field("freshness", &self.freshness) - .finish() - } -} -impl GetSessionResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionResponse"; -} -::buffa::impl_default_instance!(GetSessionResponse); -impl ::buffa::MessageName for GetSessionResponse { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "GetSessionResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.GetSessionResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionResponse"; -} -impl ::buffa::Message for GetSessionResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.session.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.session.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.freshness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.freshness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.contract.write_to(__cache, buf); - } - if self.session.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.session.write_to(__cache, buf); - } - if self.freshness.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.freshness.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.contract.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.session.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.freshness.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.contract = ::buffa::MessageField::none(); - self.session = ::buffa::MessageField::none(); - self.freshness = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for GetSessionResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __GET_SESSION_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.get_session_history.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.get_session_history.__view.rs deleted file mode 100644 index b1447ed7f..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.get_session_history.__view.rs +++ /dev/null @@ -1,1131 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/get_session_history.proto - -/// GetSessionHistoryRequest reads one page of a session's history. -/// -/// History is a separate query from GetSession because it is unbounded. A detail -/// read that inlined it would have no bound on its response size, and a client -/// would have no way to ask for less. -#[derive(Clone, Debug, Default)] -pub struct GetSessionHistoryRequestView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `accepted_contract` - pub accepted_contract: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'a>, - >, - /// Field 3: `direction` - pub direction: ::buffa::EnumValue, - /// Field 4: `page_size` - pub page_size: u32, - /// Opaque continuation from a prior response, a serialized CursorEnvelope. - /// Unset starts a new scan. `direction` is fixed when the scan opens, so a - /// continuation that disagrees with the cursor is refused rather than - /// reversed. - /// - /// Field 5: `page_token` - pub page_token: ::core::option::Option<&'a [u8]>, - /// Freshness the caller requires. Honored when the scan opens and ignored on - /// a continuation, whose contents are fixed by the anchor. A continuation - /// asking for more than the scan was opened with is - /// QUERY_ERROR_CODE_INVALID_ARGUMENT. - /// - /// This is the field that answers "does this transcript include the redaction - /// I just applied". An eventual read cannot say, and the anchor alone cannot - /// either: it says which ordinal the scan covers, not whether the projection - /// had applied the event at that ordinal when the scan opened. - /// - /// Field 6: `consistency` - pub consistency: ::buffa::MessageFieldView< - super::super::__buffa::view::ReadConsistencyView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> GetSessionHistoryRequestView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `accepted_contract` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_accepted_contract(&self) -> bool { - self.accepted_contract.is_set() - } - /**Whether required field `direction` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_direction(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `page_size` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_page_size(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for GetSessionHistoryRequestView<'a> { - type Owned = super::super::GetSessionHistoryRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.accepted_contract.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.accepted_contract = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.direction = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.page_size = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.page_token = Some(::buffa::types::borrow_bytes(&mut cur)?); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.consistency.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.consistency = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::GetSessionHistoryRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::GetSessionHistoryRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::GetSessionHistoryRequest { - session_id: self.session_id.to_string(), - accepted_contract: match self.accepted_contract.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractVersion, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - direction: self.direction, - page_size: self.page_size, - page_token: self.page_token.map(|b| (b).to_vec()), - consistency: match self.consistency.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ReadConsistency, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for GetSessionHistoryRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.accepted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.accepted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.direction.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.page_size) as u64; - if let Some(ref v) = self.page_token { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - if self.consistency.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.consistency.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.accepted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.accepted_contract.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.direction.to_i32(), buf); - ::buffa::types::put_uint32_field(4u32, self.page_size, buf); - if let Some(ref v) = self.page_token { - ::buffa::types::put_shared_bytes_field(5u32, v, buf); - } - if self.consistency.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.consistency.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for GetSessionHistoryRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.accepted_contract.as_option() - { - __map.serialize_entry("acceptedContract", __v)?; - } - } - { - __map.serialize_entry("direction", &self.direction)?; - } - { - __map - .serialize_entry( - "pageSize", - &::buffa::json_helpers::ProtoJson(&self.page_size), - )?; - } - if let ::core::option::Option::Some(__v) = self.page_token { - __map.serialize_entry("pageToken", &::buffa::json_helpers::BytesJson(__v))?; - } - { - if let ::core::option::Option::Some(__v) = self.consistency.as_option() { - __map.serialize_entry("consistency", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for GetSessionHistoryRequestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "GetSessionHistoryRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.GetSessionHistoryRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionHistoryRequest"; -} -::buffa::impl_default_view_instance!(GetSessionHistoryRequestView); -::buffa::impl_view_reborrow!(GetSessionHistoryRequestView); -/** Self-contained, `'static` owned view of a `GetSessionHistoryRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`GetSessionHistoryRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetSessionHistoryRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct GetSessionHistoryRequestOwnedView( - ::buffa::OwnedView>, -); -impl GetSessionHistoryRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetSessionHistoryRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetSessionHistoryRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::GetSessionHistoryRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetSessionHistoryRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`GetSessionHistoryRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &GetSessionHistoryRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::GetSessionHistoryRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `accepted_contract` - #[must_use] - pub fn accepted_contract( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'_>, - > { - &self.0.reborrow().accepted_contract - } - /// Field 3: `direction` - #[must_use] - pub fn direction(&self) -> ::buffa::EnumValue { - self.0.reborrow().direction - } - /// Field 4: `page_size` - #[must_use] - pub fn page_size(&self) -> u32 { - self.0.reborrow().page_size - } - /// Opaque continuation from a prior response, a serialized CursorEnvelope. - /// Unset starts a new scan. `direction` is fixed when the scan opens, so a - /// continuation that disagrees with the cursor is refused rather than - /// reversed. - /// - /// Field 5: `page_token` - #[must_use] - pub fn page_token(&self) -> ::core::option::Option<&'_ [u8]> { - self.0.reborrow().page_token - } - /// Freshness the caller requires. Honored when the scan opens and ignored on - /// a continuation, whose contents are fixed by the anchor. A continuation - /// asking for more than the scan was opened with is - /// QUERY_ERROR_CODE_INVALID_ARGUMENT. - /// - /// This is the field that answers "does this transcript include the redaction - /// I just applied". An eventual read cannot say, and the anchor alone cannot - /// either: it says which ordinal the scan covers, not whether the projection - /// had applied the event at that ordinal when the scan opened. - /// - /// Field 6: `consistency` - #[must_use] - pub fn consistency( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ReadConsistencyView<'_>, - > { - &self.0.reborrow().consistency - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for GetSessionHistoryRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - GetSessionHistoryRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: GetSessionHistoryRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for GetSessionHistoryRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::GetSessionHistoryRequest { - type View<'a> = GetSessionHistoryRequestView<'a>; - type ViewHandle = GetSessionHistoryRequestOwnedView; -} -impl ::serde::Serialize for GetSessionHistoryRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// GetSessionHistoryResponse is one page of history items. -/// -/// The elision counters are the honest part of this message. A caller that reads -/// only `items` cannot tell a complete page from one that quietly dropped half -/// its content, and "the response parsed" is not evidence that it is complete. -#[derive(Clone, Debug, Default)] -pub struct GetSessionHistoryResponseView<'a> { - /// Field 1: `contract` - pub contract: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractNegotiationView<'a>, - >, - /// Field 2: `items` - pub items: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::HistoryItemView<'a>, - >, - /// Unset when the scan is exhausted. Presence, not an empty `items` list, is - /// the end signal. - /// - /// Field 3: `next_page_token` - pub next_page_token: ::core::option::Option<&'a [u8]>, - /// Items on this page rendered as HISTORY_ITEM_KIND_ELIDED because they need a - /// variant newer than the caller's contract minor. Non-zero means upgrading - /// the caller would show more. - /// - /// Field 4: `contract_clamped_count` - pub contract_clamped_count: u32, - /// Items on this page whose content was withheld by redaction or - /// authorization. Distinct from the clamped count: upgrading the caller will - /// not reveal these, and a client should not prompt for an upgrade. - /// - /// Field 5: `withheld_count` - pub withheld_count: u32, - /// The effective history boundary this page was rendered against, after - /// rewind masking, as a SessionOrdinal. It is the scan's anchor and is equal - /// on every page of one scan. - /// - /// Turns appended after the scan opened are above this boundary and are not - /// in it. That is the property that keeps paging stable while a session is - /// still being written to, and it means an in-progress scan is not how a - /// caller learns about new turns. Should the effective boundary itself move, - /// by rewind or redaction, the continuation fails with STALE_CURSOR rather - /// than quietly reporting a different value here. - /// - /// Field 6: `effective_through` - pub effective_through: u64, - /// How current the read model was when the scan opened. Equal on every page. - /// - /// Field 7: `freshness` - pub freshness: ::buffa::MessageFieldView< - super::super::__buffa::view::ProjectionFreshnessView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> GetSessionHistoryResponseView<'a> { - /**Whether required field `contract` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_contract(&self) -> bool { - self.contract.is_set() - } - /**Whether required field `contract_clamped_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_contract_clamped_count(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `withheld_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_withheld_count(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `effective_through` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_effective_through(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `freshness` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_freshness(&self) -> bool { - self.freshness.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for GetSessionHistoryResponseView<'a> { - type Owned = super::super::GetSessionHistoryResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.contract.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.contract = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.next_page_token = Some(::buffa::types::borrow_bytes(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.contract_clamped_count = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.withheld_count = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.effective_through = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.freshness.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.freshness = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::HistoryItemView, - >(), - )?; - view.items - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::GetSessionHistoryResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::GetSessionHistoryResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::GetSessionHistoryResponse { - contract: match self.contract.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractNegotiation, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - items: self - .items - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - next_page_token: self.next_page_token.map(|b| (b).to_vec()), - contract_clamped_count: self.contract_clamped_count, - withheld_count: self.withheld_count, - effective_through: self.effective_through, - freshness: match self.freshness.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ProjectionFreshness, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for GetSessionHistoryResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.items { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.next_page_token { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.contract_clamped_count) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.withheld_count) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.effective_through) as u64; - if self.freshness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.freshness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.contract.write_to(__cache, buf); - } - for v in &self.items { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if let Some(ref v) = self.next_page_token { - ::buffa::types::put_shared_bytes_field(3u32, v, buf); - } - ::buffa::types::put_uint32_field(4u32, self.contract_clamped_count, buf); - ::buffa::types::put_uint32_field(5u32, self.withheld_count, buf); - ::buffa::types::put_uint64_field(6u32, self.effective_through, buf); - if self.freshness.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.freshness.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for GetSessionHistoryResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.contract.as_option() { - __map.serialize_entry("contract", __v)?; - } - } - if !self.items.is_empty() { - __map.serialize_entry("items", &*self.items)?; - } - if let ::core::option::Option::Some(__v) = self.next_page_token { - __map - .serialize_entry( - "nextPageToken", - &::buffa::json_helpers::BytesJson(__v), - )?; - } - { - __map - .serialize_entry( - "contractClampedCount", - &::buffa::json_helpers::ProtoJson(&self.contract_clamped_count), - )?; - } - { - __map - .serialize_entry( - "withheldCount", - &::buffa::json_helpers::ProtoJson(&self.withheld_count), - )?; - } - { - __map - .serialize_entry( - "effectiveThrough", - &::buffa::json_helpers::ProtoJson(&self.effective_through), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.freshness.as_option() { - __map.serialize_entry("freshness", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for GetSessionHistoryResponseView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "GetSessionHistoryResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.GetSessionHistoryResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionHistoryResponse"; -} -::buffa::impl_default_view_instance!(GetSessionHistoryResponseView); -::buffa::impl_view_reborrow!(GetSessionHistoryResponseView); -/** Self-contained, `'static` owned view of a `GetSessionHistoryResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`GetSessionHistoryResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetSessionHistoryResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct GetSessionHistoryResponseOwnedView( - ::buffa::OwnedView>, -); -impl GetSessionHistoryResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetSessionHistoryResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetSessionHistoryResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::GetSessionHistoryResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetSessionHistoryResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`GetSessionHistoryResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &GetSessionHistoryResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::GetSessionHistoryResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `contract` - #[must_use] - pub fn contract( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractNegotiationView<'_>, - > { - &self.0.reborrow().contract - } - /// Field 2: `items` - #[must_use] - pub fn items( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::HistoryItemView<'_>> { - &self.0.reborrow().items - } - /// Unset when the scan is exhausted. Presence, not an empty `items` list, is - /// the end signal. - /// - /// Field 3: `next_page_token` - #[must_use] - pub fn next_page_token(&self) -> ::core::option::Option<&'_ [u8]> { - self.0.reborrow().next_page_token - } - /// Items on this page rendered as HISTORY_ITEM_KIND_ELIDED because they need a - /// variant newer than the caller's contract minor. Non-zero means upgrading - /// the caller would show more. - /// - /// Field 4: `contract_clamped_count` - #[must_use] - pub fn contract_clamped_count(&self) -> u32 { - self.0.reborrow().contract_clamped_count - } - /// Items on this page whose content was withheld by redaction or - /// authorization. Distinct from the clamped count: upgrading the caller will - /// not reveal these, and a client should not prompt for an upgrade. - /// - /// Field 5: `withheld_count` - #[must_use] - pub fn withheld_count(&self) -> u32 { - self.0.reborrow().withheld_count - } - /// The effective history boundary this page was rendered against, after - /// rewind masking, as a SessionOrdinal. It is the scan's anchor and is equal - /// on every page of one scan. - /// - /// Turns appended after the scan opened are above this boundary and are not - /// in it. That is the property that keeps paging stable while a session is - /// still being written to, and it means an in-progress scan is not how a - /// caller learns about new turns. Should the effective boundary itself move, - /// by rewind or redaction, the continuation fails with STALE_CURSOR rather - /// than quietly reporting a different value here. - /// - /// Field 6: `effective_through` - #[must_use] - pub fn effective_through(&self) -> u64 { - self.0.reborrow().effective_through - } - /// How current the read model was when the scan opened. Equal on every page. - /// - /// Field 7: `freshness` - #[must_use] - pub fn freshness( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ProjectionFreshnessView<'_>, - > { - &self.0.reborrow().freshness - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for GetSessionHistoryResponseOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - GetSessionHistoryResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: GetSessionHistoryResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for GetSessionHistoryResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::GetSessionHistoryResponse { - type View<'a> = GetSessionHistoryResponseView<'a>; - type ViewHandle = GetSessionHistoryResponseOwnedView; -} -impl ::serde::Serialize for GetSessionHistoryResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.get_session_history.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.get_session_history.rs deleted file mode 100644 index a04ded2d5..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.get_session_history.rs +++ /dev/null @@ -1,752 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/get_session_history.proto - -/// HistoryDirection is which end of history a fresh scan starts from. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum HistoryDirection { - HISTORY_DIRECTION_UNSPECIFIED = 0i32, - /// Oldest first. - HISTORY_DIRECTION_FORWARD = 1i32, - /// Newest first, the usual transcript-scrollback order. - HISTORY_DIRECTION_REVERSE = 2i32, -} -impl HistoryDirection { - ///Idiomatic alias for [`Self::HISTORY_DIRECTION_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::HISTORY_DIRECTION_UNSPECIFIED; - ///Idiomatic alias for [`Self::HISTORY_DIRECTION_FORWARD`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Forward: Self = Self::HISTORY_DIRECTION_FORWARD; - ///Idiomatic alias for [`Self::HISTORY_DIRECTION_REVERSE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Reverse: Self = Self::HISTORY_DIRECTION_REVERSE; -} -impl ::core::default::Default for HistoryDirection { - fn default() -> Self { - Self::HISTORY_DIRECTION_UNSPECIFIED - } -} -impl ::serde::Serialize for HistoryDirection { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for HistoryDirection { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = HistoryDirection; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(HistoryDirection) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for HistoryDirection { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for HistoryDirection { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::HISTORY_DIRECTION_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::HISTORY_DIRECTION_FORWARD), - 2i32 => ::core::option::Option::Some(Self::HISTORY_DIRECTION_REVERSE), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::HISTORY_DIRECTION_UNSPECIFIED => "HISTORY_DIRECTION_UNSPECIFIED", - Self::HISTORY_DIRECTION_FORWARD => "HISTORY_DIRECTION_FORWARD", - Self::HISTORY_DIRECTION_REVERSE => "HISTORY_DIRECTION_REVERSE", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "HISTORY_DIRECTION_UNSPECIFIED" => { - ::core::option::Option::Some(Self::HISTORY_DIRECTION_UNSPECIFIED) - } - "HISTORY_DIRECTION_FORWARD" => { - ::core::option::Option::Some(Self::HISTORY_DIRECTION_FORWARD) - } - "HISTORY_DIRECTION_REVERSE" => { - ::core::option::Option::Some(Self::HISTORY_DIRECTION_REVERSE) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::HISTORY_DIRECTION_UNSPECIFIED, - Self::HISTORY_DIRECTION_FORWARD, - Self::HISTORY_DIRECTION_REVERSE, - ] - } -} -/// GetSessionHistoryRequest reads one page of a session's history. -/// -/// History is a separate query from GetSession because it is unbounded. A detail -/// read that inlined it would have no bound on its response size, and a client -/// would have no way to ask for less. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct GetSessionHistoryRequest { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `accepted_contract` - #[serde(rename = "acceptedContract", alias = "accepted_contract")] - pub accepted_contract: ::buffa::MessageField< - ContractVersion, - ::buffa::Inline, - >, - /// Field 3: `direction` - #[serde(rename = "direction", with = "::buffa::json_helpers::proto_enum")] - pub direction: ::buffa::EnumValue, - /// Field 4: `page_size` - #[serde( - rename = "pageSize", - alias = "page_size", - with = "::buffa::json_helpers::uint32" - )] - pub page_size: u32, - /// Opaque continuation from a prior response, a serialized CursorEnvelope. - /// Unset starts a new scan. `direction` is fixed when the scan opens, so a - /// continuation that disagrees with the cursor is refused rather than - /// reversed. - /// - /// Field 5: `page_token` - #[serde( - rename = "pageToken", - alias = "page_token", - with = "::buffa::json_helpers::opt_bytes", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub page_token: ::core::option::Option<::buffa::alloc::vec::Vec>, - /// Freshness the caller requires. Honored when the scan opens and ignored on - /// a continuation, whose contents are fixed by the anchor. A continuation - /// asking for more than the scan was opened with is - /// QUERY_ERROR_CODE_INVALID_ARGUMENT. - /// - /// This is the field that answers "does this transcript include the redaction - /// I just applied". An eventual read cannot say, and the anchor alone cannot - /// either: it says which ordinal the scan covers, not whether the projection - /// had applied the event at that ordinal when the scan opened. - /// - /// Field 6: `consistency` - #[serde( - rename = "consistency", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub consistency: ::buffa::MessageField< - ReadConsistency, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for GetSessionHistoryRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("GetSessionHistoryRequest") - .field("session_id", &self.session_id) - .field("accepted_contract", &self.accepted_contract) - .field("direction", &self.direction) - .field("page_size", &self.page_size) - .field("page_token", &self.page_token) - .field("consistency", &self.consistency) - .finish() - } -} -impl GetSessionHistoryRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionHistoryRequest"; -} -impl GetSessionHistoryRequest { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::page_token`] to `Some(value)`, consuming and returning `self`. - pub fn with_page_token( - mut self, - value: impl Into<::buffa::alloc::vec::Vec>, - ) -> Self { - self.page_token = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(GetSessionHistoryRequest); -impl ::buffa::MessageName for GetSessionHistoryRequest { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "GetSessionHistoryRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.GetSessionHistoryRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionHistoryRequest"; -} -impl ::buffa::Message for GetSessionHistoryRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.accepted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.accepted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.direction.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.page_size) as u64; - if let Some(ref v) = self.page_token { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - if self.consistency.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.consistency.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.accepted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.accepted_contract.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.direction.to_i32(), buf); - ::buffa::types::put_uint32_field(4u32, self.page_size, buf); - if let Some(ref v) = self.page_token { - ::buffa::types::put_shared_bytes_field(5u32, v, buf); - } - if self.consistency.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.consistency.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.accepted_contract.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.direction = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.page_size = ::buffa::types::decode_uint32(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes( - self.page_token.get_or_insert_with(::buffa::alloc::vec::Vec::new), - buf, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.consistency.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.accepted_contract = ::buffa::MessageField::none(); - self.direction = ::buffa::EnumValue::from(0); - self.page_size = 0u32; - self.page_token = ::core::option::Option::None; - self.consistency = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for GetSessionHistoryRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __GET_SESSION_HISTORY_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionHistoryRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// GetSessionHistoryResponse is one page of history items. -/// -/// The elision counters are the honest part of this message. A caller that reads -/// only `items` cannot tell a complete page from one that quietly dropped half -/// its content, and "the response parsed" is not evidence that it is complete. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct GetSessionHistoryResponse { - /// Field 1: `contract` - #[serde(rename = "contract")] - pub contract: ::buffa::MessageField< - ContractNegotiation, - ::buffa::Inline, - >, - /// Field 2: `items` - #[serde( - rename = "items", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub items: ::buffa::alloc::vec::Vec, - /// Unset when the scan is exhausted. Presence, not an empty `items` list, is - /// the end signal. - /// - /// Field 3: `next_page_token` - #[serde( - rename = "nextPageToken", - alias = "next_page_token", - with = "::buffa::json_helpers::opt_bytes", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub next_page_token: ::core::option::Option<::buffa::alloc::vec::Vec>, - /// Items on this page rendered as HISTORY_ITEM_KIND_ELIDED because they need a - /// variant newer than the caller's contract minor. Non-zero means upgrading - /// the caller would show more. - /// - /// Field 4: `contract_clamped_count` - #[serde( - rename = "contractClampedCount", - alias = "contract_clamped_count", - with = "::buffa::json_helpers::uint32" - )] - pub contract_clamped_count: u32, - /// Items on this page whose content was withheld by redaction or - /// authorization. Distinct from the clamped count: upgrading the caller will - /// not reveal these, and a client should not prompt for an upgrade. - /// - /// Field 5: `withheld_count` - #[serde( - rename = "withheldCount", - alias = "withheld_count", - with = "::buffa::json_helpers::uint32" - )] - pub withheld_count: u32, - /// The effective history boundary this page was rendered against, after - /// rewind masking, as a SessionOrdinal. It is the scan's anchor and is equal - /// on every page of one scan. - /// - /// Turns appended after the scan opened are above this boundary and are not - /// in it. That is the property that keeps paging stable while a session is - /// still being written to, and it means an in-progress scan is not how a - /// caller learns about new turns. Should the effective boundary itself move, - /// by rewind or redaction, the continuation fails with STALE_CURSOR rather - /// than quietly reporting a different value here. - /// - /// Field 6: `effective_through` - #[serde( - rename = "effectiveThrough", - alias = "effective_through", - with = "::buffa::json_helpers::uint64" - )] - pub effective_through: u64, - /// How current the read model was when the scan opened. Equal on every page. - /// - /// Field 7: `freshness` - #[serde(rename = "freshness")] - pub freshness: ::buffa::MessageField< - ProjectionFreshness, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for GetSessionHistoryResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("GetSessionHistoryResponse") - .field("contract", &self.contract) - .field("items", &self.items) - .field("next_page_token", &self.next_page_token) - .field("contract_clamped_count", &self.contract_clamped_count) - .field("withheld_count", &self.withheld_count) - .field("effective_through", &self.effective_through) - .field("freshness", &self.freshness) - .finish() - } -} -impl GetSessionHistoryResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionHistoryResponse"; -} -impl GetSessionHistoryResponse { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::next_page_token`] to `Some(value)`, consuming and returning `self`. - pub fn with_next_page_token( - mut self, - value: impl Into<::buffa::alloc::vec::Vec>, - ) -> Self { - self.next_page_token = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(GetSessionHistoryResponse); -impl ::buffa::MessageName for GetSessionHistoryResponse { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "GetSessionHistoryResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.GetSessionHistoryResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionHistoryResponse"; -} -impl ::buffa::Message for GetSessionHistoryResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.items { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.next_page_token { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.contract_clamped_count) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.withheld_count) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.effective_through) as u64; - if self.freshness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.freshness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.contract.write_to(__cache, buf); - } - for v in &self.items { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if let Some(ref v) = self.next_page_token { - ::buffa::types::put_shared_bytes_field(3u32, v, buf); - } - ::buffa::types::put_uint32_field(4u32, self.contract_clamped_count, buf); - ::buffa::types::put_uint32_field(5u32, self.withheld_count, buf); - ::buffa::types::put_uint64_field(6u32, self.effective_through, buf); - if self.freshness.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.freshness.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.contract.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.items.push(elem); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes( - self - .next_page_token - .get_or_insert_with(::buffa::alloc::vec::Vec::new), - buf, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.contract_clamped_count = ::buffa::types::decode_uint32(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.withheld_count = ::buffa::types::decode_uint32(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.effective_through = ::buffa::types::decode_uint64(buf)?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.freshness.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.contract = ::buffa::MessageField::none(); - self.items.clear(); - self.next_page_token = ::core::option::Option::None; - self.contract_clamped_count = 0u32; - self.withheld_count = 0u32; - self.effective_through = 0u64; - self.freshness = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for GetSessionHistoryResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __GET_SESSION_HISTORY_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetSessionHistoryResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.history_item.__oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.history_item.__oneof.rs deleted file mode 100644 index 9db02a85a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.history_item.__oneof.rs +++ /dev/null @@ -1,124 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/history_item.proto - -pub mod history_item { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, PartialEq, Debug)] - pub enum Item { - UserMessage(::buffa::alloc::boxed::Box), - AssistantMessage( - ::buffa::alloc::boxed::Box, - ), - ToolCall(::buffa::alloc::boxed::Box), - FileChange(::buffa::alloc::boxed::Box), - SystemNotice(::buffa::alloc::boxed::Box), - Compaction(::buffa::alloc::boxed::Box), - Elided(::buffa::alloc::boxed::Box), - } - impl ::buffa::Oneof for Item {} - impl From for Item { - fn from(v: super::super::super::UserMessageItem) -> Self { - Self::UserMessage(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::UserMessageItem) -> Self { - Self::Some(Item::from(v)) - } - } - impl From for Item { - fn from(v: super::super::super::AssistantMessageItem) -> Self { - Self::AssistantMessage(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::AssistantMessageItem) -> Self { - Self::Some(Item::from(v)) - } - } - impl From for Item { - fn from(v: super::super::super::ToolCallItem) -> Self { - Self::ToolCall(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ToolCallItem) -> Self { - Self::Some(Item::from(v)) - } - } - impl From for Item { - fn from(v: super::super::super::FileChangeItem) -> Self { - Self::FileChange(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::FileChangeItem) -> Self { - Self::Some(Item::from(v)) - } - } - impl From for Item { - fn from(v: super::super::super::SystemNoticeItem) -> Self { - Self::SystemNotice(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::SystemNoticeItem) -> Self { - Self::Some(Item::from(v)) - } - } - impl From for Item { - fn from(v: super::super::super::CompactionItem) -> Self { - Self::Compaction(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::CompactionItem) -> Self { - Self::Some(Item::from(v)) - } - } - impl From for Item { - fn from(v: super::super::super::HistoryItemElided) -> Self { - Self::Elided(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::HistoryItemElided) -> Self { - Self::Some(Item::from(v)) - } - } - impl serde::Serialize for Item { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::UserMessage(v) => { - map.serialize_entry("userMessage", v)?; - } - Self::AssistantMessage(v) => { - map.serialize_entry("assistantMessage", v)?; - } - Self::ToolCall(v) => { - map.serialize_entry("toolCall", v)?; - } - Self::FileChange(v) => { - map.serialize_entry("fileChange", v)?; - } - Self::SystemNotice(v) => { - map.serialize_entry("systemNotice", v)?; - } - Self::Compaction(v) => { - map.serialize_entry("compaction", v)?; - } - Self::Elided(v) => { - map.serialize_entry("elided", v)?; - } - } - map.end() - } - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.history_item.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.history_item.__view.rs deleted file mode 100644 index 76b5f6066..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.history_item.__view.rs +++ /dev/null @@ -1,3172 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/history_item.proto - -/// HistoryItem is one entry in a session's reader-visible history. -/// -/// The discriminated-union hazard this shape is built around: a caller decoding -/// a `oneof` arm added after its contract minor sees an unset `oneof` and cannot -/// distinguish "a variant I do not know" from "a variant that was not set". -/// Silently rendering nothing for a real event is a correctness failure, not a -/// cosmetic one. -/// -/// Two mechanisms close that gap: -/// -/// 1. `kind` is a plain enum outside the `oneof`. Proto enums are open, so an -/// ```text -/// unrecognized kind decodes as its raw number rather than vanishing, and a -/// caller can always tell that something is here it does not understand. -/// ``` -/// 2. The server clamps to the caller's declared contract minor and emits -/// ```text -/// HISTORY_ITEM_KIND_ELIDED with an `elided` payload rather than a variant -/// the caller cannot decode. Elision is affirmative: the caller reads that -/// an item was withheld instead of inferring it from an empty field. -/// ``` -#[derive(Clone, Debug, Default)] -pub struct HistoryItemView<'a> { - /// Stable within a session, opaque, and safe to use as a rendering key. It - /// remains stable across an elision, so a client that upgrades sees the same - /// item resolve to a real variant. - /// - /// Field 1: `item_id` - pub item_id: &'a str, - /// The session's own 1-indexed position for this item. - /// - /// Field 2: `ordinal` - pub ordinal: u64, - /// Set even when the matching `item` arm is absent, so an unknown or withheld - /// item is still identifiable. - /// - /// Field 3: `kind` - pub kind: ::buffa::EnumValue, - pub item: ::core::option::Option< - super::super::__buffa::view::oneof::history_item::Item<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> HistoryItemView<'a> { - /**Whether required field `item_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_item_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `ordinal` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ordinal(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_kind(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for HistoryItemView<'a> { - type Owned = super::super::HistoryItem; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.item_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.ordinal = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::history_item::Item::UserMessage( - ref mut existing, - ), - ) = view.item - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.item = Some( - super::super::__buffa::view::oneof::history_item::Item::UserMessage( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::history_item::Item::AssistantMessage( - ref mut existing, - ), - ) = view.item - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.item = Some( - super::super::__buffa::view::oneof::history_item::Item::AssistantMessage( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::history_item::Item::ToolCall( - ref mut existing, - ), - ) = view.item - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.item = Some( - super::super::__buffa::view::oneof::history_item::Item::ToolCall( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::history_item::Item::FileChange( - ref mut existing, - ), - ) = view.item - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.item = Some( - super::super::__buffa::view::oneof::history_item::Item::FileChange( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::history_item::Item::SystemNotice( - ref mut existing, - ), - ) = view.item - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.item = Some( - super::super::__buffa::view::oneof::history_item::Item::SystemNotice( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::history_item::Item::Compaction( - ref mut existing, - ), - ) = view.item - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.item = Some( - super::super::__buffa::view::oneof::history_item::Item::Compaction( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::history_item::Item::Elided( - ref mut existing, - ), - ) = view.item - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.item = Some( - super::super::__buffa::view::oneof::history_item::Item::Elided( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::HistoryItem { - item_id: self.item_id.to_string(), - ordinal: self.ordinal, - kind: self.kind, - item: match self.item.as_ref() { - ::core::option::Option::Some(v) => { - ::core::option::Option::Some( - match v { - super::super::__buffa::view::oneof::history_item::Item::UserMessage( - v, - ) => { - super::super::__buffa::oneof::history_item::Item::UserMessage( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::history_item::Item::AssistantMessage( - v, - ) => { - super::super::__buffa::oneof::history_item::Item::AssistantMessage( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::history_item::Item::ToolCall( - v, - ) => { - super::super::__buffa::oneof::history_item::Item::ToolCall( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::history_item::Item::FileChange( - v, - ) => { - super::super::__buffa::oneof::history_item::Item::FileChange( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::history_item::Item::SystemNotice( - v, - ) => { - super::super::__buffa::oneof::history_item::Item::SystemNotice( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::history_item::Item::Compaction( - v, - ) => { - super::super::__buffa::oneof::history_item::Item::Compaction( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::history_item::Item::Elided( - v, - ) => { - super::super::__buffa::oneof::history_item::Item::Elided( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - }, - ) - } - ::core::option::Option::None => ::core::option::Option::None, - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for HistoryItemView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.item_id) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.ordinal) as u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let ::core::option::Option::Some(ref v) = self.item { - match v { - super::super::__buffa::view::oneof::history_item::Item::UserMessage( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::history_item::Item::AssistantMessage( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::history_item::Item::ToolCall(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::history_item::Item::FileChange( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::history_item::Item::SystemNotice( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::history_item::Item::Compaction( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::history_item::Item::Elided(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.item_id, buf); - ::buffa::types::put_uint64_field(2u32, self.ordinal, buf); - ::buffa::types::put_int32_field(3u32, self.kind.to_i32(), buf); - if let ::core::option::Option::Some(ref v) = self.item { - match v { - super::super::__buffa::view::oneof::history_item::Item::UserMessage( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::history_item::Item::AssistantMessage( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::history_item::Item::ToolCall(x) => { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::history_item::Item::FileChange( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::history_item::Item::SystemNotice( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::history_item::Item::Compaction( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::history_item::Item::Elided(x) => { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for HistoryItemView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("itemId", self.item_id)?; - } - { - __map - .serialize_entry( - "ordinal", - &::buffa::json_helpers::ProtoJson(&self.ordinal), - )?; - } - { - __map.serialize_entry("kind", &self.kind)?; - } - if let ::core::option::Option::Some(ref __ov) = self.item { - match __ov { - super::super::__buffa::view::oneof::history_item::Item::UserMessage( - v, - ) => { - __map.serialize_entry("userMessage", v)?; - } - super::super::__buffa::view::oneof::history_item::Item::AssistantMessage( - v, - ) => { - __map.serialize_entry("assistantMessage", v)?; - } - super::super::__buffa::view::oneof::history_item::Item::ToolCall(v) => { - __map.serialize_entry("toolCall", v)?; - } - super::super::__buffa::view::oneof::history_item::Item::FileChange( - v, - ) => { - __map.serialize_entry("fileChange", v)?; - } - super::super::__buffa::view::oneof::history_item::Item::SystemNotice( - v, - ) => { - __map.serialize_entry("systemNotice", v)?; - } - super::super::__buffa::view::oneof::history_item::Item::Compaction( - v, - ) => { - __map.serialize_entry("compaction", v)?; - } - super::super::__buffa::view::oneof::history_item::Item::Elided(v) => { - __map.serialize_entry("elided", v)?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for HistoryItemView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "HistoryItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.HistoryItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.HistoryItem"; -} -::buffa::impl_default_view_instance!(HistoryItemView); -::buffa::impl_view_reborrow!(HistoryItemView); -/** Self-contained, `'static` owned view of a `HistoryItem` message. - - Wraps [`::buffa::OwnedView`]`<`[`HistoryItemView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`HistoryItemView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct HistoryItemOwnedView(::buffa::OwnedView>); -impl HistoryItemOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - HistoryItemOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - HistoryItemOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::HistoryItem, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - HistoryItemOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`HistoryItemView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &HistoryItemView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::HistoryItem { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Stable within a session, opaque, and safe to use as a rendering key. It - /// remains stable across an elision, so a client that upgrades sees the same - /// item resolve to a real variant. - /// - /// Field 1: `item_id` - #[must_use] - pub fn item_id(&self) -> &'_ str { - self.0.reborrow().item_id - } - /// The session's own 1-indexed position for this item. - /// - /// Field 2: `ordinal` - #[must_use] - pub fn ordinal(&self) -> u64 { - self.0.reborrow().ordinal - } - /// Set even when the matching `item` arm is absent, so an unknown or withheld - /// item is still identifiable. - /// - /// Field 3: `kind` - #[must_use] - pub fn kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().kind - } - /// Oneof `item`. - #[must_use] - pub fn item( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::history_item::Item<'_>, - > { - self.0.reborrow().item.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for HistoryItemOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - HistoryItemOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: HistoryItemOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for HistoryItemOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::HistoryItem { - type View<'a> = HistoryItemView<'a>; - type ViewHandle = HistoryItemOwnedView; -} -impl ::serde::Serialize for HistoryItemOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// HistoryItemElided is an item the server chose not to render, stated -/// affirmatively so a caller never mistakes a withheld item for a missing one. -#[derive(Clone, Debug, Default)] -pub struct HistoryItemElidedView<'a> { - /// Field 1: `reason` - pub reason: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, - #[doc(hidden)] - pub __buffa_phantom: ::core::marker::PhantomData<&'a ()>, -} -impl<'a> HistoryItemElidedView<'a> { - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for HistoryItemElidedView<'a> { - type Owned = super::super::HistoryItemElided; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::HistoryItemElided { - reason: self.reason, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for HistoryItemElidedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for HistoryItemElidedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("reason", &self.reason)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for HistoryItemElidedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "HistoryItemElided"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.HistoryItemElided"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.HistoryItemElided"; -} -::buffa::impl_default_view_instance!(HistoryItemElidedView); -::buffa::impl_view_reborrow!(HistoryItemElidedView); -/** Self-contained, `'static` owned view of a `HistoryItemElided` message. - - Wraps [`::buffa::OwnedView`]`<`[`HistoryItemElidedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`HistoryItemElidedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct HistoryItemElidedOwnedView( - ::buffa::OwnedView>, -); -impl HistoryItemElidedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - HistoryItemElidedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - HistoryItemElidedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::HistoryItemElided, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - HistoryItemElidedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`HistoryItemElidedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &HistoryItemElidedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::HistoryItemElided { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for HistoryItemElidedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - HistoryItemElidedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: HistoryItemElidedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for HistoryItemElidedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::HistoryItemElided { - type View<'a> = HistoryItemElidedView<'a>; - type ViewHandle = HistoryItemElidedOwnedView; -} -impl ::serde::Serialize for HistoryItemElidedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// UserMessageItem is a message from the user. -#[derive(Clone, Debug, Default)] -pub struct UserMessageItemView<'a> { - /// Field 1: `turn_id` - pub turn_id: &'a str, - /// Rendered plain text. Structured and provider-native content is reachable - /// through the artifact surface, not inlined here. - /// - /// Field 2: `text` - pub text: &'a str, - /// The text was shortened for transport. The full content is not recoverable - /// from this response. - /// - /// Field 3: `truncated` - pub truncated: bool, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> UserMessageItemView<'a> { - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `text` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_text(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `truncated` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_truncated(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for UserMessageItemView<'a> { - type Owned = super::super::UserMessageItem; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.text = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.truncated = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::UserMessageItem { - turn_id: self.turn_id.to_string(), - text: self.text.to_string(), - truncated: self.truncated, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for UserMessageItemView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.turn_id, buf); - ::buffa::types::put_string_field(2u32, &self.text, buf); - ::buffa::types::put_bool_field(3u32, self.truncated, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for UserMessageItemView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("turnId", self.turn_id)?; - } - { - __map.serialize_entry("text", self.text)?; - } - { - __map.serialize_entry("truncated", &self.truncated)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for UserMessageItemView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "UserMessageItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.UserMessageItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.UserMessageItem"; -} -::buffa::impl_default_view_instance!(UserMessageItemView); -::buffa::impl_view_reborrow!(UserMessageItemView); -/** Self-contained, `'static` owned view of a `UserMessageItem` message. - - Wraps [`::buffa::OwnedView`]`<`[`UserMessageItemView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`UserMessageItemView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct UserMessageItemOwnedView(::buffa::OwnedView>); -impl UserMessageItemOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UserMessageItemOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UserMessageItemOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::UserMessageItem, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UserMessageItemOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`UserMessageItemView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &UserMessageItemView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::UserMessageItem { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } - /// Rendered plain text. Structured and provider-native content is reachable - /// through the artifact surface, not inlined here. - /// - /// Field 2: `text` - #[must_use] - pub fn text(&self) -> &'_ str { - self.0.reborrow().text - } - /// The text was shortened for transport. The full content is not recoverable - /// from this response. - /// - /// Field 3: `truncated` - #[must_use] - pub fn truncated(&self) -> bool { - self.0.reborrow().truncated - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for UserMessageItemOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - UserMessageItemOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: UserMessageItemOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for UserMessageItemOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::UserMessageItem { - type View<'a> = UserMessageItemView<'a>; - type ViewHandle = UserMessageItemOwnedView; -} -impl ::serde::Serialize for UserMessageItemOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// AssistantMessageItem is one assistant generation and its outcome. -/// -/// It carries a terminal state rather than a completion flag, because a -/// generation that was interrupted is a different fact from one still running, -/// and a boolean cannot hold that difference. -#[derive(Clone, Debug, Default)] -pub struct AssistantMessageItemView<'a> { - /// Field 1: `turn_id` - pub turn_id: &'a str, - /// Field 2: `model` - pub model: &'a str, - /// Field 3: `text` - pub text: &'a str, - /// Field 4: `truncated` - pub truncated: bool, - /// Field 5: `outcome` - pub outcome: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> AssistantMessageItemView<'a> { - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `model` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_model(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `text` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_text(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `truncated` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_truncated(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `outcome` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_outcome(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for AssistantMessageItemView<'a> { - type Owned = super::super::AssistantMessageItem; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.model = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.text = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.truncated = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.outcome = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 16u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::AssistantMessageItem, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::AssistantMessageItem, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::AssistantMessageItem { - turn_id: self.turn_id.to_string(), - model: self.model.to_string(), - text: self.text.to_string(), - truncated: self.truncated, - outcome: self.outcome, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for AssistantMessageItemView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.model) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - { - let val = self.outcome.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.turn_id, buf); - ::buffa::types::put_string_field(2u32, &self.model, buf); - ::buffa::types::put_string_field(3u32, &self.text, buf); - ::buffa::types::put_bool_field(4u32, self.truncated, buf); - ::buffa::types::put_int32_field(5u32, self.outcome.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for AssistantMessageItemView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("turnId", self.turn_id)?; - } - { - __map.serialize_entry("model", self.model)?; - } - { - __map.serialize_entry("text", self.text)?; - } - { - __map.serialize_entry("truncated", &self.truncated)?; - } - { - __map.serialize_entry("outcome", &self.outcome)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for AssistantMessageItemView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "AssistantMessageItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.AssistantMessageItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.AssistantMessageItem"; -} -::buffa::impl_default_view_instance!(AssistantMessageItemView); -::buffa::impl_view_reborrow!(AssistantMessageItemView); -/** Self-contained, `'static` owned view of a `AssistantMessageItem` message. - - Wraps [`::buffa::OwnedView`]`<`[`AssistantMessageItemView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`AssistantMessageItemView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct AssistantMessageItemOwnedView( - ::buffa::OwnedView>, -); -impl AssistantMessageItemOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AssistantMessageItemOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AssistantMessageItemOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::AssistantMessageItem, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AssistantMessageItemOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`AssistantMessageItemView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &AssistantMessageItemView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::AssistantMessageItem { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } - /// Field 2: `model` - #[must_use] - pub fn model(&self) -> &'_ str { - self.0.reborrow().model - } - /// Field 3: `text` - #[must_use] - pub fn text(&self) -> &'_ str { - self.0.reborrow().text - } - /// Field 4: `truncated` - #[must_use] - pub fn truncated(&self) -> bool { - self.0.reborrow().truncated - } - /// Field 5: `outcome` - #[must_use] - pub fn outcome(&self) -> ::buffa::EnumValue { - self.0.reborrow().outcome - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for AssistantMessageItemOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - AssistantMessageItemOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: AssistantMessageItemOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for AssistantMessageItemOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::AssistantMessageItem { - type View<'a> = AssistantMessageItemView<'a>; - type ViewHandle = AssistantMessageItemOwnedView; -} -impl ::serde::Serialize for AssistantMessageItemOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ToolCallItem is one tool call and its lifecycle position. -#[derive(Clone, Debug, Default)] -pub struct ToolCallItemView<'a> { - /// Field 1: `turn_id` - pub turn_id: &'a str, - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Field 3: `tool_name` - pub tool_name: &'a str, - /// Field 4: `outcome` - pub outcome: ::buffa::EnumValue, - /// True when the call started and no terminal outcome was ever recorded. This - /// is the reader-visible form of an interrupted call awaiting reconciliation. - /// - /// Field 5: `unreconciled` - pub unreconciled: bool, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ToolCallItemView<'a> { - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_name` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_name(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `outcome` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_outcome(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `unreconciled` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_unreconciled(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ToolCallItemView<'a> { - type Owned = super::super::ToolCallItem; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_name = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.outcome = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.unreconciled = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ToolCallItem { - turn_id: self.turn_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - tool_name: self.tool_name.to_string(), - outcome: self.outcome, - unreconciled: self.unreconciled, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ToolCallItemView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_name) as u64; - { - let val = self.outcome.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.turn_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_name, buf); - ::buffa::types::put_int32_field(4u32, self.outcome.to_i32(), buf); - ::buffa::types::put_bool_field(5u32, self.unreconciled, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ToolCallItemView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("turnId", self.turn_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolName", self.tool_name)?; - } - { - __map.serialize_entry("outcome", &self.outcome)?; - } - { - __map.serialize_entry("unreconciled", &self.unreconciled)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ToolCallItemView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ToolCallItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ToolCallItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ToolCallItem"; -} -::buffa::impl_default_view_instance!(ToolCallItemView); -::buffa::impl_view_reborrow!(ToolCallItemView); -/** Self-contained, `'static` owned view of a `ToolCallItem` message. - - Wraps [`::buffa::OwnedView`]`<`[`ToolCallItemView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ToolCallItemView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ToolCallItemOwnedView(::buffa::OwnedView>); -impl ToolCallItemOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallItemOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallItemOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ToolCallItem, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallItemOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ToolCallItemView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ToolCallItemView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ToolCallItem { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Field 3: `tool_name` - #[must_use] - pub fn tool_name(&self) -> &'_ str { - self.0.reborrow().tool_name - } - /// Field 4: `outcome` - #[must_use] - pub fn outcome(&self) -> ::buffa::EnumValue { - self.0.reborrow().outcome - } - /// True when the call started and no terminal outcome was ever recorded. This - /// is the reader-visible form of an interrupted call awaiting reconciliation. - /// - /// Field 5: `unreconciled` - #[must_use] - pub fn unreconciled(&self) -> bool { - self.0.reborrow().unreconciled - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ToolCallItemOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ToolCallItemOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ToolCallItemOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ToolCallItemOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ToolCallItem { - type View<'a> = ToolCallItemView<'a>; - type ViewHandle = ToolCallItemOwnedView; -} -impl ::serde::Serialize for ToolCallItemOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// FileChangeItem is one workspace file change attributed to a tool call. -#[derive(Clone, Debug, Default)] -pub struct FileChangeItemView<'a> { - /// Field 1: `turn_id` - pub turn_id: &'a str, - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Workspace-relative, forward slashes, no leading slash. - /// - /// Field 3: `path` - pub path: &'a str, - /// Field 4: `change_kind` - pub change_kind: ::buffa::EnumValue, - /// Set only for a rename. - /// - /// Field 5: `previous_path` - pub previous_path: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> FileChangeItemView<'a> { - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `path` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_path(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `change_kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_change_kind(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for FileChangeItemView<'a> { - type Owned = super::super::FileChangeItem; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.path = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.change_kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.previous_path = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::FileChangeItem { - turn_id: self.turn_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - path: self.path.to_string(), - change_kind: self.change_kind, - previous_path: self.previous_path.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for FileChangeItemView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.path) as u64; - { - let val = self.change_kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.previous_path { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.turn_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.path, buf); - ::buffa::types::put_int32_field(4u32, self.change_kind.to_i32(), buf); - if let Some(ref v) = self.previous_path { - ::buffa::types::put_string_field(5u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for FileChangeItemView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("turnId", self.turn_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("path", self.path)?; - } - { - __map.serialize_entry("changeKind", &self.change_kind)?; - } - if let ::core::option::Option::Some(__v) = self.previous_path { - __map.serialize_entry("previousPath", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for FileChangeItemView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "FileChangeItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.FileChangeItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.FileChangeItem"; -} -::buffa::impl_default_view_instance!(FileChangeItemView); -::buffa::impl_view_reborrow!(FileChangeItemView); -/** Self-contained, `'static` owned view of a `FileChangeItem` message. - - Wraps [`::buffa::OwnedView`]`<`[`FileChangeItemView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`FileChangeItemView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct FileChangeItemOwnedView(::buffa::OwnedView>); -impl FileChangeItemOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FileChangeItemOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FileChangeItemOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::FileChangeItem, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FileChangeItemOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`FileChangeItemView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &FileChangeItemView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::FileChangeItem { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Workspace-relative, forward slashes, no leading slash. - /// - /// Field 3: `path` - #[must_use] - pub fn path(&self) -> &'_ str { - self.0.reborrow().path - } - /// Field 4: `change_kind` - #[must_use] - pub fn change_kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().change_kind - } - /// Set only for a rename. - /// - /// Field 5: `previous_path` - #[must_use] - pub fn previous_path(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().previous_path - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for FileChangeItemOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - FileChangeItemOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: FileChangeItemOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for FileChangeItemOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::FileChangeItem { - type View<'a> = FileChangeItemView<'a>; - type ViewHandle = FileChangeItemOwnedView; -} -impl ::serde::Serialize for FileChangeItemOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// SystemNoticeItem is a system-originated notice surfaced in the transcript. -#[derive(Clone, Debug, Default)] -pub struct SystemNoticeItemView<'a> { - /// Field 1: `level` - pub level: ::buffa::EnumValue, - /// Field 2: `text` - pub text: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SystemNoticeItemView<'a> { - /**Whether required field `level` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_level(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `text` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_text(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SystemNoticeItemView<'a> { - type Owned = super::super::SystemNoticeItem; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.level = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.text = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SystemNoticeItem { - level: self.level, - text: self.text.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SystemNoticeItemView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.level.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.level.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.text, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SystemNoticeItemView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("level", &self.level)?; - } - { - __map.serialize_entry("text", self.text)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SystemNoticeItemView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "SystemNoticeItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.SystemNoticeItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SystemNoticeItem"; -} -::buffa::impl_default_view_instance!(SystemNoticeItemView); -::buffa::impl_view_reborrow!(SystemNoticeItemView); -/** Self-contained, `'static` owned view of a `SystemNoticeItem` message. - - Wraps [`::buffa::OwnedView`]`<`[`SystemNoticeItemView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SystemNoticeItemView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SystemNoticeItemOwnedView(::buffa::OwnedView>); -impl SystemNoticeItemOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SystemNoticeItemOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SystemNoticeItemOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SystemNoticeItem, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SystemNoticeItemOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SystemNoticeItemView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SystemNoticeItemView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SystemNoticeItem { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `level` - #[must_use] - pub fn level(&self) -> ::buffa::EnumValue { - self.0.reborrow().level - } - /// Field 2: `text` - #[must_use] - pub fn text(&self) -> &'_ str { - self.0.reborrow().text - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SystemNoticeItemOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SystemNoticeItemOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SystemNoticeItemOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SystemNoticeItemOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SystemNoticeItem { - type View<'a> = SystemNoticeItemView<'a>; - type ViewHandle = SystemNoticeItemOwnedView; -} -impl ::serde::Serialize for SystemNoticeItemOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// CompactionItem marks where a range of history was replaced by a summary. -/// -/// It is surfaced rather than hidden so a reader can see that the transcript it -/// is looking at is not the whole transcript. -#[derive(Clone, Debug, Default)] -pub struct CompactionItemView<'a> { - /// Inclusive ordinal range this summary stands in for. - /// - /// Field 1: `covers_from` - pub covers_from: u64, - /// Field 2: `covers_through` - pub covers_through: u64, - /// Field 3: `summary_text` - pub summary_text: &'a str, - /// Field 4: `truncated` - pub truncated: bool, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CompactionItemView<'a> { - /**Whether required field `covers_from` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_covers_from(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `covers_through` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_covers_through(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `summary_text` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_summary_text(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `truncated` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_truncated(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for CompactionItemView<'a> { - type Owned = super::super::CompactionItem; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.covers_from = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.covers_through = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.summary_text = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.truncated = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CompactionItem { - covers_from: self.covers_from, - covers_through: self.covers_through, - summary_text: self.summary_text.to_string(), - truncated: self.truncated, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CompactionItemView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.covers_from) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.covers_through) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary_text) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.covers_from, buf); - ::buffa::types::put_uint64_field(2u32, self.covers_through, buf); - ::buffa::types::put_string_field(3u32, &self.summary_text, buf); - ::buffa::types::put_bool_field(4u32, self.truncated, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CompactionItemView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "coversFrom", - &::buffa::json_helpers::ProtoJson(&self.covers_from), - )?; - } - { - __map - .serialize_entry( - "coversThrough", - &::buffa::json_helpers::ProtoJson(&self.covers_through), - )?; - } - { - __map.serialize_entry("summaryText", self.summary_text)?; - } - { - __map.serialize_entry("truncated", &self.truncated)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CompactionItemView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "CompactionItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.CompactionItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CompactionItem"; -} -::buffa::impl_default_view_instance!(CompactionItemView); -::buffa::impl_view_reborrow!(CompactionItemView); -/** Self-contained, `'static` owned view of a `CompactionItem` message. - - Wraps [`::buffa::OwnedView`]`<`[`CompactionItemView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CompactionItemView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CompactionItemOwnedView(::buffa::OwnedView>); -impl CompactionItemOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionItemOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionItemOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CompactionItem, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionItemOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CompactionItemView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CompactionItemView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CompactionItem { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Inclusive ordinal range this summary stands in for. - /// - /// Field 1: `covers_from` - #[must_use] - pub fn covers_from(&self) -> u64 { - self.0.reborrow().covers_from - } - /// Field 2: `covers_through` - #[must_use] - pub fn covers_through(&self) -> u64 { - self.0.reborrow().covers_through - } - /// Field 3: `summary_text` - #[must_use] - pub fn summary_text(&self) -> &'_ str { - self.0.reborrow().summary_text - } - /// Field 4: `truncated` - #[must_use] - pub fn truncated(&self) -> bool { - self.0.reborrow().truncated - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CompactionItemOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CompactionItemOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CompactionItemOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CompactionItemOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CompactionItem { - type View<'a> = CompactionItemView<'a>; - type ViewHandle = CompactionItemOwnedView; -} -impl ::serde::Serialize for CompactionItemOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.history_item.__view_oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.history_item.__view_oneof.rs deleted file mode 100644 index 4d23b8d05..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.history_item.__view_oneof.rs +++ /dev/null @@ -1,45 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/history_item.proto - -pub mod history_item { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Item<'a> { - UserMessage( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::UserMessageItemView<'a>, - >, - ), - AssistantMessage( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::AssistantMessageItemView<'a>, - >, - ), - ToolCall( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ToolCallItemView<'a>, - >, - ), - FileChange( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::FileChangeItemView<'a>, - >, - ), - SystemNotice( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SystemNoticeItemView<'a>, - >, - ), - Compaction( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::CompactionItemView<'a>, - >, - ), - Elided( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::HistoryItemElidedView<'a>, - >, - ), - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.history_item.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.history_item.rs deleted file mode 100644 index 9214a5e2e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.history_item.rs +++ /dev/null @@ -1,2884 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/history_item.proto - -/// HistoryItemKind is what an item is, readable without decoding the union. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum HistoryItemKind { - HISTORY_ITEM_KIND_UNSPECIFIED = 0i32, - HISTORY_ITEM_KIND_USER_MESSAGE = 1i32, - HISTORY_ITEM_KIND_ASSISTANT_MESSAGE = 2i32, - HISTORY_ITEM_KIND_TOOL_CALL = 3i32, - HISTORY_ITEM_KIND_FILE_CHANGE = 4i32, - HISTORY_ITEM_KIND_SYSTEM_NOTICE = 5i32, - HISTORY_ITEM_KIND_COMPACTION = 6i32, - /// The item exists but was not rendered. `elided` says why. - HISTORY_ITEM_KIND_ELIDED = 7i32, -} -impl HistoryItemKind { - ///Idiomatic alias for [`Self::HISTORY_ITEM_KIND_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::HISTORY_ITEM_KIND_UNSPECIFIED; - ///Idiomatic alias for [`Self::HISTORY_ITEM_KIND_USER_MESSAGE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const UserMessage: Self = Self::HISTORY_ITEM_KIND_USER_MESSAGE; - ///Idiomatic alias for [`Self::HISTORY_ITEM_KIND_ASSISTANT_MESSAGE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const AssistantMessage: Self = Self::HISTORY_ITEM_KIND_ASSISTANT_MESSAGE; - ///Idiomatic alias for [`Self::HISTORY_ITEM_KIND_TOOL_CALL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ToolCall: Self = Self::HISTORY_ITEM_KIND_TOOL_CALL; - ///Idiomatic alias for [`Self::HISTORY_ITEM_KIND_FILE_CHANGE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const FileChange: Self = Self::HISTORY_ITEM_KIND_FILE_CHANGE; - ///Idiomatic alias for [`Self::HISTORY_ITEM_KIND_SYSTEM_NOTICE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SystemNotice: Self = Self::HISTORY_ITEM_KIND_SYSTEM_NOTICE; - ///Idiomatic alias for [`Self::HISTORY_ITEM_KIND_COMPACTION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Compaction: Self = Self::HISTORY_ITEM_KIND_COMPACTION; - ///Idiomatic alias for [`Self::HISTORY_ITEM_KIND_ELIDED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Elided: Self = Self::HISTORY_ITEM_KIND_ELIDED; -} -impl ::core::default::Default for HistoryItemKind { - fn default() -> Self { - Self::HISTORY_ITEM_KIND_UNSPECIFIED - } -} -impl ::serde::Serialize for HistoryItemKind { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for HistoryItemKind { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = HistoryItemKind; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(HistoryItemKind) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for HistoryItemKind { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for HistoryItemKind { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_USER_MESSAGE), - 2i32 => { - ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_ASSISTANT_MESSAGE) - } - 3i32 => ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_TOOL_CALL), - 4i32 => ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_FILE_CHANGE), - 5i32 => ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_SYSTEM_NOTICE), - 6i32 => ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_COMPACTION), - 7i32 => ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_ELIDED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::HISTORY_ITEM_KIND_UNSPECIFIED => "HISTORY_ITEM_KIND_UNSPECIFIED", - Self::HISTORY_ITEM_KIND_USER_MESSAGE => "HISTORY_ITEM_KIND_USER_MESSAGE", - Self::HISTORY_ITEM_KIND_ASSISTANT_MESSAGE => { - "HISTORY_ITEM_KIND_ASSISTANT_MESSAGE" - } - Self::HISTORY_ITEM_KIND_TOOL_CALL => "HISTORY_ITEM_KIND_TOOL_CALL", - Self::HISTORY_ITEM_KIND_FILE_CHANGE => "HISTORY_ITEM_KIND_FILE_CHANGE", - Self::HISTORY_ITEM_KIND_SYSTEM_NOTICE => "HISTORY_ITEM_KIND_SYSTEM_NOTICE", - Self::HISTORY_ITEM_KIND_COMPACTION => "HISTORY_ITEM_KIND_COMPACTION", - Self::HISTORY_ITEM_KIND_ELIDED => "HISTORY_ITEM_KIND_ELIDED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "HISTORY_ITEM_KIND_UNSPECIFIED" => { - ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_UNSPECIFIED) - } - "HISTORY_ITEM_KIND_USER_MESSAGE" => { - ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_USER_MESSAGE) - } - "HISTORY_ITEM_KIND_ASSISTANT_MESSAGE" => { - ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_ASSISTANT_MESSAGE) - } - "HISTORY_ITEM_KIND_TOOL_CALL" => { - ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_TOOL_CALL) - } - "HISTORY_ITEM_KIND_FILE_CHANGE" => { - ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_FILE_CHANGE) - } - "HISTORY_ITEM_KIND_SYSTEM_NOTICE" => { - ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_SYSTEM_NOTICE) - } - "HISTORY_ITEM_KIND_COMPACTION" => { - ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_COMPACTION) - } - "HISTORY_ITEM_KIND_ELIDED" => { - ::core::option::Option::Some(Self::HISTORY_ITEM_KIND_ELIDED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::HISTORY_ITEM_KIND_UNSPECIFIED, - Self::HISTORY_ITEM_KIND_USER_MESSAGE, - Self::HISTORY_ITEM_KIND_ASSISTANT_MESSAGE, - Self::HISTORY_ITEM_KIND_TOOL_CALL, - Self::HISTORY_ITEM_KIND_FILE_CHANGE, - Self::HISTORY_ITEM_KIND_SYSTEM_NOTICE, - Self::HISTORY_ITEM_KIND_COMPACTION, - Self::HISTORY_ITEM_KIND_ELIDED, - ] - } -} -/// ElisionReason is why an item was withheld. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ElisionReason { - ELISION_REASON_UNSPECIFIED = 0i32, - /// The item needs a variant introduced after the caller's contract minor. - /// Upgrading the caller resolves it. - ELISION_REASON_CONTRACT_CLAMPED = 1i32, - /// A redaction masked the item's content. The item's existence is still a - /// fact; only the content is gone. - ELISION_REASON_REDACTED = 2i32, - /// The caller is not authorized to see this item's content. - ELISION_REASON_NOT_AUTHORIZED = 3i32, -} -impl ElisionReason { - ///Idiomatic alias for [`Self::ELISION_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::ELISION_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::ELISION_REASON_CONTRACT_CLAMPED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ContractClamped: Self = Self::ELISION_REASON_CONTRACT_CLAMPED; - ///Idiomatic alias for [`Self::ELISION_REASON_REDACTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Redacted: Self = Self::ELISION_REASON_REDACTED; - ///Idiomatic alias for [`Self::ELISION_REASON_NOT_AUTHORIZED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NotAuthorized: Self = Self::ELISION_REASON_NOT_AUTHORIZED; -} -impl ::core::default::Default for ElisionReason { - fn default() -> Self { - Self::ELISION_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for ElisionReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ElisionReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ElisionReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(ElisionReason)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ElisionReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ElisionReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::ELISION_REASON_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::ELISION_REASON_CONTRACT_CLAMPED), - 2i32 => ::core::option::Option::Some(Self::ELISION_REASON_REDACTED), - 3i32 => ::core::option::Option::Some(Self::ELISION_REASON_NOT_AUTHORIZED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::ELISION_REASON_UNSPECIFIED => "ELISION_REASON_UNSPECIFIED", - Self::ELISION_REASON_CONTRACT_CLAMPED => "ELISION_REASON_CONTRACT_CLAMPED", - Self::ELISION_REASON_REDACTED => "ELISION_REASON_REDACTED", - Self::ELISION_REASON_NOT_AUTHORIZED => "ELISION_REASON_NOT_AUTHORIZED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "ELISION_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::ELISION_REASON_UNSPECIFIED) - } - "ELISION_REASON_CONTRACT_CLAMPED" => { - ::core::option::Option::Some(Self::ELISION_REASON_CONTRACT_CLAMPED) - } - "ELISION_REASON_REDACTED" => { - ::core::option::Option::Some(Self::ELISION_REASON_REDACTED) - } - "ELISION_REASON_NOT_AUTHORIZED" => { - ::core::option::Option::Some(Self::ELISION_REASON_NOT_AUTHORIZED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::ELISION_REASON_UNSPECIFIED, - Self::ELISION_REASON_CONTRACT_CLAMPED, - Self::ELISION_REASON_REDACTED, - Self::ELISION_REASON_NOT_AUTHORIZED, - ] - } -} -/// AssistantMessageOutcome is how a generation ended. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum AssistantMessageOutcome { - ASSISTANT_MESSAGE_OUTCOME_UNSPECIFIED = 0i32, - /// Started, with no terminal fact recorded. Either still running or stranded - /// by a crash; the reader cannot tell which, and must not present it as done. - ASSISTANT_MESSAGE_OUTCOME_IN_FLIGHT = 1i32, - ASSISTANT_MESSAGE_OUTCOME_COMPLETED = 2i32, - ASSISTANT_MESSAGE_OUTCOME_FAILED = 3i32, -} -impl AssistantMessageOutcome { - ///Idiomatic alias for [`Self::ASSISTANT_MESSAGE_OUTCOME_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::ASSISTANT_MESSAGE_OUTCOME_UNSPECIFIED; - ///Idiomatic alias for [`Self::ASSISTANT_MESSAGE_OUTCOME_IN_FLIGHT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const InFlight: Self = Self::ASSISTANT_MESSAGE_OUTCOME_IN_FLIGHT; - ///Idiomatic alias for [`Self::ASSISTANT_MESSAGE_OUTCOME_COMPLETED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Completed: Self = Self::ASSISTANT_MESSAGE_OUTCOME_COMPLETED; - ///Idiomatic alias for [`Self::ASSISTANT_MESSAGE_OUTCOME_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Failed: Self = Self::ASSISTANT_MESSAGE_OUTCOME_FAILED; -} -impl ::core::default::Default for AssistantMessageOutcome { - fn default() -> Self { - Self::ASSISTANT_MESSAGE_OUTCOME_UNSPECIFIED - } -} -impl ::serde::Serialize for AssistantMessageOutcome { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for AssistantMessageOutcome { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = AssistantMessageOutcome; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(AssistantMessageOutcome) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for AssistantMessageOutcome { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for AssistantMessageOutcome { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some(Self::ASSISTANT_MESSAGE_OUTCOME_UNSPECIFIED) - } - 1i32 => { - ::core::option::Option::Some(Self::ASSISTANT_MESSAGE_OUTCOME_IN_FLIGHT) - } - 2i32 => { - ::core::option::Option::Some(Self::ASSISTANT_MESSAGE_OUTCOME_COMPLETED) - } - 3i32 => ::core::option::Option::Some(Self::ASSISTANT_MESSAGE_OUTCOME_FAILED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::ASSISTANT_MESSAGE_OUTCOME_UNSPECIFIED => { - "ASSISTANT_MESSAGE_OUTCOME_UNSPECIFIED" - } - Self::ASSISTANT_MESSAGE_OUTCOME_IN_FLIGHT => { - "ASSISTANT_MESSAGE_OUTCOME_IN_FLIGHT" - } - Self::ASSISTANT_MESSAGE_OUTCOME_COMPLETED => { - "ASSISTANT_MESSAGE_OUTCOME_COMPLETED" - } - Self::ASSISTANT_MESSAGE_OUTCOME_FAILED => "ASSISTANT_MESSAGE_OUTCOME_FAILED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "ASSISTANT_MESSAGE_OUTCOME_UNSPECIFIED" => { - ::core::option::Option::Some(Self::ASSISTANT_MESSAGE_OUTCOME_UNSPECIFIED) - } - "ASSISTANT_MESSAGE_OUTCOME_IN_FLIGHT" => { - ::core::option::Option::Some(Self::ASSISTANT_MESSAGE_OUTCOME_IN_FLIGHT) - } - "ASSISTANT_MESSAGE_OUTCOME_COMPLETED" => { - ::core::option::Option::Some(Self::ASSISTANT_MESSAGE_OUTCOME_COMPLETED) - } - "ASSISTANT_MESSAGE_OUTCOME_FAILED" => { - ::core::option::Option::Some(Self::ASSISTANT_MESSAGE_OUTCOME_FAILED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::ASSISTANT_MESSAGE_OUTCOME_UNSPECIFIED, - Self::ASSISTANT_MESSAGE_OUTCOME_IN_FLIGHT, - Self::ASSISTANT_MESSAGE_OUTCOME_COMPLETED, - Self::ASSISTANT_MESSAGE_OUTCOME_FAILED, - ] - } -} -/// ToolCallOutcome is where a tool call stopped. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ToolCallOutcome { - TOOL_CALL_OUTCOME_UNSPECIFIED = 0i32, - TOOL_CALL_OUTCOME_REQUESTED = 1i32, - TOOL_CALL_OUTCOME_APPROVED = 2i32, - TOOL_CALL_OUTCOME_DENIED = 3i32, - /// Running, or stranded by a crash. See `unreconciled`. - TOOL_CALL_OUTCOME_STARTED = 4i32, - TOOL_CALL_OUTCOME_COMPLETED = 5i32, - TOOL_CALL_OUTCOME_FAILED = 6i32, -} -impl ToolCallOutcome { - ///Idiomatic alias for [`Self::TOOL_CALL_OUTCOME_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::TOOL_CALL_OUTCOME_UNSPECIFIED; - ///Idiomatic alias for [`Self::TOOL_CALL_OUTCOME_REQUESTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Requested: Self = Self::TOOL_CALL_OUTCOME_REQUESTED; - ///Idiomatic alias for [`Self::TOOL_CALL_OUTCOME_APPROVED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Approved: Self = Self::TOOL_CALL_OUTCOME_APPROVED; - ///Idiomatic alias for [`Self::TOOL_CALL_OUTCOME_DENIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Denied: Self = Self::TOOL_CALL_OUTCOME_DENIED; - ///Idiomatic alias for [`Self::TOOL_CALL_OUTCOME_STARTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Started: Self = Self::TOOL_CALL_OUTCOME_STARTED; - ///Idiomatic alias for [`Self::TOOL_CALL_OUTCOME_COMPLETED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Completed: Self = Self::TOOL_CALL_OUTCOME_COMPLETED; - ///Idiomatic alias for [`Self::TOOL_CALL_OUTCOME_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Failed: Self = Self::TOOL_CALL_OUTCOME_FAILED; -} -impl ::core::default::Default for ToolCallOutcome { - fn default() -> Self { - Self::TOOL_CALL_OUTCOME_UNSPECIFIED - } -} -impl ::serde::Serialize for ToolCallOutcome { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ToolCallOutcome { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ToolCallOutcome; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(ToolCallOutcome) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolCallOutcome { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ToolCallOutcome { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_REQUESTED), - 2i32 => ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_APPROVED), - 3i32 => ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_DENIED), - 4i32 => ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_STARTED), - 5i32 => ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_COMPLETED), - 6i32 => ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_FAILED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::TOOL_CALL_OUTCOME_UNSPECIFIED => "TOOL_CALL_OUTCOME_UNSPECIFIED", - Self::TOOL_CALL_OUTCOME_REQUESTED => "TOOL_CALL_OUTCOME_REQUESTED", - Self::TOOL_CALL_OUTCOME_APPROVED => "TOOL_CALL_OUTCOME_APPROVED", - Self::TOOL_CALL_OUTCOME_DENIED => "TOOL_CALL_OUTCOME_DENIED", - Self::TOOL_CALL_OUTCOME_STARTED => "TOOL_CALL_OUTCOME_STARTED", - Self::TOOL_CALL_OUTCOME_COMPLETED => "TOOL_CALL_OUTCOME_COMPLETED", - Self::TOOL_CALL_OUTCOME_FAILED => "TOOL_CALL_OUTCOME_FAILED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "TOOL_CALL_OUTCOME_UNSPECIFIED" => { - ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_UNSPECIFIED) - } - "TOOL_CALL_OUTCOME_REQUESTED" => { - ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_REQUESTED) - } - "TOOL_CALL_OUTCOME_APPROVED" => { - ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_APPROVED) - } - "TOOL_CALL_OUTCOME_DENIED" => { - ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_DENIED) - } - "TOOL_CALL_OUTCOME_STARTED" => { - ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_STARTED) - } - "TOOL_CALL_OUTCOME_COMPLETED" => { - ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_COMPLETED) - } - "TOOL_CALL_OUTCOME_FAILED" => { - ::core::option::Option::Some(Self::TOOL_CALL_OUTCOME_FAILED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::TOOL_CALL_OUTCOME_UNSPECIFIED, - Self::TOOL_CALL_OUTCOME_REQUESTED, - Self::TOOL_CALL_OUTCOME_APPROVED, - Self::TOOL_CALL_OUTCOME_DENIED, - Self::TOOL_CALL_OUTCOME_STARTED, - Self::TOOL_CALL_OUTCOME_COMPLETED, - Self::TOOL_CALL_OUTCOME_FAILED, - ] - } -} -/// FileChangeKindView is what happened to a file. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum FileChangeKindView { - FILE_CHANGE_KIND_VIEW_UNSPECIFIED = 0i32, - FILE_CHANGE_KIND_VIEW_CREATED = 1i32, - FILE_CHANGE_KIND_VIEW_MODIFIED = 2i32, - FILE_CHANGE_KIND_VIEW_DELETED = 3i32, - FILE_CHANGE_KIND_VIEW_RENAMED = 4i32, -} -impl FileChangeKindView { - ///Idiomatic alias for [`Self::FILE_CHANGE_KIND_VIEW_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::FILE_CHANGE_KIND_VIEW_UNSPECIFIED; - ///Idiomatic alias for [`Self::FILE_CHANGE_KIND_VIEW_CREATED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Created: Self = Self::FILE_CHANGE_KIND_VIEW_CREATED; - ///Idiomatic alias for [`Self::FILE_CHANGE_KIND_VIEW_MODIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Modified: Self = Self::FILE_CHANGE_KIND_VIEW_MODIFIED; - ///Idiomatic alias for [`Self::FILE_CHANGE_KIND_VIEW_DELETED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Deleted: Self = Self::FILE_CHANGE_KIND_VIEW_DELETED; - ///Idiomatic alias for [`Self::FILE_CHANGE_KIND_VIEW_RENAMED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Renamed: Self = Self::FILE_CHANGE_KIND_VIEW_RENAMED; -} -impl ::core::default::Default for FileChangeKindView { - fn default() -> Self { - Self::FILE_CHANGE_KIND_VIEW_UNSPECIFIED - } -} -impl ::serde::Serialize for FileChangeKindView { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for FileChangeKindView { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = FileChangeKindView; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(FileChangeKindView) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for FileChangeKindView { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for FileChangeKindView { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::FILE_CHANGE_KIND_VIEW_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::FILE_CHANGE_KIND_VIEW_CREATED), - 2i32 => ::core::option::Option::Some(Self::FILE_CHANGE_KIND_VIEW_MODIFIED), - 3i32 => ::core::option::Option::Some(Self::FILE_CHANGE_KIND_VIEW_DELETED), - 4i32 => ::core::option::Option::Some(Self::FILE_CHANGE_KIND_VIEW_RENAMED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::FILE_CHANGE_KIND_VIEW_UNSPECIFIED => { - "FILE_CHANGE_KIND_VIEW_UNSPECIFIED" - } - Self::FILE_CHANGE_KIND_VIEW_CREATED => "FILE_CHANGE_KIND_VIEW_CREATED", - Self::FILE_CHANGE_KIND_VIEW_MODIFIED => "FILE_CHANGE_KIND_VIEW_MODIFIED", - Self::FILE_CHANGE_KIND_VIEW_DELETED => "FILE_CHANGE_KIND_VIEW_DELETED", - Self::FILE_CHANGE_KIND_VIEW_RENAMED => "FILE_CHANGE_KIND_VIEW_RENAMED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "FILE_CHANGE_KIND_VIEW_UNSPECIFIED" => { - ::core::option::Option::Some(Self::FILE_CHANGE_KIND_VIEW_UNSPECIFIED) - } - "FILE_CHANGE_KIND_VIEW_CREATED" => { - ::core::option::Option::Some(Self::FILE_CHANGE_KIND_VIEW_CREATED) - } - "FILE_CHANGE_KIND_VIEW_MODIFIED" => { - ::core::option::Option::Some(Self::FILE_CHANGE_KIND_VIEW_MODIFIED) - } - "FILE_CHANGE_KIND_VIEW_DELETED" => { - ::core::option::Option::Some(Self::FILE_CHANGE_KIND_VIEW_DELETED) - } - "FILE_CHANGE_KIND_VIEW_RENAMED" => { - ::core::option::Option::Some(Self::FILE_CHANGE_KIND_VIEW_RENAMED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::FILE_CHANGE_KIND_VIEW_UNSPECIFIED, - Self::FILE_CHANGE_KIND_VIEW_CREATED, - Self::FILE_CHANGE_KIND_VIEW_MODIFIED, - Self::FILE_CHANGE_KIND_VIEW_DELETED, - Self::FILE_CHANGE_KIND_VIEW_RENAMED, - ] - } -} -/// NoticeLevelView is a notice's severity. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum NoticeLevelView { - NOTICE_LEVEL_VIEW_UNSPECIFIED = 0i32, - NOTICE_LEVEL_VIEW_INFO = 1i32, - NOTICE_LEVEL_VIEW_WARNING = 2i32, - NOTICE_LEVEL_VIEW_ERROR = 3i32, -} -impl NoticeLevelView { - ///Idiomatic alias for [`Self::NOTICE_LEVEL_VIEW_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::NOTICE_LEVEL_VIEW_UNSPECIFIED; - ///Idiomatic alias for [`Self::NOTICE_LEVEL_VIEW_INFO`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Info: Self = Self::NOTICE_LEVEL_VIEW_INFO; - ///Idiomatic alias for [`Self::NOTICE_LEVEL_VIEW_WARNING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Warning: Self = Self::NOTICE_LEVEL_VIEW_WARNING; - ///Idiomatic alias for [`Self::NOTICE_LEVEL_VIEW_ERROR`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Error: Self = Self::NOTICE_LEVEL_VIEW_ERROR; -} -impl ::core::default::Default for NoticeLevelView { - fn default() -> Self { - Self::NOTICE_LEVEL_VIEW_UNSPECIFIED - } -} -impl ::serde::Serialize for NoticeLevelView { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for NoticeLevelView { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = NoticeLevelView; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(NoticeLevelView) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for NoticeLevelView { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for NoticeLevelView { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::NOTICE_LEVEL_VIEW_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::NOTICE_LEVEL_VIEW_INFO), - 2i32 => ::core::option::Option::Some(Self::NOTICE_LEVEL_VIEW_WARNING), - 3i32 => ::core::option::Option::Some(Self::NOTICE_LEVEL_VIEW_ERROR), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::NOTICE_LEVEL_VIEW_UNSPECIFIED => "NOTICE_LEVEL_VIEW_UNSPECIFIED", - Self::NOTICE_LEVEL_VIEW_INFO => "NOTICE_LEVEL_VIEW_INFO", - Self::NOTICE_LEVEL_VIEW_WARNING => "NOTICE_LEVEL_VIEW_WARNING", - Self::NOTICE_LEVEL_VIEW_ERROR => "NOTICE_LEVEL_VIEW_ERROR", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "NOTICE_LEVEL_VIEW_UNSPECIFIED" => { - ::core::option::Option::Some(Self::NOTICE_LEVEL_VIEW_UNSPECIFIED) - } - "NOTICE_LEVEL_VIEW_INFO" => { - ::core::option::Option::Some(Self::NOTICE_LEVEL_VIEW_INFO) - } - "NOTICE_LEVEL_VIEW_WARNING" => { - ::core::option::Option::Some(Self::NOTICE_LEVEL_VIEW_WARNING) - } - "NOTICE_LEVEL_VIEW_ERROR" => { - ::core::option::Option::Some(Self::NOTICE_LEVEL_VIEW_ERROR) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::NOTICE_LEVEL_VIEW_UNSPECIFIED, - Self::NOTICE_LEVEL_VIEW_INFO, - Self::NOTICE_LEVEL_VIEW_WARNING, - Self::NOTICE_LEVEL_VIEW_ERROR, - ] - } -} -/// HistoryItem is one entry in a session's reader-visible history. -/// -/// The discriminated-union hazard this shape is built around: a caller decoding -/// a `oneof` arm added after its contract minor sees an unset `oneof` and cannot -/// distinguish "a variant I do not know" from "a variant that was not set". -/// Silently rendering nothing for a real event is a correctness failure, not a -/// cosmetic one. -/// -/// Two mechanisms close that gap: -/// -/// 1. `kind` is a plain enum outside the `oneof`. Proto enums are open, so an -/// ```text -/// unrecognized kind decodes as its raw number rather than vanishing, and a -/// caller can always tell that something is here it does not understand. -/// ``` -/// 2. The server clamps to the caller's declared contract minor and emits -/// ```text -/// HISTORY_ITEM_KIND_ELIDED with an `elided` payload rather than a variant -/// the caller cannot decode. Elision is affirmative: the caller reads that -/// an item was withheld instead of inferring it from an empty field. -/// ``` -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct HistoryItem { - /// Stable within a session, opaque, and safe to use as a rendering key. It - /// remains stable across an elision, so a client that upgrades sees the same - /// item resolve to a real variant. - /// - /// Field 1: `item_id` - #[serde( - rename = "itemId", - alias = "item_id", - with = "::buffa::json_helpers::proto_string" - )] - pub item_id: ::buffa::alloc::string::String, - /// The session's own 1-indexed position for this item. - /// - /// Field 2: `ordinal` - #[serde(rename = "ordinal", with = "::buffa::json_helpers::uint64")] - pub ordinal: u64, - /// Set even when the matching `item` arm is absent, so an unknown or withheld - /// item is still identifiable. - /// - /// Field 3: `kind` - #[serde(rename = "kind", with = "::buffa::json_helpers::proto_enum")] - pub kind: ::buffa::EnumValue, - #[serde(flatten)] - pub item: ::core::option::Option<__buffa::oneof::history_item::Item>, -} -impl ::core::fmt::Debug for HistoryItem { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("HistoryItem") - .field("item_id", &self.item_id) - .field("ordinal", &self.ordinal) - .field("kind", &self.kind) - .field("item", &self.item) - .finish() - } -} -impl HistoryItem { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.HistoryItem"; -} -::buffa::impl_default_instance!(HistoryItem); -impl ::buffa::MessageName for HistoryItem { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "HistoryItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.HistoryItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.HistoryItem"; -} -impl ::buffa::Message for HistoryItem { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.item_id) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.ordinal) as u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let ::core::option::Option::Some(ref v) = self.item { - match v { - __buffa::oneof::history_item::Item::UserMessage(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::history_item::Item::AssistantMessage(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::history_item::Item::ToolCall(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::history_item::Item::FileChange(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::history_item::Item::SystemNotice(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::history_item::Item::Compaction(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::history_item::Item::Elided(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.item_id, buf); - ::buffa::types::put_uint64_field(2u32, self.ordinal, buf); - ::buffa::types::put_int32_field(3u32, self.kind.to_i32(), buf); - if let ::core::option::Option::Some(ref v) = self.item { - match v { - __buffa::oneof::history_item::Item::UserMessage(x) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::history_item::Item::AssistantMessage(x) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::history_item::Item::ToolCall(x) => { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::history_item::Item::FileChange(x) => { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::history_item::Item::SystemNotice(x) => { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::history_item::Item::Compaction(x) => { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::history_item::Item::Elided(x) => { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.item_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.ordinal = ::buffa::types::decode_uint64(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.kind = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::history_item::Item::UserMessage(ref mut existing), - ) = self.item - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.item = ::core::option::Option::Some( - __buffa::oneof::history_item::Item::UserMessage( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::history_item::Item::AssistantMessage( - ref mut existing, - ), - ) = self.item - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.item = ::core::option::Option::Some( - __buffa::oneof::history_item::Item::AssistantMessage( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::history_item::Item::ToolCall(ref mut existing), - ) = self.item - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.item = ::core::option::Option::Some( - __buffa::oneof::history_item::Item::ToolCall( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::history_item::Item::FileChange(ref mut existing), - ) = self.item - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.item = ::core::option::Option::Some( - __buffa::oneof::history_item::Item::FileChange( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::history_item::Item::SystemNotice(ref mut existing), - ) = self.item - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.item = ::core::option::Option::Some( - __buffa::oneof::history_item::Item::SystemNotice( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::history_item::Item::Compaction(ref mut existing), - ) = self.item - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.item = ::core::option::Option::Some( - __buffa::oneof::history_item::Item::Compaction( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::history_item::Item::Elided(ref mut existing), - ) = self.item - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.item = ::core::option::Option::Some( - __buffa::oneof::history_item::Item::Elided( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.item_id.clear(); - self.ordinal = 0u64; - self.kind = ::buffa::EnumValue::from(0); - self.item = ::core::option::Option::None; - } -} -impl<'de> serde::Deserialize<'de> for HistoryItem { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = HistoryItem; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct HistoryItem") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __f_item_id: ::core::option::Option< - ::buffa::alloc::string::String, - > = None; - let mut __f_ordinal: ::core::option::Option = None; - let mut __f_kind: ::core::option::Option< - ::buffa::EnumValue, - > = None; - let mut __oneof_item: ::core::option::Option< - __buffa::oneof::history_item::Item, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "itemId" | "item_id" => { - __f_item_id = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::alloc::string::String; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::string::String, - D::Error, - > { - ::buffa::json_helpers::proto_string::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "ordinal" => { - __f_ordinal = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = u64; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result { - ::buffa::json_helpers::uint64::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "kind" => { - __f_kind = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::EnumValue; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::EnumValue, - D::Error, - > { - ::buffa::json_helpers::proto_enum::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "userMessage" | "user_message" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - UserMessageItem, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_item.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'item'", - ), - ); - } - __oneof_item = Some( - __buffa::oneof::history_item::Item::UserMessage( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "assistantMessage" | "assistant_message" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - AssistantMessageItem, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_item.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'item'", - ), - ); - } - __oneof_item = Some( - __buffa::oneof::history_item::Item::AssistantMessage( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "toolCall" | "tool_call" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ToolCallItem, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_item.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'item'", - ), - ); - } - __oneof_item = Some( - __buffa::oneof::history_item::Item::ToolCall( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "fileChange" | "file_change" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - FileChangeItem, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_item.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'item'", - ), - ); - } - __oneof_item = Some( - __buffa::oneof::history_item::Item::FileChange( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "systemNotice" | "system_notice" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SystemNoticeItem, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_item.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'item'", - ), - ); - } - __oneof_item = Some( - __buffa::oneof::history_item::Item::SystemNotice( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "compaction" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - CompactionItem, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_item.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'item'", - ), - ); - } - __oneof_item = Some( - __buffa::oneof::history_item::Item::Compaction( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "elided" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - HistoryItemElided, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_item.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'item'", - ), - ); - } - __oneof_item = Some( - __buffa::oneof::history_item::Item::Elided( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - if let ::core::option::Option::Some(v) = __f_item_id { - __r.item_id = v; - } - if let ::core::option::Option::Some(v) = __f_ordinal { - __r.ordinal = v; - } - if let ::core::option::Option::Some(v) = __f_kind { - __r.kind = v; - } - __r.item = __oneof_item; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for HistoryItem { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __HISTORY_ITEM_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.HistoryItem", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod history_item { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::history_item::Item; - #[doc(inline)] - pub use super::__buffa::view::oneof::history_item::Item as ItemView; -} -/// HistoryItemElided is an item the server chose not to render, stated -/// affirmatively so a caller never mistakes a withheld item for a missing one. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct HistoryItemElided { - /// Field 1: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for HistoryItemElided { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("HistoryItemElided").field("reason", &self.reason).finish() - } -} -impl HistoryItemElided { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.HistoryItemElided"; -} -::buffa::impl_default_instance!(HistoryItemElided); -impl ::buffa::MessageName for HistoryItemElided { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "HistoryItemElided"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.HistoryItemElided"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.HistoryItemElided"; -} -impl ::buffa::Message for HistoryItemElided { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.reason = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for HistoryItemElided { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __HISTORY_ITEM_ELIDED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.HistoryItemElided", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// UserMessageItem is a message from the user. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct UserMessageItem { - /// Field 1: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, - /// Rendered plain text. Structured and provider-native content is reachable - /// through the artifact surface, not inlined here. - /// - /// Field 2: `text` - #[serde(rename = "text", with = "::buffa::json_helpers::proto_string")] - pub text: ::buffa::alloc::string::String, - /// The text was shortened for transport. The full content is not recoverable - /// from this response. - /// - /// Field 3: `truncated` - #[serde(rename = "truncated", with = "::buffa::json_helpers::proto_bool")] - pub truncated: bool, -} -impl ::core::fmt::Debug for UserMessageItem { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("UserMessageItem") - .field("turn_id", &self.turn_id) - .field("text", &self.text) - .field("truncated", &self.truncated) - .finish() - } -} -impl UserMessageItem { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.UserMessageItem"; -} -::buffa::impl_default_instance!(UserMessageItem); -impl ::buffa::MessageName for UserMessageItem { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "UserMessageItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.UserMessageItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.UserMessageItem"; -} -impl ::buffa::Message for UserMessageItem { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.turn_id, buf); - ::buffa::types::put_string_field(2u32, &self.text, buf); - ::buffa::types::put_bool_field(3u32, self.truncated, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.text, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.truncated = ::buffa::types::decode_bool(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.turn_id.clear(); - self.text.clear(); - self.truncated = false; - } -} -impl ::buffa::json_helpers::ProtoElemJson for UserMessageItem { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __USER_MESSAGE_ITEM_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.UserMessageItem", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// AssistantMessageItem is one assistant generation and its outcome. -/// -/// It carries a terminal state rather than a completion flag, because a -/// generation that was interrupted is a different fact from one still running, -/// and a boolean cannot hold that difference. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct AssistantMessageItem { - /// Field 1: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, - /// Field 2: `model` - #[serde(rename = "model", with = "::buffa::json_helpers::proto_string")] - pub model: ::buffa::alloc::string::String, - /// Field 3: `text` - #[serde(rename = "text", with = "::buffa::json_helpers::proto_string")] - pub text: ::buffa::alloc::string::String, - /// Field 4: `truncated` - #[serde(rename = "truncated", with = "::buffa::json_helpers::proto_bool")] - pub truncated: bool, - /// Field 5: `outcome` - #[serde(rename = "outcome", with = "::buffa::json_helpers::proto_enum")] - pub outcome: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for AssistantMessageItem { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("AssistantMessageItem") - .field("turn_id", &self.turn_id) - .field("model", &self.model) - .field("text", &self.text) - .field("truncated", &self.truncated) - .field("outcome", &self.outcome) - .finish() - } -} -impl AssistantMessageItem { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.AssistantMessageItem"; -} -::buffa::impl_default_instance!(AssistantMessageItem); -impl ::buffa::MessageName for AssistantMessageItem { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "AssistantMessageItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.AssistantMessageItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.AssistantMessageItem"; -} -impl ::buffa::Message for AssistantMessageItem { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.model) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - { - let val = self.outcome.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.turn_id, buf); - ::buffa::types::put_string_field(2u32, &self.model, buf); - ::buffa::types::put_string_field(3u32, &self.text, buf); - ::buffa::types::put_bool_field(4u32, self.truncated, buf); - ::buffa::types::put_int32_field(5u32, self.outcome.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.model, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.text, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.truncated = ::buffa::types::decode_bool(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.outcome = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.turn_id.clear(); - self.model.clear(); - self.text.clear(); - self.truncated = false; - self.outcome = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for AssistantMessageItem { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ASSISTANT_MESSAGE_ITEM_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.AssistantMessageItem", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ToolCallItem is one tool call and its lifecycle position. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ToolCallItem { - /// Field 1: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Field 3: `tool_name` - #[serde( - rename = "toolName", - alias = "tool_name", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_name: ::buffa::alloc::string::String, - /// Field 4: `outcome` - #[serde(rename = "outcome", with = "::buffa::json_helpers::proto_enum")] - pub outcome: ::buffa::EnumValue, - /// True when the call started and no terminal outcome was ever recorded. This - /// is the reader-visible form of an interrupted call awaiting reconciliation. - /// - /// Field 5: `unreconciled` - #[serde(rename = "unreconciled", with = "::buffa::json_helpers::proto_bool")] - pub unreconciled: bool, -} -impl ::core::fmt::Debug for ToolCallItem { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ToolCallItem") - .field("turn_id", &self.turn_id) - .field("tool_call_id", &self.tool_call_id) - .field("tool_name", &self.tool_name) - .field("outcome", &self.outcome) - .field("unreconciled", &self.unreconciled) - .finish() - } -} -impl ToolCallItem { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ToolCallItem"; -} -::buffa::impl_default_instance!(ToolCallItem); -impl ::buffa::MessageName for ToolCallItem { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ToolCallItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ToolCallItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ToolCallItem"; -} -impl ::buffa::Message for ToolCallItem { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_name) as u64; - { - let val = self.outcome.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.turn_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_name, buf); - ::buffa::types::put_int32_field(4u32, self.outcome.to_i32(), buf); - ::buffa::types::put_bool_field(5u32, self.unreconciled, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_name, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.outcome = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.unreconciled = ::buffa::types::decode_bool(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.turn_id.clear(); - self.tool_call_id.clear(); - self.tool_name.clear(); - self.outcome = ::buffa::EnumValue::from(0); - self.unreconciled = false; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolCallItem { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TOOL_CALL_ITEM_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ToolCallItem", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// FileChangeItem is one workspace file change attributed to a tool call. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct FileChangeItem { - /// Field 1: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Workspace-relative, forward slashes, no leading slash. - /// - /// Field 3: `path` - #[serde(rename = "path", with = "::buffa::json_helpers::proto_string")] - pub path: ::buffa::alloc::string::String, - /// Field 4: `change_kind` - #[serde( - rename = "changeKind", - alias = "change_kind", - with = "::buffa::json_helpers::proto_enum" - )] - pub change_kind: ::buffa::EnumValue, - /// Set only for a rename. - /// - /// Field 5: `previous_path` - #[serde( - rename = "previousPath", - alias = "previous_path", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub previous_path: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for FileChangeItem { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("FileChangeItem") - .field("turn_id", &self.turn_id) - .field("tool_call_id", &self.tool_call_id) - .field("path", &self.path) - .field("change_kind", &self.change_kind) - .field("previous_path", &self.previous_path) - .finish() - } -} -impl FileChangeItem { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.FileChangeItem"; -} -impl FileChangeItem { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::previous_path`] to `Some(value)`, consuming and returning `self`. - pub fn with_previous_path( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.previous_path = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(FileChangeItem); -impl ::buffa::MessageName for FileChangeItem { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "FileChangeItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.FileChangeItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.FileChangeItem"; -} -impl ::buffa::Message for FileChangeItem { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.path) as u64; - { - let val = self.change_kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.previous_path { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.turn_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.path, buf); - ::buffa::types::put_int32_field(4u32, self.change_kind.to_i32(), buf); - if let Some(ref v) = self.previous_path { - ::buffa::types::put_string_field(5u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.path, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.change_kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .previous_path - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.turn_id.clear(); - self.tool_call_id.clear(); - self.path.clear(); - self.change_kind = ::buffa::EnumValue::from(0); - self.previous_path = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for FileChangeItem { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __FILE_CHANGE_ITEM_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.FileChangeItem", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// SystemNoticeItem is a system-originated notice surfaced in the transcript. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SystemNoticeItem { - /// Field 1: `level` - #[serde(rename = "level", with = "::buffa::json_helpers::proto_enum")] - pub level: ::buffa::EnumValue, - /// Field 2: `text` - #[serde(rename = "text", with = "::buffa::json_helpers::proto_string")] - pub text: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for SystemNoticeItem { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SystemNoticeItem") - .field("level", &self.level) - .field("text", &self.text) - .finish() - } -} -impl SystemNoticeItem { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SystemNoticeItem"; -} -::buffa::impl_default_instance!(SystemNoticeItem); -impl ::buffa::MessageName for SystemNoticeItem { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "SystemNoticeItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.SystemNoticeItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SystemNoticeItem"; -} -impl ::buffa::Message for SystemNoticeItem { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.level.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.level.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.text, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.level = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.text, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.level = ::buffa::EnumValue::from(0); - self.text.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SystemNoticeItem { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SYSTEM_NOTICE_ITEM_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SystemNoticeItem", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// CompactionItem marks where a range of history was replaced by a summary. -/// -/// It is surfaced rather than hidden so a reader can see that the transcript it -/// is looking at is not the whole transcript. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CompactionItem { - /// Inclusive ordinal range this summary stands in for. - /// - /// Field 1: `covers_from` - #[serde( - rename = "coversFrom", - alias = "covers_from", - with = "::buffa::json_helpers::uint64" - )] - pub covers_from: u64, - /// Field 2: `covers_through` - #[serde( - rename = "coversThrough", - alias = "covers_through", - with = "::buffa::json_helpers::uint64" - )] - pub covers_through: u64, - /// Field 3: `summary_text` - #[serde( - rename = "summaryText", - alias = "summary_text", - with = "::buffa::json_helpers::proto_string" - )] - pub summary_text: ::buffa::alloc::string::String, - /// Field 4: `truncated` - #[serde(rename = "truncated", with = "::buffa::json_helpers::proto_bool")] - pub truncated: bool, -} -impl ::core::fmt::Debug for CompactionItem { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CompactionItem") - .field("covers_from", &self.covers_from) - .field("covers_through", &self.covers_through) - .field("summary_text", &self.summary_text) - .field("truncated", &self.truncated) - .finish() - } -} -impl CompactionItem { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CompactionItem"; -} -::buffa::impl_default_instance!(CompactionItem); -impl ::buffa::MessageName for CompactionItem { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "CompactionItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.CompactionItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CompactionItem"; -} -impl ::buffa::Message for CompactionItem { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.covers_from) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.covers_through) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary_text) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.covers_from, buf); - ::buffa::types::put_uint64_field(2u32, self.covers_through, buf); - ::buffa::types::put_string_field(3u32, &self.summary_text, buf); - ::buffa::types::put_bool_field(4u32, self.truncated, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.covers_from = ::buffa::types::decode_uint64(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.covers_through = ::buffa::types::decode_uint64(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.summary_text, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.truncated = ::buffa::types::decode_bool(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.covers_from = 0u64; - self.covers_through = 0u64; - self.summary_text.clear(); - self.truncated = false; - } -} -impl ::buffa::json_helpers::ProtoElemJson for CompactionItem { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COMPACTION_ITEM_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CompactionItem", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.latest_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.latest_session.__view.rs deleted file mode 100644 index de18b17de..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.latest_session.__view.rs +++ /dev/null @@ -1,1483 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/latest_session.proto - -/// GetLatestSessionRequest asks for the one newest session matching a selector. -/// -/// A resume command wants a single session, and getting it by listing a page and -/// taking the first row is wrong in a way that only shows up under load: the -/// list is ordered by recency but filtered afterwards, so a workspace whose most -/// recent forty sessions are all ineligible returns a page with no answer in it -/// and no indication that a longer page would have found one. Selection has to -/// happen in the index, not in the caller. -/// -/// This is also the query where staleness costs the most. A stale list is a list -/// with an old row in it, which a human reading a picker can notice. A stale -/// latest-pointer is the one answer the caller acts on, so the whole error lands -/// on the session that gets opened. -#[derive(Clone, Debug, Default)] -pub struct GetLatestSessionRequestView<'a> { - /// Field 1: `workspace_id` - pub workspace_id: &'a str, - /// Field 2: `accepted_contract` - pub accepted_contract: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'a>, - >, - /// Which session counts as the answer. - /// - /// Field 3: `selector` - pub selector: ::buffa::EnumValue, - /// Which timestamp "latest" is measured by. - /// - /// Field 4: `recency` - pub recency: ::buffa::EnumValue, - /// Freshness the caller requires. Unset is an eventual read. - /// - /// Field 5: `consistency` - pub consistency: ::buffa::MessageFieldView< - super::super::__buffa::view::ReadConsistencyView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> GetLatestSessionRequestView<'a> { - /**Whether required field `workspace_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_workspace_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `accepted_contract` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_accepted_contract(&self) -> bool { - self.accepted_contract.is_set() - } - /**Whether required field `selector` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_selector(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `recency` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_recency(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for GetLatestSessionRequestView<'a> { - type Owned = super::super::GetLatestSessionRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.workspace_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.accepted_contract.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.accepted_contract = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.selector = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.recency = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.consistency.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.consistency = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::GetLatestSessionRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::GetLatestSessionRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::GetLatestSessionRequest { - workspace_id: self.workspace_id.to_string(), - accepted_contract: match self.accepted_contract.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractVersion, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - selector: self.selector, - recency: self.recency, - consistency: match self.consistency.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ReadConsistency, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for GetLatestSessionRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.workspace_id) as u64; - if self.accepted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.accepted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.selector.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - { - let val = self.recency.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.consistency.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.consistency.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.workspace_id, buf); - if self.accepted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.accepted_contract.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.selector.to_i32(), buf); - ::buffa::types::put_int32_field(4u32, self.recency.to_i32(), buf); - if self.consistency.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.consistency.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for GetLatestSessionRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("workspaceId", self.workspace_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.accepted_contract.as_option() - { - __map.serialize_entry("acceptedContract", __v)?; - } - } - { - __map.serialize_entry("selector", &self.selector)?; - } - { - __map.serialize_entry("recency", &self.recency)?; - } - { - if let ::core::option::Option::Some(__v) = self.consistency.as_option() { - __map.serialize_entry("consistency", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for GetLatestSessionRequestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "GetLatestSessionRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.GetLatestSessionRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetLatestSessionRequest"; -} -::buffa::impl_default_view_instance!(GetLatestSessionRequestView); -::buffa::impl_view_reborrow!(GetLatestSessionRequestView); -/** Self-contained, `'static` owned view of a `GetLatestSessionRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`GetLatestSessionRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetLatestSessionRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct GetLatestSessionRequestOwnedView( - ::buffa::OwnedView>, -); -impl GetLatestSessionRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetLatestSessionRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetLatestSessionRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::GetLatestSessionRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetLatestSessionRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`GetLatestSessionRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &GetLatestSessionRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::GetLatestSessionRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `workspace_id` - #[must_use] - pub fn workspace_id(&self) -> &'_ str { - self.0.reborrow().workspace_id - } - /// Field 2: `accepted_contract` - #[must_use] - pub fn accepted_contract( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'_>, - > { - &self.0.reborrow().accepted_contract - } - /// Which session counts as the answer. - /// - /// Field 3: `selector` - #[must_use] - pub fn selector(&self) -> ::buffa::EnumValue { - self.0.reborrow().selector - } - /// Which timestamp "latest" is measured by. - /// - /// Field 4: `recency` - #[must_use] - pub fn recency(&self) -> ::buffa::EnumValue { - self.0.reborrow().recency - } - /// Freshness the caller requires. Unset is an eventual read. - /// - /// Field 5: `consistency` - #[must_use] - pub fn consistency( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ReadConsistencyView<'_>, - > { - &self.0.reborrow().consistency - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for GetLatestSessionRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - GetLatestSessionRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: GetLatestSessionRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for GetLatestSessionRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::GetLatestSessionRequest { - type View<'a> = GetLatestSessionRequestView<'a>; - type ViewHandle = GetLatestSessionRequestOwnedView; -} -impl ::serde::Serialize for GetLatestSessionRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// GetLatestSessionResponse is the single newest matching session, or nothing. -#[derive(Clone, Debug, Default)] -pub struct GetLatestSessionResponseView<'a> { - /// Field 1: `contract` - pub contract: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractNegotiationView<'a>, - >, - /// Unset when nothing in the workspace matched. Absence is the answer, not an - /// error: a workspace with no resumable session is a normal state, and - /// reporting it as a failure would make a first-run workspace look broken. - /// - /// Field 2: `session` - pub session: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionSummaryView<'a>, - >, - /// What the selector rejected on the way to that answer. Always present, - /// including when a session was found. - /// - /// This is what makes an empty answer diagnosable. "No resumable session" and - /// "eleven sessions, all still running" are the same absence to a caller that - /// only sees the empty field, and they call for opposite next moves: create a - /// new session, or attach to a running one. - /// - /// Field 3: `excluded` - pub excluded: ::buffa::MessageFieldView< - super::super::__buffa::view::ExclusionCountsView<'a>, - >, - /// Field 4: `freshness` - pub freshness: ::buffa::MessageFieldView< - super::super::__buffa::view::ProjectionFreshnessView<'a>, - >, -} -impl<'a> GetLatestSessionResponseView<'a> { - /**Whether required field `contract` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_contract(&self) -> bool { - self.contract.is_set() - } - /**Whether required field `excluded` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_excluded(&self) -> bool { - self.excluded.is_set() - } - /**Whether required field `freshness` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_freshness(&self) -> bool { - self.freshness.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for GetLatestSessionResponseView<'a> { - type Owned = super::super::GetLatestSessionResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.contract.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.contract = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.session.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.session = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.excluded.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.excluded = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.freshness.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.freshness = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::GetLatestSessionResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::GetLatestSessionResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::GetLatestSessionResponse { - contract: match self.contract.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractNegotiation, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - session: match self.session.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionSummary, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - excluded: match self.excluded.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ExclusionCounts, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - freshness: match self.freshness.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ProjectionFreshness, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for GetLatestSessionResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.session.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.session.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.excluded.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.excluded.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.freshness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.freshness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.contract.write_to(__cache, buf); - } - if self.session.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.session.write_to(__cache, buf); - } - if self.excluded.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.excluded.write_to(__cache, buf); - } - if self.freshness.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.freshness.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for GetLatestSessionResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.contract.as_option() { - __map.serialize_entry("contract", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.session.as_option() { - __map.serialize_entry("session", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.excluded.as_option() { - __map.serialize_entry("excluded", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.freshness.as_option() { - __map.serialize_entry("freshness", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for GetLatestSessionResponseView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "GetLatestSessionResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.GetLatestSessionResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetLatestSessionResponse"; -} -::buffa::impl_default_view_instance!(GetLatestSessionResponseView); -::buffa::impl_view_reborrow!(GetLatestSessionResponseView); -/** Self-contained, `'static` owned view of a `GetLatestSessionResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`GetLatestSessionResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetLatestSessionResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct GetLatestSessionResponseOwnedView( - ::buffa::OwnedView>, -); -impl GetLatestSessionResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetLatestSessionResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetLatestSessionResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::GetLatestSessionResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - GetLatestSessionResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`GetLatestSessionResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &GetLatestSessionResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::GetLatestSessionResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `contract` - #[must_use] - pub fn contract( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractNegotiationView<'_>, - > { - &self.0.reborrow().contract - } - /// Unset when nothing in the workspace matched. Absence is the answer, not an - /// error: a workspace with no resumable session is a normal state, and - /// reporting it as a failure would make a first-run workspace look broken. - /// - /// Field 2: `session` - #[must_use] - pub fn session( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionSummaryView<'_>, - > { - &self.0.reborrow().session - } - /// What the selector rejected on the way to that answer. Always present, - /// including when a session was found. - /// - /// This is what makes an empty answer diagnosable. "No resumable session" and - /// "eleven sessions, all still running" are the same absence to a caller that - /// only sees the empty field, and they call for opposite next moves: create a - /// new session, or attach to a running one. - /// - /// Field 3: `excluded` - #[must_use] - pub fn excluded( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ExclusionCountsView<'_>, - > { - &self.0.reborrow().excluded - } - /// Field 4: `freshness` - #[must_use] - pub fn freshness( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ProjectionFreshnessView<'_>, - > { - &self.0.reborrow().freshness - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for GetLatestSessionResponseOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - GetLatestSessionResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: GetLatestSessionResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for GetLatestSessionResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::GetLatestSessionResponse { - type View<'a> = GetLatestSessionResponseView<'a>; - type ViewHandle = GetLatestSessionResponseOwnedView; -} -impl ::serde::Serialize for GetLatestSessionResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ExclusionCounts is how many candidate sessions each rule removed. -/// -/// A session removed by more than one rule is counted once, under the first rule -/// that removed it, in the order the fields are declared. Counting it under -/// every matching rule would produce totals that exceed the workspace, and the -/// number a caller wants is how many sessions there were, not how many -/// judgements were made. -#[derive(Clone, Debug, Default)] -pub struct ExclusionCountsView<'a> { - /// Sessions in the workspace the caller may see. The denominator; zero here - /// means an empty workspace rather than an over-strict selector. - /// - /// Field 1: `considered` - pub considered: u32, - /// Field 2: `archived` - pub archived: u32, - /// Excluded because something is currently driving them. - /// - /// Field 3: `active` - pub active: u32, - /// Excluded because their effective history contains no user-authored turn. - /// - /// Emptiness is defined on authored content, not on `effective_length`. A - /// session can carry configuration and lifecycle records and still be one - /// nobody ever said anything in, and a rewind back to the start empties a - /// session that was not empty an hour ago. Resuming one of those puts a person - /// back into a blank window they have no memory of leaving. - /// - /// Field 4: `empty` - pub empty: u32, - /// Excluded by TERMINAL_REASON_HIDDEN. - /// - /// Field 5: `hidden` - pub hidden: u32, - /// Excluded because the projection could not render the row. Non-zero means - /// the answer may be wrong rather than merely empty: the session that should - /// have won might be one of these. - /// - /// Field 6: `unrenderable` - pub unrenderable: u32, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, - #[doc(hidden)] - pub __buffa_phantom: ::core::marker::PhantomData<&'a ()>, -} -impl<'a> ExclusionCountsView<'a> { - /**Whether required field `considered` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_considered(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `archived` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_archived(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `active` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_active(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `empty` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_empty(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `hidden` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_hidden(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } - /**Whether required field `unrenderable` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_unrenderable(&self) -> bool { - self.__buffa_required_seen_0 & 32u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ExclusionCountsView<'a> { - type Owned = super::super::ExclusionCounts; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.considered = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.archived = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.active = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.empty = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.hidden = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.unrenderable = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 32u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ExclusionCounts { - considered: self.considered, - archived: self.archived, - active: self.active, - empty: self.empty, - hidden: self.hidden, - unrenderable: self.unrenderable, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ExclusionCountsView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.considered) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.archived) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.active) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.empty) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.hidden) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.unrenderable) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.considered, buf); - ::buffa::types::put_uint32_field(2u32, self.archived, buf); - ::buffa::types::put_uint32_field(3u32, self.active, buf); - ::buffa::types::put_uint32_field(4u32, self.empty, buf); - ::buffa::types::put_uint32_field(5u32, self.hidden, buf); - ::buffa::types::put_uint32_field(6u32, self.unrenderable, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ExclusionCountsView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "considered", - &::buffa::json_helpers::ProtoJson(&self.considered), - )?; - } - { - __map - .serialize_entry( - "archived", - &::buffa::json_helpers::ProtoJson(&self.archived), - )?; - } - { - __map - .serialize_entry( - "active", - &::buffa::json_helpers::ProtoJson(&self.active), - )?; - } - { - __map - .serialize_entry( - "empty", - &::buffa::json_helpers::ProtoJson(&self.empty), - )?; - } - { - __map - .serialize_entry( - "hidden", - &::buffa::json_helpers::ProtoJson(&self.hidden), - )?; - } - { - __map - .serialize_entry( - "unrenderable", - &::buffa::json_helpers::ProtoJson(&self.unrenderable), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ExclusionCountsView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ExclusionCounts"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ExclusionCounts"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ExclusionCounts"; -} -::buffa::impl_default_view_instance!(ExclusionCountsView); -::buffa::impl_view_reborrow!(ExclusionCountsView); -/** Self-contained, `'static` owned view of a `ExclusionCounts` message. - - Wraps [`::buffa::OwnedView`]`<`[`ExclusionCountsView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ExclusionCountsView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ExclusionCountsOwnedView(::buffa::OwnedView>); -impl ExclusionCountsOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExclusionCountsOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExclusionCountsOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ExclusionCounts, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExclusionCountsOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ExclusionCountsView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ExclusionCountsView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ExclusionCounts { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Sessions in the workspace the caller may see. The denominator; zero here - /// means an empty workspace rather than an over-strict selector. - /// - /// Field 1: `considered` - #[must_use] - pub fn considered(&self) -> u32 { - self.0.reborrow().considered - } - /// Field 2: `archived` - #[must_use] - pub fn archived(&self) -> u32 { - self.0.reborrow().archived - } - /// Excluded because something is currently driving them. - /// - /// Field 3: `active` - #[must_use] - pub fn active(&self) -> u32 { - self.0.reborrow().active - } - /// Excluded because their effective history contains no user-authored turn. - /// - /// Emptiness is defined on authored content, not on `effective_length`. A - /// session can carry configuration and lifecycle records and still be one - /// nobody ever said anything in, and a rewind back to the start empties a - /// session that was not empty an hour ago. Resuming one of those puts a person - /// back into a blank window they have no memory of leaving. - /// - /// Field 4: `empty` - #[must_use] - pub fn empty(&self) -> u32 { - self.0.reborrow().empty - } - /// Excluded by TERMINAL_REASON_HIDDEN. - /// - /// Field 5: `hidden` - #[must_use] - pub fn hidden(&self) -> u32 { - self.0.reborrow().hidden - } - /// Excluded because the projection could not render the row. Non-zero means - /// the answer may be wrong rather than merely empty: the session that should - /// have won might be one of these. - /// - /// Field 6: `unrenderable` - #[must_use] - pub fn unrenderable(&self) -> u32 { - self.0.reborrow().unrenderable - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ExclusionCountsOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ExclusionCountsOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ExclusionCountsOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ExclusionCountsOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ExclusionCounts { - type View<'a> = ExclusionCountsView<'a>; - type ViewHandle = ExclusionCountsOwnedView; -} -impl ::serde::Serialize for ExclusionCountsOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.latest_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.latest_session.rs deleted file mode 100644 index aab2d44c0..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.latest_session.rs +++ /dev/null @@ -1,1023 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/latest_session.proto - -/// SessionSelector is which session in a workspace counts as the answer. -/// -/// An enum rather than a set of filter booleans. Booleans let a caller ask for a -/// session that is both currently active and not currently active, and the -/// server then has to decide what an impossible request means. Every value here -/// is a question someone actually asks. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum SessionSelector { - /// No selector given. Refused with QUERY_ERROR_CODE_INVALID_ARGUMENT. - /// - /// The zero value does not default to a selector, because the two callers of - /// this query want different ones and both are plausible defaults: a picker - /// wants the most recent session of any kind, and a resume wants a resumable - /// one. Guessing wrong hands a resume command a session that is already - /// running somewhere else. - SESSION_SELECTOR_UNSPECIFIED = 0i32, - /// The newest non-archived session, whatever state it is in. - SESSION_SELECTOR_MOST_RECENT = 1i32, - /// The newest session a resume can attach to: not archived, not currently - /// active, not empty, and not hidden. - /// - /// Terminal is not an exclusion. A closed session is the ordinary thing to - /// resume; that is what resuming means. What is excluded is a session already - /// being driven from somewhere else, which resuming would turn into two - /// writers on one stream. - SESSION_SELECTOR_RESUMABLE = 2i32, - /// The newest session currently being driven. Answers "reattach me to what I - /// was doing" without a resume's exclusions. - SESSION_SELECTOR_ACTIVE = 3i32, -} -impl SessionSelector { - ///Idiomatic alias for [`Self::SESSION_SELECTOR_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::SESSION_SELECTOR_UNSPECIFIED; - ///Idiomatic alias for [`Self::SESSION_SELECTOR_MOST_RECENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const MostRecent: Self = Self::SESSION_SELECTOR_MOST_RECENT; - ///Idiomatic alias for [`Self::SESSION_SELECTOR_RESUMABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Resumable: Self = Self::SESSION_SELECTOR_RESUMABLE; - ///Idiomatic alias for [`Self::SESSION_SELECTOR_ACTIVE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Active: Self = Self::SESSION_SELECTOR_ACTIVE; -} -impl ::core::default::Default for SessionSelector { - fn default() -> Self { - Self::SESSION_SELECTOR_UNSPECIFIED - } -} -impl ::serde::Serialize for SessionSelector { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for SessionSelector { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = SessionSelector; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(SessionSelector) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionSelector { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for SessionSelector { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::SESSION_SELECTOR_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::SESSION_SELECTOR_MOST_RECENT), - 2i32 => ::core::option::Option::Some(Self::SESSION_SELECTOR_RESUMABLE), - 3i32 => ::core::option::Option::Some(Self::SESSION_SELECTOR_ACTIVE), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::SESSION_SELECTOR_UNSPECIFIED => "SESSION_SELECTOR_UNSPECIFIED", - Self::SESSION_SELECTOR_MOST_RECENT => "SESSION_SELECTOR_MOST_RECENT", - Self::SESSION_SELECTOR_RESUMABLE => "SESSION_SELECTOR_RESUMABLE", - Self::SESSION_SELECTOR_ACTIVE => "SESSION_SELECTOR_ACTIVE", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "SESSION_SELECTOR_UNSPECIFIED" => { - ::core::option::Option::Some(Self::SESSION_SELECTOR_UNSPECIFIED) - } - "SESSION_SELECTOR_MOST_RECENT" => { - ::core::option::Option::Some(Self::SESSION_SELECTOR_MOST_RECENT) - } - "SESSION_SELECTOR_RESUMABLE" => { - ::core::option::Option::Some(Self::SESSION_SELECTOR_RESUMABLE) - } - "SESSION_SELECTOR_ACTIVE" => { - ::core::option::Option::Some(Self::SESSION_SELECTOR_ACTIVE) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::SESSION_SELECTOR_UNSPECIFIED, - Self::SESSION_SELECTOR_MOST_RECENT, - Self::SESSION_SELECTOR_RESUMABLE, - Self::SESSION_SELECTOR_ACTIVE, - ] - } -} -/// RecencyBasis is which timestamp "latest" is measured by. -/// -/// The two orderings disagree often enough to matter: a long session started -/// yesterday and worked on this morning is the newest by activity and among the -/// oldest by creation. Every timestamp behind this is a recorded external -/// occurrence and not the moment an envelope was appended (D10), so a projection -/// that catches up late does not reorder the answer. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum RecencyBasis { - /// Unset. Treated as LAST_ACTIVITY, which is what a resume means by "latest". - RECENCY_BASIS_UNSPECIFIED = 0i32, - /// Most recent effective history activity. - RECENCY_BASIS_LAST_ACTIVITY = 1i32, - /// Session creation. - RECENCY_BASIS_CREATED = 2i32, -} -impl RecencyBasis { - ///Idiomatic alias for [`Self::RECENCY_BASIS_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::RECENCY_BASIS_UNSPECIFIED; - ///Idiomatic alias for [`Self::RECENCY_BASIS_LAST_ACTIVITY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const LastActivity: Self = Self::RECENCY_BASIS_LAST_ACTIVITY; - ///Idiomatic alias for [`Self::RECENCY_BASIS_CREATED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Created: Self = Self::RECENCY_BASIS_CREATED; -} -impl ::core::default::Default for RecencyBasis { - fn default() -> Self { - Self::RECENCY_BASIS_UNSPECIFIED - } -} -impl ::serde::Serialize for RecencyBasis { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for RecencyBasis { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = RecencyBasis; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(RecencyBasis)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for RecencyBasis { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for RecencyBasis { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::RECENCY_BASIS_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::RECENCY_BASIS_LAST_ACTIVITY), - 2i32 => ::core::option::Option::Some(Self::RECENCY_BASIS_CREATED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::RECENCY_BASIS_UNSPECIFIED => "RECENCY_BASIS_UNSPECIFIED", - Self::RECENCY_BASIS_LAST_ACTIVITY => "RECENCY_BASIS_LAST_ACTIVITY", - Self::RECENCY_BASIS_CREATED => "RECENCY_BASIS_CREATED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "RECENCY_BASIS_UNSPECIFIED" => { - ::core::option::Option::Some(Self::RECENCY_BASIS_UNSPECIFIED) - } - "RECENCY_BASIS_LAST_ACTIVITY" => { - ::core::option::Option::Some(Self::RECENCY_BASIS_LAST_ACTIVITY) - } - "RECENCY_BASIS_CREATED" => { - ::core::option::Option::Some(Self::RECENCY_BASIS_CREATED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::RECENCY_BASIS_UNSPECIFIED, - Self::RECENCY_BASIS_LAST_ACTIVITY, - Self::RECENCY_BASIS_CREATED, - ] - } -} -/// GetLatestSessionRequest asks for the one newest session matching a selector. -/// -/// A resume command wants a single session, and getting it by listing a page and -/// taking the first row is wrong in a way that only shows up under load: the -/// list is ordered by recency but filtered afterwards, so a workspace whose most -/// recent forty sessions are all ineligible returns a page with no answer in it -/// and no indication that a longer page would have found one. Selection has to -/// happen in the index, not in the caller. -/// -/// This is also the query where staleness costs the most. A stale list is a list -/// with an old row in it, which a human reading a picker can notice. A stale -/// latest-pointer is the one answer the caller acts on, so the whole error lands -/// on the session that gets opened. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct GetLatestSessionRequest { - /// Field 1: `workspace_id` - #[serde( - rename = "workspaceId", - alias = "workspace_id", - with = "::buffa::json_helpers::proto_string" - )] - pub workspace_id: ::buffa::alloc::string::String, - /// Field 2: `accepted_contract` - #[serde(rename = "acceptedContract", alias = "accepted_contract")] - pub accepted_contract: ::buffa::MessageField< - ContractVersion, - ::buffa::Inline, - >, - /// Which session counts as the answer. - /// - /// Field 3: `selector` - #[serde(rename = "selector", with = "::buffa::json_helpers::proto_enum")] - pub selector: ::buffa::EnumValue, - /// Which timestamp "latest" is measured by. - /// - /// Field 4: `recency` - #[serde(rename = "recency", with = "::buffa::json_helpers::proto_enum")] - pub recency: ::buffa::EnumValue, - /// Freshness the caller requires. Unset is an eventual read. - /// - /// Field 5: `consistency` - #[serde( - rename = "consistency", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub consistency: ::buffa::MessageField< - ReadConsistency, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for GetLatestSessionRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("GetLatestSessionRequest") - .field("workspace_id", &self.workspace_id) - .field("accepted_contract", &self.accepted_contract) - .field("selector", &self.selector) - .field("recency", &self.recency) - .field("consistency", &self.consistency) - .finish() - } -} -impl GetLatestSessionRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetLatestSessionRequest"; -} -::buffa::impl_default_instance!(GetLatestSessionRequest); -impl ::buffa::MessageName for GetLatestSessionRequest { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "GetLatestSessionRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.GetLatestSessionRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetLatestSessionRequest"; -} -impl ::buffa::Message for GetLatestSessionRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.workspace_id) as u64; - if self.accepted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.accepted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.selector.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - { - let val = self.recency.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.consistency.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.consistency.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.workspace_id, buf); - if self.accepted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.accepted_contract.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.selector.to_i32(), buf); - ::buffa::types::put_int32_field(4u32, self.recency.to_i32(), buf); - if self.consistency.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.consistency.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.workspace_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.accepted_contract.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.selector = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.recency = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.consistency.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.workspace_id.clear(); - self.accepted_contract = ::buffa::MessageField::none(); - self.selector = ::buffa::EnumValue::from(0); - self.recency = ::buffa::EnumValue::from(0); - self.consistency = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for GetLatestSessionRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __GET_LATEST_SESSION_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetLatestSessionRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// GetLatestSessionResponse is the single newest matching session, or nothing. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct GetLatestSessionResponse { - /// Field 1: `contract` - #[serde(rename = "contract")] - pub contract: ::buffa::MessageField< - ContractNegotiation, - ::buffa::Inline, - >, - /// Unset when nothing in the workspace matched. Absence is the answer, not an - /// error: a workspace with no resumable session is a normal state, and - /// reporting it as a failure would make a first-run workspace look broken. - /// - /// Field 2: `session` - #[serde( - rename = "session", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub session: ::buffa::MessageField>, - /// What the selector rejected on the way to that answer. Always present, - /// including when a session was found. - /// - /// This is what makes an empty answer diagnosable. "No resumable session" and - /// "eleven sessions, all still running" are the same absence to a caller that - /// only sees the empty field, and they call for opposite next moves: create a - /// new session, or attach to a running one. - /// - /// Field 3: `excluded` - #[serde(rename = "excluded")] - pub excluded: ::buffa::MessageField< - ExclusionCounts, - ::buffa::Inline, - >, - /// Field 4: `freshness` - #[serde(rename = "freshness")] - pub freshness: ::buffa::MessageField< - ProjectionFreshness, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for GetLatestSessionResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("GetLatestSessionResponse") - .field("contract", &self.contract) - .field("session", &self.session) - .field("excluded", &self.excluded) - .field("freshness", &self.freshness) - .finish() - } -} -impl GetLatestSessionResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetLatestSessionResponse"; -} -::buffa::impl_default_instance!(GetLatestSessionResponse); -impl ::buffa::MessageName for GetLatestSessionResponse { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "GetLatestSessionResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.GetLatestSessionResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetLatestSessionResponse"; -} -impl ::buffa::Message for GetLatestSessionResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.session.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.session.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.excluded.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.excluded.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.freshness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.freshness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.contract.write_to(__cache, buf); - } - if self.session.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.session.write_to(__cache, buf); - } - if self.excluded.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.excluded.write_to(__cache, buf); - } - if self.freshness.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.freshness.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.contract.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.session.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.excluded.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.freshness.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.contract = ::buffa::MessageField::none(); - self.session = ::buffa::MessageField::none(); - self.excluded = ::buffa::MessageField::none(); - self.freshness = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for GetLatestSessionResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __GET_LATEST_SESSION_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.GetLatestSessionResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ExclusionCounts is how many candidate sessions each rule removed. -/// -/// A session removed by more than one rule is counted once, under the first rule -/// that removed it, in the order the fields are declared. Counting it under -/// every matching rule would produce totals that exceed the workspace, and the -/// number a caller wants is how many sessions there were, not how many -/// judgements were made. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ExclusionCounts { - /// Sessions in the workspace the caller may see. The denominator; zero here - /// means an empty workspace rather than an over-strict selector. - /// - /// Field 1: `considered` - #[serde(rename = "considered", with = "::buffa::json_helpers::uint32")] - pub considered: u32, - /// Field 2: `archived` - #[serde(rename = "archived", with = "::buffa::json_helpers::uint32")] - pub archived: u32, - /// Excluded because something is currently driving them. - /// - /// Field 3: `active` - #[serde(rename = "active", with = "::buffa::json_helpers::uint32")] - pub active: u32, - /// Excluded because their effective history contains no user-authored turn. - /// - /// Emptiness is defined on authored content, not on `effective_length`. A - /// session can carry configuration and lifecycle records and still be one - /// nobody ever said anything in, and a rewind back to the start empties a - /// session that was not empty an hour ago. Resuming one of those puts a person - /// back into a blank window they have no memory of leaving. - /// - /// Field 4: `empty` - #[serde(rename = "empty", with = "::buffa::json_helpers::uint32")] - pub empty: u32, - /// Excluded by TERMINAL_REASON_HIDDEN. - /// - /// Field 5: `hidden` - #[serde(rename = "hidden", with = "::buffa::json_helpers::uint32")] - pub hidden: u32, - /// Excluded because the projection could not render the row. Non-zero means - /// the answer may be wrong rather than merely empty: the session that should - /// have won might be one of these. - /// - /// Field 6: `unrenderable` - #[serde(rename = "unrenderable", with = "::buffa::json_helpers::uint32")] - pub unrenderable: u32, -} -impl ::core::fmt::Debug for ExclusionCounts { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ExclusionCounts") - .field("considered", &self.considered) - .field("archived", &self.archived) - .field("active", &self.active) - .field("empty", &self.empty) - .field("hidden", &self.hidden) - .field("unrenderable", &self.unrenderable) - .finish() - } -} -impl ExclusionCounts { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ExclusionCounts"; -} -::buffa::impl_default_instance!(ExclusionCounts); -impl ::buffa::MessageName for ExclusionCounts { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ExclusionCounts"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ExclusionCounts"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ExclusionCounts"; -} -impl ::buffa::Message for ExclusionCounts { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.considered) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.archived) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.active) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.empty) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.hidden) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.unrenderable) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.considered, buf); - ::buffa::types::put_uint32_field(2u32, self.archived, buf); - ::buffa::types::put_uint32_field(3u32, self.active, buf); - ::buffa::types::put_uint32_field(4u32, self.empty, buf); - ::buffa::types::put_uint32_field(5u32, self.hidden, buf); - ::buffa::types::put_uint32_field(6u32, self.unrenderable, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.considered = ::buffa::types::decode_uint32(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.archived = ::buffa::types::decode_uint32(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.active = ::buffa::types::decode_uint32(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.empty = ::buffa::types::decode_uint32(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.hidden = ::buffa::types::decode_uint32(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.unrenderable = ::buffa::types::decode_uint32(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.considered = 0u32; - self.archived = 0u32; - self.active = 0u32; - self.empty = 0u32; - self.hidden = 0u32; - self.unrenderable = 0u32; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ExclusionCounts { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __EXCLUSION_COUNTS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ExclusionCounts", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.list_sessions.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.list_sessions.__view.rs deleted file mode 100644 index 351807bd8..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.list_sessions.__view.rs +++ /dev/null @@ -1,1128 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/list_sessions.proto - -/// ListSessionsRequest enumerates sessions in a scope, newest first. -#[derive(Clone, Debug, Default)] -pub struct ListSessionsRequestView<'a> { - /// Field 1: `accepted_contract` - pub accepted_contract: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'a>, - >, - /// Field 2: `scope` - pub scope: ::buffa::EnumValue, - /// Required for SCOPE_WORKSPACE, ignored otherwise. - /// - /// Field 3: `workspace_id` - pub workspace_id: ::core::option::Option<&'a str>, - /// Field 4: `archived` - pub archived: ::buffa::EnumValue, - /// Maximum rows to return. The server may return fewer. A value above the - /// configured admission limit is refused with - /// QUERY_ERROR_CODE_RESOURCE_EXHAUSTED rather than silently clamped, so a - /// caller is never left believing it asked for more than it received. - /// - /// Field 5: `page_size` - pub page_size: u32, - /// Opaque continuation from a prior response, a serialized CursorEnvelope. - /// Unset starts a new scan. The caller must treat this as bytes and never - /// construct, parse, or edit one. - /// - /// A continuation still carries the scope, workspace, and archived filter, and - /// they must match what the cursor was minted with. The server refuses a - /// disagreement rather than re-scoping the scan in flight. - /// - /// Field 6: `page_token` - pub page_token: ::core::option::Option<&'a [u8]>, - /// Freshness the caller requires. Honored when the scan opens and ignored on - /// a continuation, because a continuation is served from the pinned watermark - /// and waiting for anything newer could not change what it returns. - /// - /// A continuation whose requirement is stricter than the one the scan was - /// opened with is QUERY_ERROR_CODE_INVALID_ARGUMENT. Silently ignoring it - /// would let a caller believe a later page reflects a write that it cannot. - /// - /// Field 7: `consistency` - pub consistency: ::buffa::MessageFieldView< - super::super::__buffa::view::ReadConsistencyView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ListSessionsRequestView<'a> { - /**Whether required field `accepted_contract` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_accepted_contract(&self) -> bool { - self.accepted_contract.is_set() - } - /**Whether required field `scope` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_scope(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `archived` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_archived(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `page_size` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_page_size(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ListSessionsRequestView<'a> { - type Owned = super::super::ListSessionsRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.accepted_contract.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.accepted_contract = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.scope = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.workspace_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.archived = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.page_size = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.page_token = Some(::buffa::types::borrow_bytes(&mut cur)?); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.consistency.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.consistency = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ListSessionsRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ListSessionsRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ListSessionsRequest { - accepted_contract: match self.accepted_contract.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractVersion, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - scope: self.scope, - workspace_id: self.workspace_id.map(|s| s.to_string()), - archived: self.archived, - page_size: self.page_size, - page_token: self.page_token.map(|b| (b).to_vec()), - consistency: match self.consistency.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ReadConsistency, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ListSessionsRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.accepted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.accepted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.scope.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.workspace_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - { - let val = self.archived.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.page_size) as u64; - if let Some(ref v) = self.page_token { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - if self.consistency.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.consistency.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.accepted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.accepted_contract.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(2u32, self.scope.to_i32(), buf); - if let Some(ref v) = self.workspace_id { - ::buffa::types::put_string_field(3u32, v, buf); - } - ::buffa::types::put_int32_field(4u32, self.archived.to_i32(), buf); - ::buffa::types::put_uint32_field(5u32, self.page_size, buf); - if let Some(ref v) = self.page_token { - ::buffa::types::put_shared_bytes_field(6u32, v, buf); - } - if self.consistency.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.consistency.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ListSessionsRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.accepted_contract.as_option() - { - __map.serialize_entry("acceptedContract", __v)?; - } - } - { - __map.serialize_entry("scope", &self.scope)?; - } - if let ::core::option::Option::Some(__v) = self.workspace_id { - __map.serialize_entry("workspaceId", __v)?; - } - { - __map.serialize_entry("archived", &self.archived)?; - } - { - __map - .serialize_entry( - "pageSize", - &::buffa::json_helpers::ProtoJson(&self.page_size), - )?; - } - if let ::core::option::Option::Some(__v) = self.page_token { - __map.serialize_entry("pageToken", &::buffa::json_helpers::BytesJson(__v))?; - } - { - if let ::core::option::Option::Some(__v) = self.consistency.as_option() { - __map.serialize_entry("consistency", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ListSessionsRequestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ListSessionsRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ListSessionsRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ListSessionsRequest"; -} -::buffa::impl_default_view_instance!(ListSessionsRequestView); -::buffa::impl_view_reborrow!(ListSessionsRequestView); -/** Self-contained, `'static` owned view of a `ListSessionsRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`ListSessionsRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ListSessionsRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ListSessionsRequestOwnedView( - ::buffa::OwnedView>, -); -impl ListSessionsRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ListSessionsRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ListSessionsRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ListSessionsRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ListSessionsRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ListSessionsRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ListSessionsRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ListSessionsRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `accepted_contract` - #[must_use] - pub fn accepted_contract( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'_>, - > { - &self.0.reborrow().accepted_contract - } - /// Field 2: `scope` - #[must_use] - pub fn scope(&self) -> ::buffa::EnumValue { - self.0.reborrow().scope - } - /// Required for SCOPE_WORKSPACE, ignored otherwise. - /// - /// Field 3: `workspace_id` - #[must_use] - pub fn workspace_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().workspace_id - } - /// Field 4: `archived` - #[must_use] - pub fn archived(&self) -> ::buffa::EnumValue { - self.0.reborrow().archived - } - /// Maximum rows to return. The server may return fewer. A value above the - /// configured admission limit is refused with - /// QUERY_ERROR_CODE_RESOURCE_EXHAUSTED rather than silently clamped, so a - /// caller is never left believing it asked for more than it received. - /// - /// Field 5: `page_size` - #[must_use] - pub fn page_size(&self) -> u32 { - self.0.reborrow().page_size - } - /// Opaque continuation from a prior response, a serialized CursorEnvelope. - /// Unset starts a new scan. The caller must treat this as bytes and never - /// construct, parse, or edit one. - /// - /// A continuation still carries the scope, workspace, and archived filter, and - /// they must match what the cursor was minted with. The server refuses a - /// disagreement rather than re-scoping the scan in flight. - /// - /// Field 6: `page_token` - #[must_use] - pub fn page_token(&self) -> ::core::option::Option<&'_ [u8]> { - self.0.reborrow().page_token - } - /// Freshness the caller requires. Honored when the scan opens and ignored on - /// a continuation, because a continuation is served from the pinned watermark - /// and waiting for anything newer could not change what it returns. - /// - /// A continuation whose requirement is stricter than the one the scan was - /// opened with is QUERY_ERROR_CODE_INVALID_ARGUMENT. Silently ignoring it - /// would let a caller believe a later page reflects a write that it cannot. - /// - /// Field 7: `consistency` - #[must_use] - pub fn consistency( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ReadConsistencyView<'_>, - > { - &self.0.reborrow().consistency - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ListSessionsRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ListSessionsRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ListSessionsRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ListSessionsRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ListSessionsRequest { - type View<'a> = ListSessionsRequestView<'a>; - type ViewHandle = ListSessionsRequestOwnedView; -} -impl ::serde::Serialize for ListSessionsRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ListSessionsResponse is one page of session summaries. -#[derive(Clone, Debug, Default)] -pub struct ListSessionsResponseView<'a> { - /// Field 1: `contract` - pub contract: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractNegotiationView<'a>, - >, - /// Field 2: `sessions` - pub sessions: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::SessionSummaryView<'a>, - >, - /// Unset when this is the last page. Presence, not an empty `sessions` list, - /// is the end-of-scan signal: a page may legitimately be empty while more - /// pages remain. - /// - /// Field 3: `next_page_token` - pub next_page_token: ::core::option::Option<&'a [u8]>, - /// Rows the server could not decode or render and therefore skipped. A - /// non-zero count means this page is incomplete, and a caller must not read - /// the result as an exhaustive list. Reporting zero is not the same as not - /// reporting. - /// - /// Field 4: `skipped_count` - pub skipped_count: u32, - /// The projection position this scan is pinned to, equal on every page of one - /// scan. It is the scan anchor, not a freshness report. - /// - /// A scan enumerates the ordering as it stood here, so a session that entered - /// the scope afterwards is not in it and will not appear on a later page. A - /// caller that needs newer rows starts a new scan; it does not keep paging and - /// wait for them to show up. - /// - /// Field 5: `pinned_watermark` - pub pinned_watermark: u64, - /// How current the read model was when the scan opened. Equal on every page, - /// since a pinned scan does not become fresher as it is paged. - /// - /// Field 6: `freshness` - pub freshness: ::buffa::MessageFieldView< - super::super::__buffa::view::ProjectionFreshnessView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ListSessionsResponseView<'a> { - /**Whether required field `contract` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_contract(&self) -> bool { - self.contract.is_set() - } - /**Whether required field `skipped_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_skipped_count(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `pinned_watermark` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_pinned_watermark(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `freshness` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_freshness(&self) -> bool { - self.freshness.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ListSessionsResponseView<'a> { - type Owned = super::super::ListSessionsResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.contract.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.contract = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.next_page_token = Some(::buffa::types::borrow_bytes(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.skipped_count = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.pinned_watermark = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.freshness.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.freshness = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::SessionSummaryView, - >(), - )?; - view.sessions - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ListSessionsResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ListSessionsResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ListSessionsResponse { - contract: match self.contract.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractNegotiation, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - sessions: self - .sessions - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - next_page_token: self.next_page_token.map(|b| (b).to_vec()), - skipped_count: self.skipped_count, - pinned_watermark: self.pinned_watermark, - freshness: match self.freshness.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ProjectionFreshness, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ListSessionsResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.sessions { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.next_page_token { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.skipped_count) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.pinned_watermark) as u64; - if self.freshness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.freshness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.contract.write_to(__cache, buf); - } - for v in &self.sessions { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if let Some(ref v) = self.next_page_token { - ::buffa::types::put_shared_bytes_field(3u32, v, buf); - } - ::buffa::types::put_uint32_field(4u32, self.skipped_count, buf); - ::buffa::types::put_uint64_field(5u32, self.pinned_watermark, buf); - if self.freshness.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.freshness.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ListSessionsResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.contract.as_option() { - __map.serialize_entry("contract", __v)?; - } - } - if !self.sessions.is_empty() { - __map.serialize_entry("sessions", &*self.sessions)?; - } - if let ::core::option::Option::Some(__v) = self.next_page_token { - __map - .serialize_entry( - "nextPageToken", - &::buffa::json_helpers::BytesJson(__v), - )?; - } - { - __map - .serialize_entry( - "skippedCount", - &::buffa::json_helpers::ProtoJson(&self.skipped_count), - )?; - } - { - __map - .serialize_entry( - "pinnedWatermark", - &::buffa::json_helpers::ProtoJson(&self.pinned_watermark), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.freshness.as_option() { - __map.serialize_entry("freshness", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ListSessionsResponseView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ListSessionsResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ListSessionsResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ListSessionsResponse"; -} -::buffa::impl_default_view_instance!(ListSessionsResponseView); -::buffa::impl_view_reborrow!(ListSessionsResponseView); -/** Self-contained, `'static` owned view of a `ListSessionsResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`ListSessionsResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ListSessionsResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ListSessionsResponseOwnedView( - ::buffa::OwnedView>, -); -impl ListSessionsResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ListSessionsResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ListSessionsResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ListSessionsResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ListSessionsResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ListSessionsResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ListSessionsResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ListSessionsResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `contract` - #[must_use] - pub fn contract( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractNegotiationView<'_>, - > { - &self.0.reborrow().contract - } - /// Field 2: `sessions` - #[must_use] - pub fn sessions( - &self, - ) -> &::buffa::RepeatedView< - '_, - super::super::__buffa::view::SessionSummaryView<'_>, - > { - &self.0.reborrow().sessions - } - /// Unset when this is the last page. Presence, not an empty `sessions` list, - /// is the end-of-scan signal: a page may legitimately be empty while more - /// pages remain. - /// - /// Field 3: `next_page_token` - #[must_use] - pub fn next_page_token(&self) -> ::core::option::Option<&'_ [u8]> { - self.0.reborrow().next_page_token - } - /// Rows the server could not decode or render and therefore skipped. A - /// non-zero count means this page is incomplete, and a caller must not read - /// the result as an exhaustive list. Reporting zero is not the same as not - /// reporting. - /// - /// Field 4: `skipped_count` - #[must_use] - pub fn skipped_count(&self) -> u32 { - self.0.reborrow().skipped_count - } - /// The projection position this scan is pinned to, equal on every page of one - /// scan. It is the scan anchor, not a freshness report. - /// - /// A scan enumerates the ordering as it stood here, so a session that entered - /// the scope afterwards is not in it and will not appear on a later page. A - /// caller that needs newer rows starts a new scan; it does not keep paging and - /// wait for them to show up. - /// - /// Field 5: `pinned_watermark` - #[must_use] - pub fn pinned_watermark(&self) -> u64 { - self.0.reborrow().pinned_watermark - } - /// How current the read model was when the scan opened. Equal on every page, - /// since a pinned scan does not become fresher as it is paged. - /// - /// Field 6: `freshness` - #[must_use] - pub fn freshness( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ProjectionFreshnessView<'_>, - > { - &self.0.reborrow().freshness - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ListSessionsResponseOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ListSessionsResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ListSessionsResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ListSessionsResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ListSessionsResponse { - type View<'a> = ListSessionsResponseView<'a>; - type ViewHandle = ListSessionsResponseOwnedView; -} -impl ::serde::Serialize for ListSessionsResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.list_sessions.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.list_sessions.rs deleted file mode 100644 index 6ec9f10ca..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.list_sessions.rs +++ /dev/null @@ -1,933 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/list_sessions.proto - -/// ListSessionsScope is which sessions are in range. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ListSessionsScope { - LIST_SESSIONS_SCOPE_UNSPECIFIED = 0i32, - /// Sessions bound to one workspace. - LIST_SESSIONS_SCOPE_WORKSPACE = 1i32, - /// Every session the caller may see, across workspaces. - LIST_SESSIONS_SCOPE_ALL = 2i32, -} -impl ListSessionsScope { - ///Idiomatic alias for [`Self::LIST_SESSIONS_SCOPE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::LIST_SESSIONS_SCOPE_UNSPECIFIED; - ///Idiomatic alias for [`Self::LIST_SESSIONS_SCOPE_WORKSPACE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Workspace: Self = Self::LIST_SESSIONS_SCOPE_WORKSPACE; - ///Idiomatic alias for [`Self::LIST_SESSIONS_SCOPE_ALL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const All: Self = Self::LIST_SESSIONS_SCOPE_ALL; -} -impl ::core::default::Default for ListSessionsScope { - fn default() -> Self { - Self::LIST_SESSIONS_SCOPE_UNSPECIFIED - } -} -impl ::serde::Serialize for ListSessionsScope { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ListSessionsScope { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ListSessionsScope; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(ListSessionsScope) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ListSessionsScope { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ListSessionsScope { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::LIST_SESSIONS_SCOPE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::LIST_SESSIONS_SCOPE_WORKSPACE), - 2i32 => ::core::option::Option::Some(Self::LIST_SESSIONS_SCOPE_ALL), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::LIST_SESSIONS_SCOPE_UNSPECIFIED => "LIST_SESSIONS_SCOPE_UNSPECIFIED", - Self::LIST_SESSIONS_SCOPE_WORKSPACE => "LIST_SESSIONS_SCOPE_WORKSPACE", - Self::LIST_SESSIONS_SCOPE_ALL => "LIST_SESSIONS_SCOPE_ALL", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "LIST_SESSIONS_SCOPE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::LIST_SESSIONS_SCOPE_UNSPECIFIED) - } - "LIST_SESSIONS_SCOPE_WORKSPACE" => { - ::core::option::Option::Some(Self::LIST_SESSIONS_SCOPE_WORKSPACE) - } - "LIST_SESSIONS_SCOPE_ALL" => { - ::core::option::Option::Some(Self::LIST_SESSIONS_SCOPE_ALL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::LIST_SESSIONS_SCOPE_UNSPECIFIED, - Self::LIST_SESSIONS_SCOPE_WORKSPACE, - Self::LIST_SESSIONS_SCOPE_ALL, - ] - } -} -/// ArchivedFilter is how archived sessions are treated. -/// -/// A tri-state rather than a boolean, because "exclude archived" and "archived -/// only" are both real views and a boolean can only express one of them -/// alongside the default. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ArchivedFilter { - ARCHIVED_FILTER_UNSPECIFIED = 0i32, - ARCHIVED_FILTER_EXCLUDE = 1i32, - ARCHIVED_FILTER_INCLUDE = 2i32, - ARCHIVED_FILTER_ONLY = 3i32, -} -impl ArchivedFilter { - ///Idiomatic alias for [`Self::ARCHIVED_FILTER_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::ARCHIVED_FILTER_UNSPECIFIED; - ///Idiomatic alias for [`Self::ARCHIVED_FILTER_EXCLUDE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Exclude: Self = Self::ARCHIVED_FILTER_EXCLUDE; - ///Idiomatic alias for [`Self::ARCHIVED_FILTER_INCLUDE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Include: Self = Self::ARCHIVED_FILTER_INCLUDE; - ///Idiomatic alias for [`Self::ARCHIVED_FILTER_ONLY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Only: Self = Self::ARCHIVED_FILTER_ONLY; -} -impl ::core::default::Default for ArchivedFilter { - fn default() -> Self { - Self::ARCHIVED_FILTER_UNSPECIFIED - } -} -impl ::serde::Serialize for ArchivedFilter { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ArchivedFilter { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ArchivedFilter; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(ArchivedFilter) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ArchivedFilter { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ArchivedFilter { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::ARCHIVED_FILTER_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::ARCHIVED_FILTER_EXCLUDE), - 2i32 => ::core::option::Option::Some(Self::ARCHIVED_FILTER_INCLUDE), - 3i32 => ::core::option::Option::Some(Self::ARCHIVED_FILTER_ONLY), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::ARCHIVED_FILTER_UNSPECIFIED => "ARCHIVED_FILTER_UNSPECIFIED", - Self::ARCHIVED_FILTER_EXCLUDE => "ARCHIVED_FILTER_EXCLUDE", - Self::ARCHIVED_FILTER_INCLUDE => "ARCHIVED_FILTER_INCLUDE", - Self::ARCHIVED_FILTER_ONLY => "ARCHIVED_FILTER_ONLY", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "ARCHIVED_FILTER_UNSPECIFIED" => { - ::core::option::Option::Some(Self::ARCHIVED_FILTER_UNSPECIFIED) - } - "ARCHIVED_FILTER_EXCLUDE" => { - ::core::option::Option::Some(Self::ARCHIVED_FILTER_EXCLUDE) - } - "ARCHIVED_FILTER_INCLUDE" => { - ::core::option::Option::Some(Self::ARCHIVED_FILTER_INCLUDE) - } - "ARCHIVED_FILTER_ONLY" => { - ::core::option::Option::Some(Self::ARCHIVED_FILTER_ONLY) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::ARCHIVED_FILTER_UNSPECIFIED, - Self::ARCHIVED_FILTER_EXCLUDE, - Self::ARCHIVED_FILTER_INCLUDE, - Self::ARCHIVED_FILTER_ONLY, - ] - } -} -/// ListSessionsRequest enumerates sessions in a scope, newest first. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ListSessionsRequest { - /// Field 1: `accepted_contract` - #[serde(rename = "acceptedContract", alias = "accepted_contract")] - pub accepted_contract: ::buffa::MessageField< - ContractVersion, - ::buffa::Inline, - >, - /// Field 2: `scope` - #[serde(rename = "scope", with = "::buffa::json_helpers::proto_enum")] - pub scope: ::buffa::EnumValue, - /// Required for SCOPE_WORKSPACE, ignored otherwise. - /// - /// Field 3: `workspace_id` - #[serde( - rename = "workspaceId", - alias = "workspace_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub workspace_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 4: `archived` - #[serde(rename = "archived", with = "::buffa::json_helpers::proto_enum")] - pub archived: ::buffa::EnumValue, - /// Maximum rows to return. The server may return fewer. A value above the - /// configured admission limit is refused with - /// QUERY_ERROR_CODE_RESOURCE_EXHAUSTED rather than silently clamped, so a - /// caller is never left believing it asked for more than it received. - /// - /// Field 5: `page_size` - #[serde( - rename = "pageSize", - alias = "page_size", - with = "::buffa::json_helpers::uint32" - )] - pub page_size: u32, - /// Opaque continuation from a prior response, a serialized CursorEnvelope. - /// Unset starts a new scan. The caller must treat this as bytes and never - /// construct, parse, or edit one. - /// - /// A continuation still carries the scope, workspace, and archived filter, and - /// they must match what the cursor was minted with. The server refuses a - /// disagreement rather than re-scoping the scan in flight. - /// - /// Field 6: `page_token` - #[serde( - rename = "pageToken", - alias = "page_token", - with = "::buffa::json_helpers::opt_bytes", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub page_token: ::core::option::Option<::buffa::alloc::vec::Vec>, - /// Freshness the caller requires. Honored when the scan opens and ignored on - /// a continuation, because a continuation is served from the pinned watermark - /// and waiting for anything newer could not change what it returns. - /// - /// A continuation whose requirement is stricter than the one the scan was - /// opened with is QUERY_ERROR_CODE_INVALID_ARGUMENT. Silently ignoring it - /// would let a caller believe a later page reflects a write that it cannot. - /// - /// Field 7: `consistency` - #[serde( - rename = "consistency", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub consistency: ::buffa::MessageField< - ReadConsistency, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for ListSessionsRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ListSessionsRequest") - .field("accepted_contract", &self.accepted_contract) - .field("scope", &self.scope) - .field("workspace_id", &self.workspace_id) - .field("archived", &self.archived) - .field("page_size", &self.page_size) - .field("page_token", &self.page_token) - .field("consistency", &self.consistency) - .finish() - } -} -impl ListSessionsRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ListSessionsRequest"; -} -impl ListSessionsRequest { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::workspace_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_workspace_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.workspace_id = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::page_token`] to `Some(value)`, consuming and returning `self`. - pub fn with_page_token( - mut self, - value: impl Into<::buffa::alloc::vec::Vec>, - ) -> Self { - self.page_token = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ListSessionsRequest); -impl ::buffa::MessageName for ListSessionsRequest { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ListSessionsRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ListSessionsRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ListSessionsRequest"; -} -impl ::buffa::Message for ListSessionsRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.accepted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.accepted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.scope.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.workspace_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - { - let val = self.archived.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.page_size) as u64; - if let Some(ref v) = self.page_token { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - if self.consistency.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.consistency.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.accepted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.accepted_contract.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(2u32, self.scope.to_i32(), buf); - if let Some(ref v) = self.workspace_id { - ::buffa::types::put_string_field(3u32, v, buf); - } - ::buffa::types::put_int32_field(4u32, self.archived.to_i32(), buf); - ::buffa::types::put_uint32_field(5u32, self.page_size, buf); - if let Some(ref v) = self.page_token { - ::buffa::types::put_shared_bytes_field(6u32, v, buf); - } - if self.consistency.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.consistency.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.accepted_contract.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.scope = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .workspace_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.archived = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.page_size = ::buffa::types::decode_uint32(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes( - self.page_token.get_or_insert_with(::buffa::alloc::vec::Vec::new), - buf, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.consistency.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.accepted_contract = ::buffa::MessageField::none(); - self.scope = ::buffa::EnumValue::from(0); - self.workspace_id = ::core::option::Option::None; - self.archived = ::buffa::EnumValue::from(0); - self.page_size = 0u32; - self.page_token = ::core::option::Option::None; - self.consistency = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ListSessionsRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __LIST_SESSIONS_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ListSessionsRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ListSessionsResponse is one page of session summaries. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ListSessionsResponse { - /// Field 1: `contract` - #[serde(rename = "contract")] - pub contract: ::buffa::MessageField< - ContractNegotiation, - ::buffa::Inline, - >, - /// Field 2: `sessions` - #[serde( - rename = "sessions", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub sessions: ::buffa::alloc::vec::Vec, - /// Unset when this is the last page. Presence, not an empty `sessions` list, - /// is the end-of-scan signal: a page may legitimately be empty while more - /// pages remain. - /// - /// Field 3: `next_page_token` - #[serde( - rename = "nextPageToken", - alias = "next_page_token", - with = "::buffa::json_helpers::opt_bytes", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub next_page_token: ::core::option::Option<::buffa::alloc::vec::Vec>, - /// Rows the server could not decode or render and therefore skipped. A - /// non-zero count means this page is incomplete, and a caller must not read - /// the result as an exhaustive list. Reporting zero is not the same as not - /// reporting. - /// - /// Field 4: `skipped_count` - #[serde( - rename = "skippedCount", - alias = "skipped_count", - with = "::buffa::json_helpers::uint32" - )] - pub skipped_count: u32, - /// The projection position this scan is pinned to, equal on every page of one - /// scan. It is the scan anchor, not a freshness report. - /// - /// A scan enumerates the ordering as it stood here, so a session that entered - /// the scope afterwards is not in it and will not appear on a later page. A - /// caller that needs newer rows starts a new scan; it does not keep paging and - /// wait for them to show up. - /// - /// Field 5: `pinned_watermark` - #[serde( - rename = "pinnedWatermark", - alias = "pinned_watermark", - with = "::buffa::json_helpers::uint64" - )] - pub pinned_watermark: u64, - /// How current the read model was when the scan opened. Equal on every page, - /// since a pinned scan does not become fresher as it is paged. - /// - /// Field 6: `freshness` - #[serde(rename = "freshness")] - pub freshness: ::buffa::MessageField< - ProjectionFreshness, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for ListSessionsResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ListSessionsResponse") - .field("contract", &self.contract) - .field("sessions", &self.sessions) - .field("next_page_token", &self.next_page_token) - .field("skipped_count", &self.skipped_count) - .field("pinned_watermark", &self.pinned_watermark) - .field("freshness", &self.freshness) - .finish() - } -} -impl ListSessionsResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ListSessionsResponse"; -} -impl ListSessionsResponse { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::next_page_token`] to `Some(value)`, consuming and returning `self`. - pub fn with_next_page_token( - mut self, - value: impl Into<::buffa::alloc::vec::Vec>, - ) -> Self { - self.next_page_token = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ListSessionsResponse); -impl ::buffa::MessageName for ListSessionsResponse { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ListSessionsResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ListSessionsResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ListSessionsResponse"; -} -impl ::buffa::Message for ListSessionsResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.sessions { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.next_page_token { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.skipped_count) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.pinned_watermark) as u64; - if self.freshness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.freshness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.contract.write_to(__cache, buf); - } - for v in &self.sessions { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if let Some(ref v) = self.next_page_token { - ::buffa::types::put_shared_bytes_field(3u32, v, buf); - } - ::buffa::types::put_uint32_field(4u32, self.skipped_count, buf); - ::buffa::types::put_uint64_field(5u32, self.pinned_watermark, buf); - if self.freshness.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.freshness.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.contract.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.sessions.push(elem); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes( - self - .next_page_token - .get_or_insert_with(::buffa::alloc::vec::Vec::new), - buf, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.skipped_count = ::buffa::types::decode_uint32(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.pinned_watermark = ::buffa::types::decode_uint64(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.freshness.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.contract = ::buffa::MessageField::none(); - self.sessions.clear(); - self.next_page_token = ::core::option::Option::None; - self.skipped_count = 0u32; - self.pinned_watermark = 0u64; - self.freshness = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ListSessionsResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __LIST_SESSIONS_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ListSessionsResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.mod.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.mod.rs deleted file mode 100644 index 522d8f631..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.mod.rs +++ /dev/null @@ -1,320 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. - -include!("trogonai.session.sessions.queries.v1alpha1.contract_version.rs"); -include!("trogonai.session.sessions.queries.v1alpha1.projection_freshness.rs"); -include!("trogonai.session.sessions.queries.v1alpha1.read_consistency.rs"); -include!("trogonai.session.sessions.queries.v1alpha1.session_view.rs"); -include!("trogonai.session.sessions.queries.v1alpha1.get_session.rs"); -include!("trogonai.session.sessions.queries.v1alpha1.history_item.rs"); -include!("trogonai.session.sessions.queries.v1alpha1.get_session_history.rs"); -include!("trogonai.session.sessions.queries.v1alpha1.latest_session.rs"); -include!("trogonai.session.sessions.queries.v1alpha1.list_sessions.rs"); -include!("trogonai.session.sessions.queries.v1alpha1.page_cursor.rs"); -include!("trogonai.session.sessions.queries.v1alpha1.presentation_cache.rs"); -include!("trogonai.session.sessions.queries.v1alpha1.query_error.rs"); -#[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception -)] -pub mod __buffa { - #[allow(unused_imports)] - use super::*; - pub mod view { - #[allow(unused_imports)] - use super::*; - include!( - "trogonai.session.sessions.queries.v1alpha1.contract_version.__view.rs" - ); - include!( - "trogonai.session.sessions.queries.v1alpha1.projection_freshness.__view.rs" - ); - include!( - "trogonai.session.sessions.queries.v1alpha1.read_consistency.__view.rs" - ); - include!("trogonai.session.sessions.queries.v1alpha1.session_view.__view.rs"); - include!("trogonai.session.sessions.queries.v1alpha1.get_session.__view.rs"); - include!("trogonai.session.sessions.queries.v1alpha1.history_item.__view.rs"); - include!( - "trogonai.session.sessions.queries.v1alpha1.get_session_history.__view.rs" - ); - include!("trogonai.session.sessions.queries.v1alpha1.latest_session.__view.rs"); - include!("trogonai.session.sessions.queries.v1alpha1.list_sessions.__view.rs"); - include!("trogonai.session.sessions.queries.v1alpha1.page_cursor.__view.rs"); - include!( - "trogonai.session.sessions.queries.v1alpha1.presentation_cache.__view.rs" - ); - include!("trogonai.session.sessions.queries.v1alpha1.query_error.__view.rs"); - pub mod oneof { - #[allow(unused_imports)] - use super::*; - include!( - "trogonai.session.sessions.queries.v1alpha1.history_item.__view_oneof.rs" - ); - include!( - "trogonai.session.sessions.queries.v1alpha1.page_cursor.__view_oneof.rs" - ); - include!( - "trogonai.session.sessions.queries.v1alpha1.query_error.__view_oneof.rs" - ); - } - } - pub mod oneof { - #[allow(unused_imports)] - use super::*; - include!("trogonai.session.sessions.queries.v1alpha1.history_item.__oneof.rs"); - include!("trogonai.session.sessions.queries.v1alpha1.page_cursor.__oneof.rs"); - include!("trogonai.session.sessions.queries.v1alpha1.query_error.__oneof.rs"); - } - /// Register this package's `Any` type entries and extension entries. - pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) { - reg.register_json_any(super::__CONTRACT_VERSION_JSON_ANY); - reg.register_json_any(super::__CONTRACT_NEGOTIATION_JSON_ANY); - reg.register_json_any(super::__PROJECTION_FRESHNESS_JSON_ANY); - reg.register_json_any(super::__CONSISTENCY_OUTCOME_JSON_ANY); - reg.register_json_any(super::__READ_CONSISTENCY_JSON_ANY); - reg.register_json_any(super::__CONSISTENCY_TOKEN_JSON_ANY); - reg.register_json_any(super::__SESSION_SUMMARY_JSON_ANY); - reg.register_json_any(super::__SESSION_PREVIEW_JSON_ANY); - reg.register_json_any(super::__RECOVERY_PROVENANCE_VIEW_JSON_ANY); - reg.register_json_any(super::__SESSION_VIEW_JSON_ANY); - reg.register_json_any(super::__ARTIFACT_COMPLETENESS_VIEW_JSON_ANY); - reg.register_json_any(super::__OBSERVED_INTEGRITY_VIEW_JSON_ANY); - reg.register_json_any(super::__FORK_ORIGIN_VIEW_JSON_ANY); - reg.register_json_any(super::__PARENT_VIEW_JSON_ANY); - reg.register_json_any(super::__DELEGATION_VIEW_JSON_ANY); - reg.register_json_any(super::__GET_SESSION_REQUEST_JSON_ANY); - reg.register_json_any(super::__GET_SESSION_RESPONSE_JSON_ANY); - reg.register_json_any(super::__HISTORY_ITEM_JSON_ANY); - reg.register_json_any(super::__HISTORY_ITEM_ELIDED_JSON_ANY); - reg.register_json_any(super::__USER_MESSAGE_ITEM_JSON_ANY); - reg.register_json_any(super::__ASSISTANT_MESSAGE_ITEM_JSON_ANY); - reg.register_json_any(super::__TOOL_CALL_ITEM_JSON_ANY); - reg.register_json_any(super::__FILE_CHANGE_ITEM_JSON_ANY); - reg.register_json_any(super::__SYSTEM_NOTICE_ITEM_JSON_ANY); - reg.register_json_any(super::__COMPACTION_ITEM_JSON_ANY); - reg.register_json_any(super::__GET_SESSION_HISTORY_REQUEST_JSON_ANY); - reg.register_json_any(super::__GET_SESSION_HISTORY_RESPONSE_JSON_ANY); - reg.register_json_any(super::__GET_LATEST_SESSION_REQUEST_JSON_ANY); - reg.register_json_any(super::__GET_LATEST_SESSION_RESPONSE_JSON_ANY); - reg.register_json_any(super::__EXCLUSION_COUNTS_JSON_ANY); - reg.register_json_any(super::__LIST_SESSIONS_REQUEST_JSON_ANY); - reg.register_json_any(super::__LIST_SESSIONS_RESPONSE_JSON_ANY); - reg.register_json_any(super::__CURSOR_ENVELOPE_JSON_ANY); - reg.register_json_any(super::__PAGE_CURSOR_JSON_ANY); - reg.register_json_any(super::__HISTORY_SCAN_CURSOR_JSON_ANY); - reg.register_json_any(super::__SESSION_LIST_SCAN_CURSOR_JSON_ANY); - reg.register_json_any(super::__LIST_SCAN_SELECTOR_JSON_ANY); - reg.register_json_any(super::__SESSION_ORDERING_KEY_JSON_ANY); - reg.register_json_any(super::__CURSOR_VALIDITY_JSON_ANY); - reg.register_json_any(super::__PRESENTATION_CACHE_BINDING_JSON_ANY); - reg.register_json_any(super::__CHECK_PRESENTATION_CACHE_REQUEST_JSON_ANY); - reg.register_json_any(super::__CHECK_PRESENTATION_CACHE_RESPONSE_JSON_ANY); - reg.register_json_any(super::__QUERY_ERROR_JSON_ANY); - reg.register_json_any(super::__UNSUPPORTED_CONTRACT_VERSION_DETAIL_JSON_ANY); - reg.register_json_any(super::__STALE_CURSOR_DETAIL_JSON_ANY); - reg.register_json_any(super::__PROJECTION_UNAVAILABLE_DETAIL_JSON_ANY); - reg.register_json_any(super::__REBUILD_PROGRESS_JSON_ANY); - reg.register_json_any(super::__INVALID_ARGUMENT_DETAIL_JSON_ANY); - } -} -#[doc(inline)] -pub use self::__buffa::view::ContractVersionView; -#[doc(inline)] -pub use self::__buffa::view::ContractVersionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ContractNegotiationView; -#[doc(inline)] -pub use self::__buffa::view::ContractNegotiationOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ProjectionFreshnessView; -#[doc(inline)] -pub use self::__buffa::view::ProjectionFreshnessOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ConsistencyOutcomeView; -#[doc(inline)] -pub use self::__buffa::view::ConsistencyOutcomeOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReadConsistencyView; -#[doc(inline)] -pub use self::__buffa::view::ReadConsistencyOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ConsistencyTokenView; -#[doc(inline)] -pub use self::__buffa::view::ConsistencyTokenOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionSummaryView; -#[doc(inline)] -pub use self::__buffa::view::SessionSummaryOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionPreviewView; -#[doc(inline)] -pub use self::__buffa::view::SessionPreviewOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RecoveryProvenanceViewView; -#[doc(inline)] -pub use self::__buffa::view::RecoveryProvenanceViewOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionViewView; -#[doc(inline)] -pub use self::__buffa::view::SessionViewOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ArtifactCompletenessViewView; -#[doc(inline)] -pub use self::__buffa::view::ArtifactCompletenessViewOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ObservedIntegrityViewView; -#[doc(inline)] -pub use self::__buffa::view::ObservedIntegrityViewOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ForkOriginViewView; -#[doc(inline)] -pub use self::__buffa::view::ForkOriginViewOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ParentViewView; -#[doc(inline)] -pub use self::__buffa::view::ParentViewOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DelegationViewView; -#[doc(inline)] -pub use self::__buffa::view::DelegationViewOwnedView; -#[doc(inline)] -pub use self::__buffa::view::GetSessionRequestView; -#[doc(inline)] -pub use self::__buffa::view::GetSessionRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::GetSessionResponseView; -#[doc(inline)] -pub use self::__buffa::view::GetSessionResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::view::HistoryItemView; -#[doc(inline)] -pub use self::__buffa::view::HistoryItemOwnedView; -#[doc(inline)] -pub use self::__buffa::view::HistoryItemElidedView; -#[doc(inline)] -pub use self::__buffa::view::HistoryItemElidedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::UserMessageItemView; -#[doc(inline)] -pub use self::__buffa::view::UserMessageItemOwnedView; -#[doc(inline)] -pub use self::__buffa::view::AssistantMessageItemView; -#[doc(inline)] -pub use self::__buffa::view::AssistantMessageItemOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallItemView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallItemOwnedView; -#[doc(inline)] -pub use self::__buffa::view::FileChangeItemView; -#[doc(inline)] -pub use self::__buffa::view::FileChangeItemOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SystemNoticeItemView; -#[doc(inline)] -pub use self::__buffa::view::SystemNoticeItemOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CompactionItemView; -#[doc(inline)] -pub use self::__buffa::view::CompactionItemOwnedView; -#[doc(inline)] -pub use self::__buffa::view::GetSessionHistoryRequestView; -#[doc(inline)] -pub use self::__buffa::view::GetSessionHistoryRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::GetSessionHistoryResponseView; -#[doc(inline)] -pub use self::__buffa::view::GetSessionHistoryResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::view::GetLatestSessionRequestView; -#[doc(inline)] -pub use self::__buffa::view::GetLatestSessionRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::GetLatestSessionResponseView; -#[doc(inline)] -pub use self::__buffa::view::GetLatestSessionResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ExclusionCountsView; -#[doc(inline)] -pub use self::__buffa::view::ExclusionCountsOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ListSessionsRequestView; -#[doc(inline)] -pub use self::__buffa::view::ListSessionsRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ListSessionsResponseView; -#[doc(inline)] -pub use self::__buffa::view::ListSessionsResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CursorEnvelopeView; -#[doc(inline)] -pub use self::__buffa::view::CursorEnvelopeOwnedView; -#[doc(inline)] -pub use self::__buffa::view::PageCursorView; -#[doc(inline)] -pub use self::__buffa::view::PageCursorOwnedView; -#[doc(inline)] -pub use self::__buffa::view::HistoryScanCursorView; -#[doc(inline)] -pub use self::__buffa::view::HistoryScanCursorOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionListScanCursorView; -#[doc(inline)] -pub use self::__buffa::view::SessionListScanCursorOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ListScanSelectorView; -#[doc(inline)] -pub use self::__buffa::view::ListScanSelectorOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionOrderingKeyView; -#[doc(inline)] -pub use self::__buffa::view::SessionOrderingKeyOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CursorValidityView; -#[doc(inline)] -pub use self::__buffa::view::CursorValidityOwnedView; -#[doc(inline)] -pub use self::__buffa::view::PresentationCacheBindingView; -#[doc(inline)] -pub use self::__buffa::view::PresentationCacheBindingOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CheckPresentationCacheRequestView; -#[doc(inline)] -pub use self::__buffa::view::CheckPresentationCacheRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CheckPresentationCacheResponseView; -#[doc(inline)] -pub use self::__buffa::view::CheckPresentationCacheResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::view::QueryErrorView; -#[doc(inline)] -pub use self::__buffa::view::QueryErrorOwnedView; -#[doc(inline)] -pub use self::__buffa::view::UnsupportedContractVersionDetailView; -#[doc(inline)] -pub use self::__buffa::view::UnsupportedContractVersionDetailOwnedView; -#[doc(inline)] -pub use self::__buffa::view::StaleCursorDetailView; -#[doc(inline)] -pub use self::__buffa::view::StaleCursorDetailOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ProjectionUnavailableDetailView; -#[doc(inline)] -pub use self::__buffa::view::ProjectionUnavailableDetailOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RebuildProgressView; -#[doc(inline)] -pub use self::__buffa::view::RebuildProgressOwnedView; -#[doc(inline)] -pub use self::__buffa::view::InvalidArgumentDetailView; -#[doc(inline)] -pub use self::__buffa::view::InvalidArgumentDetailOwnedView; -#[doc(inline)] -pub use self::__buffa::register_types; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.page_cursor.__oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.page_cursor.__oneof.rs deleted file mode 100644 index 3263da166..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.page_cursor.__oneof.rs +++ /dev/null @@ -1,57 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/page_cursor.proto - -pub mod page_cursor { - #[allow(unused_imports)] - use super::*; - /// When the scan variant does not match the query it was presented to, the - /// token is MALFORMED_CURSOR. A history cursor is not a list cursor with - /// different fields set. - #[derive(Clone, PartialEq, Debug)] - pub enum Scan { - History(::buffa::alloc::boxed::Box), - SessionList( - ::buffa::alloc::boxed::Box, - ), - } - impl ::buffa::Oneof for Scan {} - impl From for Scan { - fn from(v: super::super::super::HistoryScanCursor) -> Self { - Self::History(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::HistoryScanCursor) -> Self { - Self::Some(Scan::from(v)) - } - } - impl From for Scan { - fn from(v: super::super::super::SessionListScanCursor) -> Self { - Self::SessionList(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::SessionListScanCursor) -> Self { - Self::Some(Scan::from(v)) - } - } - impl serde::Serialize for Scan { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::History(v) => { - map.serialize_entry("history", v)?; - } - Self::SessionList(v) => { - map.serialize_entry("sessionList", v)?; - } - } - map.end() - } - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.page_cursor.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.page_cursor.__view.rs deleted file mode 100644 index 4482a9403..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.page_cursor.__view.rs +++ /dev/null @@ -1,2917 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/page_cursor.proto - -/// CursorEnvelope is what a `page_token` actually contains. -/// -/// These types are server-minted internals. They are published so the format is -/// reviewable and versioned, not so callers can read it: a client must treat a -/// token as opaque bytes and never construct, parse, or edit one. The server -/// owes nothing to a hand-built token beyond QUERY_ERROR_CODE_MALFORMED_CURSOR. -/// -/// The envelope keeps `payload` as bytes rather than an inline message on -/// purpose. `mac` authenticates the exact bytes the server emitted, and protobuf -/// serialization is not canonical, so a server that re-encoded a decoded message -/// to check the MAC could compute a different byte string than it signed. -#[derive(Clone, Debug, Default)] -pub struct CursorEnvelopeView<'a> { - /// Version of this envelope and payload format, independent of the query - /// ContractVersion. A token minted under an unknown format_version is - /// MALFORMED_CURSOR, not STALE_CURSOR: there is nothing to interpret. - /// - /// Field 1: `format_version` - pub format_version: u32, - /// Serialized PageCursor. - /// - /// Field 2: `payload` - pub payload: &'a [u8], - /// Authenticates format_version and payload under a server-held key. - /// - /// A cursor names a scan position, so an unauthenticated one is a request - /// parameter the caller controls. The MAC is what stops a caller from moving - /// the anchor, widening the selector, or pointing a scan at another session's - /// stream. It is tamper evidence and nothing more: a cursor is never - /// authorization, and every continuation is re-authorized from the caller's - /// own identity as if it were a fresh request. - /// - /// Field 3: `mac` - pub mac: &'a [u8], - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CursorEnvelopeView<'a> { - /**Whether required field `format_version` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_format_version(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `payload` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_payload(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `mac` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_mac(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for CursorEnvelopeView<'a> { - type Owned = super::super::CursorEnvelope; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.format_version = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.payload = ::buffa::types::borrow_bytes(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.mac = ::buffa::types::borrow_bytes(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CursorEnvelope { - format_version: self.format_version, - payload: (self.payload).to_vec(), - mac: (self.mac).to_vec(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CursorEnvelopeView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.format_version) as u64; - size += 1u64 + ::buffa::types::bytes_encoded_len(&self.payload) as u64; - size += 1u64 + ::buffa::types::bytes_encoded_len(&self.mac) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.format_version, buf); - ::buffa::types::put_shared_bytes_field(2u32, &self.payload, buf); - ::buffa::types::put_shared_bytes_field(3u32, &self.mac, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CursorEnvelopeView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "formatVersion", - &::buffa::json_helpers::ProtoJson(&self.format_version), - )?; - } - { - __map - .serialize_entry( - "payload", - &::buffa::json_helpers::BytesJson(self.payload), - )?; - } - { - __map.serialize_entry("mac", &::buffa::json_helpers::BytesJson(self.mac))?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CursorEnvelopeView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "CursorEnvelope"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.CursorEnvelope"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CursorEnvelope"; -} -::buffa::impl_default_view_instance!(CursorEnvelopeView); -::buffa::impl_view_reborrow!(CursorEnvelopeView); -/** Self-contained, `'static` owned view of a `CursorEnvelope` message. - - Wraps [`::buffa::OwnedView`]`<`[`CursorEnvelopeView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CursorEnvelopeView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CursorEnvelopeOwnedView(::buffa::OwnedView>); -impl CursorEnvelopeOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CursorEnvelopeOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CursorEnvelopeOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CursorEnvelope, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CursorEnvelopeOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CursorEnvelopeView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CursorEnvelopeView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CursorEnvelope { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Version of this envelope and payload format, independent of the query - /// ContractVersion. A token minted under an unknown format_version is - /// MALFORMED_CURSOR, not STALE_CURSOR: there is nothing to interpret. - /// - /// Field 1: `format_version` - #[must_use] - pub fn format_version(&self) -> u32 { - self.0.reborrow().format_version - } - /// Serialized PageCursor. - /// - /// Field 2: `payload` - #[must_use] - pub fn payload(&self) -> &'_ [u8] { - self.0.reborrow().payload - } - /// Authenticates format_version and payload under a server-held key. - /// - /// A cursor names a scan position, so an unauthenticated one is a request - /// parameter the caller controls. The MAC is what stops a caller from moving - /// the anchor, widening the selector, or pointing a scan at another session's - /// stream. It is tamper evidence and nothing more: a cursor is never - /// authorization, and every continuation is re-authorized from the caller's - /// own identity as if it were a fresh request. - /// - /// Field 3: `mac` - #[must_use] - pub fn mac(&self) -> &'_ [u8] { - self.0.reborrow().mac - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CursorEnvelopeOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CursorEnvelopeOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CursorEnvelopeOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CursorEnvelopeOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CursorEnvelope { - type View<'a> = CursorEnvelopeView<'a>; - type ViewHandle = CursorEnvelopeOwnedView; -} -impl ::serde::Serialize for CursorEnvelopeOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// PageCursor is the decoded scan position. -#[derive(Clone, Debug, Default)] -pub struct PageCursorView<'a> { - /// When the token stops being honored regardless of validity. - /// - /// A pinned scan holds read-model retention (see CursorValidity), so scans - /// cannot be allowed to live forever. Expiry is STALE_CURSOR with - /// STALE_CURSOR_REASON_EXPIRED, because restarting the scan is the fix. - /// - /// Field 3: `expires_at` - pub expires_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - pub scan: ::core::option::Option< - super::super::__buffa::view::oneof::page_cursor::Scan<'a>, - >, -} -impl<'a> PageCursorView<'a> { - /**Whether required field `expires_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_expires_at(&self) -> bool { - self.expires_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for PageCursorView<'a> { - type Owned = super::super::PageCursor; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.expires_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.expires_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::page_cursor::Scan::History( - ref mut existing, - ), - ) = view.scan - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.scan = Some( - super::super::__buffa::view::oneof::page_cursor::Scan::History( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::page_cursor::Scan::SessionList( - ref mut existing, - ), - ) = view.scan - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.scan = Some( - super::super::__buffa::view::oneof::page_cursor::Scan::SessionList( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::PageCursor { - expires_at: match self.expires_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - scan: match self.scan.as_ref() { - ::core::option::Option::Some(v) => { - ::core::option::Option::Some( - match v { - super::super::__buffa::view::oneof::page_cursor::Scan::History( - v, - ) => { - super::super::__buffa::oneof::page_cursor::Scan::History( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::page_cursor::Scan::SessionList( - v, - ) => { - super::super::__buffa::oneof::page_cursor::Scan::SessionList( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - }, - ) - } - ::core::option::Option::None => ::core::option::Option::None, - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for PageCursorView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let ::core::option::Option::Some(ref v) = self.scan { - match v { - super::super::__buffa::view::oneof::page_cursor::Scan::History(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::page_cursor::Scan::SessionList( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - if self.expires_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.expires_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let ::core::option::Option::Some(ref v) = self.scan { - match v { - super::super::__buffa::view::oneof::page_cursor::Scan::History(x) => { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::page_cursor::Scan::SessionList( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - if self.expires_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.expires_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for PageCursorView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.expires_at.as_option() { - __map.serialize_entry("expiresAt", __v)?; - } - } - if let ::core::option::Option::Some(ref __ov) = self.scan { - match __ov { - super::super::__buffa::view::oneof::page_cursor::Scan::History(v) => { - __map.serialize_entry("history", v)?; - } - super::super::__buffa::view::oneof::page_cursor::Scan::SessionList( - v, - ) => { - __map.serialize_entry("sessionList", v)?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for PageCursorView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "PageCursor"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.PageCursor"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.PageCursor"; -} -::buffa::impl_default_view_instance!(PageCursorView); -::buffa::impl_view_reborrow!(PageCursorView); -/** Self-contained, `'static` owned view of a `PageCursor` message. - - Wraps [`::buffa::OwnedView`]`<`[`PageCursorView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`PageCursorView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct PageCursorOwnedView(::buffa::OwnedView>); -impl PageCursorOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - PageCursorOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - PageCursorOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::PageCursor, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - PageCursorOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`PageCursorView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &PageCursorView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::PageCursor { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// When the token stops being honored regardless of validity. - /// - /// A pinned scan holds read-model retention (see CursorValidity), so scans - /// cannot be allowed to live forever. Expiry is STALE_CURSOR with - /// STALE_CURSOR_REASON_EXPIRED, because restarting the scan is the fix. - /// - /// Field 3: `expires_at` - #[must_use] - pub fn expires_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().expires_at - } - /// Oneof `scan`. - #[must_use] - pub fn scan( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::page_cursor::Scan<'_>, - > { - self.0.reborrow().scan.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for PageCursorOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - PageCursorOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: PageCursorOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for PageCursorOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::PageCursor { - type View<'a> = PageCursorView<'a>; - type ViewHandle = PageCursorOwnedView; -} -impl ::serde::Serialize for PageCursorOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// HistoryScanCursor is a position within one session's history. -/// -/// This is the message that makes the paging guarantee true. History is -/// append-only and every item carries a SessionOrdinal that is assigned once and -/// never renumbered, so a position expressed as an ordinal keeps its meaning as -/// the session grows. A position expressed as an offset from either end does -/// not, which is why the count of items is deliberately absent here. -#[derive(Clone, Debug, Default)] -pub struct HistoryScanCursorView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Contract the scan was opened at. The server keeps rendering at this version - /// for the life of the scan so a page is not shaped differently from its - /// predecessors. A continuation presenting a different major is - /// STALE_CURSOR_REASON_CONTRACT_CHANGED. - /// - /// Field 2: `minted_contract` - pub minted_contract: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'a>, - >, - /// Fixed for the life of the scan. A continuation cannot reverse it; that is a - /// new scan. - /// - /// Field 3: `direction` - pub direction: ::buffa::EnumValue, - /// The effective-history head the scan was pinned to when it opened, as a - /// SessionOrdinal. - /// - /// The scan never looks past this, and that is what makes concurrent appends - /// harmless: a turn recorded after the scan opened is outside the window - /// rather than shifting rows inside it. A reverse scan walking toward older - /// history is unaffected by definition; a forward scan ends here even if newer - /// items exist by the time it arrives. - /// - /// Field 4: `anchor_ordinal` - pub anchor_ordinal: u64, - /// The last SessionOrdinal delivered. The next page resumes strictly past it - /// in `direction`, which is why an item can be neither repeated nor skipped: - /// the boundary is the identity of a delivered row, not a count of them. - /// - /// Field 5: `last_delivered_ordinal` - pub last_delivered_ordinal: u64, - /// Field 6: `validity` - pub validity: ::buffa::MessageFieldView< - super::super::__buffa::view::CursorValidityView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> HistoryScanCursorView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `minted_contract` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_minted_contract(&self) -> bool { - self.minted_contract.is_set() - } - /**Whether required field `direction` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_direction(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `anchor_ordinal` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_anchor_ordinal(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `last_delivered_ordinal` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_last_delivered_ordinal(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `validity` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_validity(&self) -> bool { - self.validity.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for HistoryScanCursorView<'a> { - type Owned = super::super::HistoryScanCursor; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.minted_contract.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.minted_contract = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.direction = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.anchor_ordinal = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.last_delivered_ordinal = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.validity.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.validity = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::HistoryScanCursor { - session_id: self.session_id.to_string(), - minted_contract: match self.minted_contract.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractVersion, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - direction: self.direction, - anchor_ordinal: self.anchor_ordinal, - last_delivered_ordinal: self.last_delivered_ordinal, - validity: match self.validity.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CursorValidity, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for HistoryScanCursorView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.minted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.minted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.direction.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.anchor_ordinal) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.last_delivered_ordinal) as u64; - if self.validity.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.validity.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.minted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.minted_contract.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.direction.to_i32(), buf); - ::buffa::types::put_uint64_field(4u32, self.anchor_ordinal, buf); - ::buffa::types::put_uint64_field(5u32, self.last_delivered_ordinal, buf); - if self.validity.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.validity.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for HistoryScanCursorView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.minted_contract.as_option() { - __map.serialize_entry("mintedContract", __v)?; - } - } - { - __map.serialize_entry("direction", &self.direction)?; - } - { - __map - .serialize_entry( - "anchorOrdinal", - &::buffa::json_helpers::ProtoJson(&self.anchor_ordinal), - )?; - } - { - __map - .serialize_entry( - "lastDeliveredOrdinal", - &::buffa::json_helpers::ProtoJson(&self.last_delivered_ordinal), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.validity.as_option() { - __map.serialize_entry("validity", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for HistoryScanCursorView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "HistoryScanCursor"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.HistoryScanCursor"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.HistoryScanCursor"; -} -::buffa::impl_default_view_instance!(HistoryScanCursorView); -::buffa::impl_view_reborrow!(HistoryScanCursorView); -/** Self-contained, `'static` owned view of a `HistoryScanCursor` message. - - Wraps [`::buffa::OwnedView`]`<`[`HistoryScanCursorView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`HistoryScanCursorView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct HistoryScanCursorOwnedView( - ::buffa::OwnedView>, -); -impl HistoryScanCursorOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - HistoryScanCursorOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - HistoryScanCursorOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::HistoryScanCursor, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - HistoryScanCursorOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`HistoryScanCursorView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &HistoryScanCursorView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::HistoryScanCursor { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Contract the scan was opened at. The server keeps rendering at this version - /// for the life of the scan so a page is not shaped differently from its - /// predecessors. A continuation presenting a different major is - /// STALE_CURSOR_REASON_CONTRACT_CHANGED. - /// - /// Field 2: `minted_contract` - #[must_use] - pub fn minted_contract( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'_>, - > { - &self.0.reborrow().minted_contract - } - /// Fixed for the life of the scan. A continuation cannot reverse it; that is a - /// new scan. - /// - /// Field 3: `direction` - #[must_use] - pub fn direction(&self) -> ::buffa::EnumValue { - self.0.reborrow().direction - } - /// The effective-history head the scan was pinned to when it opened, as a - /// SessionOrdinal. - /// - /// The scan never looks past this, and that is what makes concurrent appends - /// harmless: a turn recorded after the scan opened is outside the window - /// rather than shifting rows inside it. A reverse scan walking toward older - /// history is unaffected by definition; a forward scan ends here even if newer - /// items exist by the time it arrives. - /// - /// Field 4: `anchor_ordinal` - #[must_use] - pub fn anchor_ordinal(&self) -> u64 { - self.0.reborrow().anchor_ordinal - } - /// The last SessionOrdinal delivered. The next page resumes strictly past it - /// in `direction`, which is why an item can be neither repeated nor skipped: - /// the boundary is the identity of a delivered row, not a count of them. - /// - /// Field 5: `last_delivered_ordinal` - #[must_use] - pub fn last_delivered_ordinal(&self) -> u64 { - self.0.reborrow().last_delivered_ordinal - } - /// Field 6: `validity` - #[must_use] - pub fn validity( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CursorValidityView<'_>, - > { - &self.0.reborrow().validity - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for HistoryScanCursorOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - HistoryScanCursorOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: HistoryScanCursorOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for HistoryScanCursorOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::HistoryScanCursor { - type View<'a> = HistoryScanCursorView<'a>; - type ViewHandle = HistoryScanCursorOwnedView; -} -impl ::serde::Serialize for HistoryScanCursorOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// SessionListScanCursor is a position within a list scan. -#[derive(Clone, Debug, Default)] -pub struct SessionListScanCursorView<'a> { - /// Field 1: `minted_contract` - pub minted_contract: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'a>, - >, - /// Field 2: `selector` - pub selector: ::buffa::MessageFieldView< - super::super::__buffa::view::ListScanSelectorView<'a>, - >, - /// Last row delivered. The next page resumes strictly after it in the scan's - /// ordering. - /// - /// Field 3: `last_delivered` - pub last_delivered: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrderingKeyView<'a>, - >, - /// Field 4: `validity` - pub validity: ::buffa::MessageFieldView< - super::super::__buffa::view::CursorValidityView<'a>, - >, -} -impl<'a> SessionListScanCursorView<'a> { - /**Whether required field `minted_contract` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_minted_contract(&self) -> bool { - self.minted_contract.is_set() - } - /**Whether required field `selector` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_selector(&self) -> bool { - self.selector.is_set() - } - /**Whether required field `last_delivered` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_last_delivered(&self) -> bool { - self.last_delivered.is_set() - } - /**Whether required field `validity` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_validity(&self) -> bool { - self.validity.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for SessionListScanCursorView<'a> { - type Owned = super::super::SessionListScanCursor; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.minted_contract.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.minted_contract = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.selector.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.selector = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.last_delivered.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.last_delivered = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.validity.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.validity = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::SessionListScanCursor, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::SessionListScanCursor, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionListScanCursor { - minted_contract: match self.minted_contract.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractVersion, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - selector: match self.selector.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ListScanSelector, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - last_delivered: match self.last_delivered.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrderingKey, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - validity: match self.validity.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CursorValidity, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionListScanCursorView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.minted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.minted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.selector.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.selector.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.last_delivered.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.last_delivered.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.validity.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.validity.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.minted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.minted_contract.write_to(__cache, buf); - } - if self.selector.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.selector.write_to(__cache, buf); - } - if self.last_delivered.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.last_delivered.write_to(__cache, buf); - } - if self.validity.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.validity.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionListScanCursorView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.minted_contract.as_option() { - __map.serialize_entry("mintedContract", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.selector.as_option() { - __map.serialize_entry("selector", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.last_delivered.as_option() { - __map.serialize_entry("lastDelivered", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.validity.as_option() { - __map.serialize_entry("validity", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionListScanCursorView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "SessionListScanCursor"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.SessionListScanCursor"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionListScanCursor"; -} -::buffa::impl_default_view_instance!(SessionListScanCursorView); -::buffa::impl_view_reborrow!(SessionListScanCursorView); -/** Self-contained, `'static` owned view of a `SessionListScanCursor` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionListScanCursorView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionListScanCursorView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionListScanCursorOwnedView( - ::buffa::OwnedView>, -); -impl SessionListScanCursorOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionListScanCursorOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionListScanCursorOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionListScanCursor, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionListScanCursorOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionListScanCursorView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionListScanCursorView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionListScanCursor { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `minted_contract` - #[must_use] - pub fn minted_contract( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'_>, - > { - &self.0.reborrow().minted_contract - } - /// Field 2: `selector` - #[must_use] - pub fn selector( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ListScanSelectorView<'_>, - > { - &self.0.reborrow().selector - } - /// Last row delivered. The next page resumes strictly after it in the scan's - /// ordering. - /// - /// Field 3: `last_delivered` - #[must_use] - pub fn last_delivered( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrderingKeyView<'_>, - > { - &self.0.reborrow().last_delivered - } - /// Field 4: `validity` - #[must_use] - pub fn validity( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CursorValidityView<'_>, - > { - &self.0.reborrow().validity - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionListScanCursorOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionListScanCursorOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionListScanCursorOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionListScanCursorOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionListScanCursor { - type View<'a> = SessionListScanCursorView<'a>; - type ViewHandle = SessionListScanCursorOwnedView; -} -impl ::serde::Serialize for SessionListScanCursorOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ListScanSelector is the request shape the scan was opened with. -/// -/// A continuation whose request disagrees with this is MALFORMED_CURSOR rather -/// than a silently re-scoped scan. Changing the scope, workspace, or archived -/// filter mid-scan produces a page sequence that is neither the old selection -/// nor the new one, and the caller has no way to notice. -#[derive(Clone, Debug, Default)] -pub struct ListScanSelectorView<'a> { - /// Field 1: `scope` - pub scope: ::buffa::EnumValue, - /// Field 2: `workspace_id` - pub workspace_id: ::core::option::Option<&'a str>, - /// Field 3: `archived` - pub archived: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ListScanSelectorView<'a> { - /**Whether required field `scope` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_scope(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `archived` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_archived(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ListScanSelectorView<'a> { - type Owned = super::super::ListScanSelector; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.scope = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.workspace_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.archived = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ListScanSelector { - scope: self.scope, - workspace_id: self.workspace_id.map(|s| s.to_string()), - archived: self.archived, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ListScanSelectorView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.scope.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.workspace_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - { - let val = self.archived.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.scope.to_i32(), buf); - if let Some(ref v) = self.workspace_id { - ::buffa::types::put_string_field(2u32, v, buf); - } - ::buffa::types::put_int32_field(3u32, self.archived.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ListScanSelectorView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("scope", &self.scope)?; - } - if let ::core::option::Option::Some(__v) = self.workspace_id { - __map.serialize_entry("workspaceId", __v)?; - } - { - __map.serialize_entry("archived", &self.archived)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ListScanSelectorView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ListScanSelector"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ListScanSelector"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ListScanSelector"; -} -::buffa::impl_default_view_instance!(ListScanSelectorView); -::buffa::impl_view_reborrow!(ListScanSelectorView); -/** Self-contained, `'static` owned view of a `ListScanSelector` message. - - Wraps [`::buffa::OwnedView`]`<`[`ListScanSelectorView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ListScanSelectorView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ListScanSelectorOwnedView(::buffa::OwnedView>); -impl ListScanSelectorOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ListScanSelectorOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ListScanSelectorOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ListScanSelector, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ListScanSelectorOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ListScanSelectorView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ListScanSelectorView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ListScanSelector { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `scope` - #[must_use] - pub fn scope(&self) -> ::buffa::EnumValue { - self.0.reborrow().scope - } - /// Field 2: `workspace_id` - #[must_use] - pub fn workspace_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().workspace_id - } - /// Field 3: `archived` - #[must_use] - pub fn archived(&self) -> ::buffa::EnumValue { - self.0.reborrow().archived - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ListScanSelectorOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ListScanSelectorOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ListScanSelectorOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ListScanSelectorOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ListScanSelector { - type View<'a> = ListScanSelectorView<'a>; - type ViewHandle = ListScanSelectorOwnedView; -} -impl ::serde::Serialize for ListScanSelectorOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// SessionOrderingKey is one row's position in the list ordering. -/// -/// Ordering is by `ordering_value` descending, then `session_id` ascending. The -/// tie-breaker is not decoration: ordering values collide, and a boundary that -/// cannot distinguish two rows sharing one must either re-emit both or drop -/// both. -#[derive(Clone, Debug, Default)] -pub struct SessionOrderingKeyView<'a> { - /// The row's ordering value as of the scan's pinned watermark, not as of now. - /// - /// Recency ordering is the thing a session picker wants and is also mutable, a - /// combination that breaks naive pagination: a row that gains activity after - /// the cursor has passed its old position jumps ahead of the cursor and is - /// never delivered. Reading the ordering as of a fixed watermark is what - /// removes that skip, and it is an obligation on the list projection rather - /// than something this contract can assert by itself. - /// - /// Field 1: `ordering_value` - pub ordering_value: u64, - /// Field 2: `session_id` - pub session_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionOrderingKeyView<'a> { - /**Whether required field `ordering_value` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ordering_value(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SessionOrderingKeyView<'a> { - type Owned = super::super::SessionOrderingKey; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.ordering_value = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionOrderingKey { - ordering_value: self.ordering_value, - session_id: self.session_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionOrderingKeyView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.ordering_value) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.ordering_value, buf); - ::buffa::types::put_string_field(2u32, &self.session_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionOrderingKeyView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "orderingValue", - &::buffa::json_helpers::ProtoJson(&self.ordering_value), - )?; - } - { - __map.serialize_entry("sessionId", self.session_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionOrderingKeyView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "SessionOrderingKey"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.SessionOrderingKey"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionOrderingKey"; -} -::buffa::impl_default_view_instance!(SessionOrderingKeyView); -::buffa::impl_view_reborrow!(SessionOrderingKeyView); -/** Self-contained, `'static` owned view of a `SessionOrderingKey` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionOrderingKeyView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionOrderingKeyView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionOrderingKeyOwnedView( - ::buffa::OwnedView>, -); -impl SessionOrderingKeyOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionOrderingKeyOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionOrderingKeyOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionOrderingKey, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionOrderingKeyOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionOrderingKeyView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionOrderingKeyView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionOrderingKey { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The row's ordering value as of the scan's pinned watermark, not as of now. - /// - /// Recency ordering is the thing a session picker wants and is also mutable, a - /// combination that breaks naive pagination: a row that gains activity after - /// the cursor has passed its old position jumps ahead of the cursor and is - /// never delivered. Reading the ordering as of a fixed watermark is what - /// removes that skip, and it is an obligation on the list projection rather - /// than something this contract can assert by itself. - /// - /// Field 1: `ordering_value` - #[must_use] - pub fn ordering_value(&self) -> u64 { - self.0.reborrow().ordering_value - } - /// Field 2: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionOrderingKeyOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionOrderingKeyOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionOrderingKeyOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionOrderingKeyOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionOrderingKey { - type View<'a> = SessionOrderingKeyView<'a>; - type ViewHandle = SessionOrderingKeyOwnedView; -} -impl ::serde::Serialize for SessionOrderingKeyOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// CursorValidity is everything a cursor binds to besides its position. -/// -/// Each field answers one question: is the sequence this cursor was cut from -/// still the same sequence? A change in any of them means resuming would produce -/// a page sequence that never existed as a whole, so the server refuses with -/// QUERY_ERROR_CODE_STALE_CURSOR and the matching StaleCursorReason instead of -/// serving a plausible page. -#[derive(Clone, Debug, Default)] -pub struct CursorValidityView<'a> { - /// Identifies the projection instance. A rebuild under a new generation makes - /// ordering values from the old one meaningless. - /// Mismatch: STALE_CURSOR_REASON_PROJECTION_REPLACED. - /// - /// Field 1: `projection_generation` - pub projection_generation: &'a str, - /// The projection position the scan is pinned to. Constant across every page - /// of one scan. - /// - /// A pinned scan requires the projection to still be able to answer as of this - /// point, which is what cursor expiry bounds. - /// - /// Field 2: `pinned_watermark` - pub pinned_watermark: u64, - /// Bumped whenever the set of effective events changes shape: rewind, which - /// retracts history the scan may already have passed, and compaction, which - /// replaces a span with a summary. Either leaves a cursor describing a prefix - /// that no longer exists. - /// - /// Mismatch is STALE_CURSOR_REASON_REWOUND or STALE_CURSOR_REASON_COMPACTED - /// depending on which change advanced it, so the server must know the cause of - /// an advance and not only that one happened. The distinction matters to a - /// caller: a compaction lost nothing, a rewind did. - /// - /// Field 3: `effective_history_revision` - pub effective_history_revision: u64, - /// Bumped by redaction and artifact erasure. Tracked separately from - /// effective_history_revision because it is the field that must be checked - /// even when nothing else moved: continuing to serve a scan cut before an - /// erasure would keep handing out content that was ordered destroyed. - /// Mismatch: STALE_CURSOR_REASON_PRIVACY_CHANGED. - /// - /// Field 4: `privacy_revision` - pub privacy_revision: u64, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CursorValidityView<'a> { - /**Whether required field `projection_generation` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_projection_generation(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `pinned_watermark` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_pinned_watermark(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `effective_history_revision` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_effective_history_revision(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `privacy_revision` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_privacy_revision(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for CursorValidityView<'a> { - type Owned = super::super::CursorValidity; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.projection_generation = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.pinned_watermark = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.effective_history_revision = ::buffa::types::decode_uint64( - &mut cur, - )?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.privacy_revision = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CursorValidity { - projection_generation: self.projection_generation.to_string(), - pinned_watermark: self.pinned_watermark, - effective_history_revision: self.effective_history_revision, - privacy_revision: self.privacy_revision, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CursorValidityView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.projection_generation) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.pinned_watermark) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.effective_history_revision) - as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.privacy_revision) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.projection_generation, buf); - ::buffa::types::put_uint64_field(2u32, self.pinned_watermark, buf); - ::buffa::types::put_uint64_field(3u32, self.effective_history_revision, buf); - ::buffa::types::put_uint64_field(4u32, self.privacy_revision, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CursorValidityView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("projectionGeneration", self.projection_generation)?; - } - { - __map - .serialize_entry( - "pinnedWatermark", - &::buffa::json_helpers::ProtoJson(&self.pinned_watermark), - )?; - } - { - __map - .serialize_entry( - "effectiveHistoryRevision", - &::buffa::json_helpers::ProtoJson(&self.effective_history_revision), - )?; - } - { - __map - .serialize_entry( - "privacyRevision", - &::buffa::json_helpers::ProtoJson(&self.privacy_revision), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CursorValidityView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "CursorValidity"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.CursorValidity"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CursorValidity"; -} -::buffa::impl_default_view_instance!(CursorValidityView); -::buffa::impl_view_reborrow!(CursorValidityView); -/** Self-contained, `'static` owned view of a `CursorValidity` message. - - Wraps [`::buffa::OwnedView`]`<`[`CursorValidityView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CursorValidityView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CursorValidityOwnedView(::buffa::OwnedView>); -impl CursorValidityOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CursorValidityOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CursorValidityOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CursorValidity, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CursorValidityOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CursorValidityView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CursorValidityView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CursorValidity { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Identifies the projection instance. A rebuild under a new generation makes - /// ordering values from the old one meaningless. - /// Mismatch: STALE_CURSOR_REASON_PROJECTION_REPLACED. - /// - /// Field 1: `projection_generation` - #[must_use] - pub fn projection_generation(&self) -> &'_ str { - self.0.reborrow().projection_generation - } - /// The projection position the scan is pinned to. Constant across every page - /// of one scan. - /// - /// A pinned scan requires the projection to still be able to answer as of this - /// point, which is what cursor expiry bounds. - /// - /// Field 2: `pinned_watermark` - #[must_use] - pub fn pinned_watermark(&self) -> u64 { - self.0.reborrow().pinned_watermark - } - /// Bumped whenever the set of effective events changes shape: rewind, which - /// retracts history the scan may already have passed, and compaction, which - /// replaces a span with a summary. Either leaves a cursor describing a prefix - /// that no longer exists. - /// - /// Mismatch is STALE_CURSOR_REASON_REWOUND or STALE_CURSOR_REASON_COMPACTED - /// depending on which change advanced it, so the server must know the cause of - /// an advance and not only that one happened. The distinction matters to a - /// caller: a compaction lost nothing, a rewind did. - /// - /// Field 3: `effective_history_revision` - #[must_use] - pub fn effective_history_revision(&self) -> u64 { - self.0.reborrow().effective_history_revision - } - /// Bumped by redaction and artifact erasure. Tracked separately from - /// effective_history_revision because it is the field that must be checked - /// even when nothing else moved: continuing to serve a scan cut before an - /// erasure would keep handing out content that was ordered destroyed. - /// Mismatch: STALE_CURSOR_REASON_PRIVACY_CHANGED. - /// - /// Field 4: `privacy_revision` - #[must_use] - pub fn privacy_revision(&self) -> u64 { - self.0.reborrow().privacy_revision - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CursorValidityOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CursorValidityOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CursorValidityOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CursorValidityOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CursorValidity { - type View<'a> = CursorValidityView<'a>; - type ViewHandle = CursorValidityOwnedView; -} -impl ::serde::Serialize for CursorValidityOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.page_cursor.__view_oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.page_cursor.__view_oneof.rs deleted file mode 100644 index bddb792bd..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.page_cursor.__view_oneof.rs +++ /dev/null @@ -1,20 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/page_cursor.proto - -pub mod page_cursor { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Scan<'a> { - History( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::HistoryScanCursorView<'a>, - >, - ), - SessionList( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SessionListScanCursorView<'a>, - >, - ), - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.page_cursor.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.page_cursor.rs deleted file mode 100644 index 1e2aade9a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.page_cursor.rs +++ /dev/null @@ -1,1481 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/page_cursor.proto - -/// CursorEnvelope is what a `page_token` actually contains. -/// -/// These types are server-minted internals. They are published so the format is -/// reviewable and versioned, not so callers can read it: a client must treat a -/// token as opaque bytes and never construct, parse, or edit one. The server -/// owes nothing to a hand-built token beyond QUERY_ERROR_CODE_MALFORMED_CURSOR. -/// -/// The envelope keeps `payload` as bytes rather than an inline message on -/// purpose. `mac` authenticates the exact bytes the server emitted, and protobuf -/// serialization is not canonical, so a server that re-encoded a decoded message -/// to check the MAC could compute a different byte string than it signed. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CursorEnvelope { - /// Version of this envelope and payload format, independent of the query - /// ContractVersion. A token minted under an unknown format_version is - /// MALFORMED_CURSOR, not STALE_CURSOR: there is nothing to interpret. - /// - /// Field 1: `format_version` - #[serde( - rename = "formatVersion", - alias = "format_version", - with = "::buffa::json_helpers::uint32" - )] - pub format_version: u32, - /// Serialized PageCursor. - /// - /// Field 2: `payload` - #[serde(rename = "payload", with = "::buffa::json_helpers::bytes")] - pub payload: ::buffa::alloc::vec::Vec, - /// Authenticates format_version and payload under a server-held key. - /// - /// A cursor names a scan position, so an unauthenticated one is a request - /// parameter the caller controls. The MAC is what stops a caller from moving - /// the anchor, widening the selector, or pointing a scan at another session's - /// stream. It is tamper evidence and nothing more: a cursor is never - /// authorization, and every continuation is re-authorized from the caller's - /// own identity as if it were a fresh request. - /// - /// Field 3: `mac` - #[serde(rename = "mac", with = "::buffa::json_helpers::bytes")] - pub mac: ::buffa::alloc::vec::Vec, -} -impl ::core::fmt::Debug for CursorEnvelope { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CursorEnvelope") - .field("format_version", &self.format_version) - .field("payload", &self.payload) - .field("mac", &self.mac) - .finish() - } -} -impl CursorEnvelope { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CursorEnvelope"; -} -::buffa::impl_default_instance!(CursorEnvelope); -impl ::buffa::MessageName for CursorEnvelope { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "CursorEnvelope"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.CursorEnvelope"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CursorEnvelope"; -} -impl ::buffa::Message for CursorEnvelope { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.format_version) as u64; - size += 1u64 + ::buffa::types::bytes_encoded_len(&self.payload) as u64; - size += 1u64 + ::buffa::types::bytes_encoded_len(&self.mac) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.format_version, buf); - ::buffa::types::put_shared_bytes_field(2u32, &self.payload, buf); - ::buffa::types::put_shared_bytes_field(3u32, &self.mac, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.format_version = ::buffa::types::decode_uint32(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes(&mut self.payload, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes(&mut self.mac, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.format_version = 0u32; - self.payload.clear(); - self.mac.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CursorEnvelope { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CURSOR_ENVELOPE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CursorEnvelope", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// PageCursor is the decoded scan position. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct PageCursor { - /// When the token stops being honored regardless of validity. - /// - /// A pinned scan holds read-model retention (see CursorValidity), so scans - /// cannot be allowed to live forever. Expiry is STALE_CURSOR with - /// STALE_CURSOR_REASON_EXPIRED, because restarting the scan is the fix. - /// - /// Field 3: `expires_at` - #[serde(rename = "expiresAt", alias = "expires_at")] - pub expires_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - #[serde(flatten)] - pub scan: ::core::option::Option<__buffa::oneof::page_cursor::Scan>, -} -impl ::core::fmt::Debug for PageCursor { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("PageCursor") - .field("expires_at", &self.expires_at) - .field("scan", &self.scan) - .finish() - } -} -impl PageCursor { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.PageCursor"; -} -::buffa::impl_default_instance!(PageCursor); -impl ::buffa::MessageName for PageCursor { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "PageCursor"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.PageCursor"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.PageCursor"; -} -impl ::buffa::Message for PageCursor { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let ::core::option::Option::Some(ref v) = self.scan { - match v { - __buffa::oneof::page_cursor::Scan::History(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::page_cursor::Scan::SessionList(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - if self.expires_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.expires_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let ::core::option::Option::Some(ref v) = self.scan { - match v { - __buffa::oneof::page_cursor::Scan::History(x) => { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::page_cursor::Scan::SessionList(x) => { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - if self.expires_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.expires_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::page_cursor::Scan::History(ref mut existing), - ) = self.scan - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.scan = ::core::option::Option::Some( - __buffa::oneof::page_cursor::Scan::History( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::page_cursor::Scan::SessionList(ref mut existing), - ) = self.scan - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.scan = ::core::option::Option::Some( - __buffa::oneof::page_cursor::Scan::SessionList( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.expires_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.scan = ::core::option::Option::None; - self.expires_at = ::buffa::MessageField::none(); - } -} -impl<'de> serde::Deserialize<'de> for PageCursor { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = PageCursor; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct PageCursor") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __f_expires_at: ::core::option::Option< - ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - > = None; - let mut __oneof_scan: ::core::option::Option< - __buffa::oneof::page_cursor::Scan, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "expiresAt" | "expires_at" => { - __f_expires_at = Some( - map - .next_value::< - ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - >()?, - ); - } - "history" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - HistoryScanCursor, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_scan.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'scan'", - ), - ); - } - __oneof_scan = Some( - __buffa::oneof::page_cursor::Scan::History( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "sessionList" | "session_list" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SessionListScanCursor, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_scan.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'scan'", - ), - ); - } - __oneof_scan = Some( - __buffa::oneof::page_cursor::Scan::SessionList( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - if let ::core::option::Option::Some(v) = __f_expires_at { - __r.expires_at = v; - } - __r.scan = __oneof_scan; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for PageCursor { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PAGE_CURSOR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.PageCursor", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod page_cursor { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::page_cursor::Scan; - #[doc(inline)] - pub use super::__buffa::view::oneof::page_cursor::Scan as ScanView; -} -/// HistoryScanCursor is a position within one session's history. -/// -/// This is the message that makes the paging guarantee true. History is -/// append-only and every item carries a SessionOrdinal that is assigned once and -/// never renumbered, so a position expressed as an ordinal keeps its meaning as -/// the session grows. A position expressed as an offset from either end does -/// not, which is why the count of items is deliberately absent here. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct HistoryScanCursor { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Contract the scan was opened at. The server keeps rendering at this version - /// for the life of the scan so a page is not shaped differently from its - /// predecessors. A continuation presenting a different major is - /// STALE_CURSOR_REASON_CONTRACT_CHANGED. - /// - /// Field 2: `minted_contract` - #[serde(rename = "mintedContract", alias = "minted_contract")] - pub minted_contract: ::buffa::MessageField< - ContractVersion, - ::buffa::Inline, - >, - /// Fixed for the life of the scan. A continuation cannot reverse it; that is a - /// new scan. - /// - /// Field 3: `direction` - #[serde(rename = "direction", with = "::buffa::json_helpers::proto_enum")] - pub direction: ::buffa::EnumValue, - /// The effective-history head the scan was pinned to when it opened, as a - /// SessionOrdinal. - /// - /// The scan never looks past this, and that is what makes concurrent appends - /// harmless: a turn recorded after the scan opened is outside the window - /// rather than shifting rows inside it. A reverse scan walking toward older - /// history is unaffected by definition; a forward scan ends here even if newer - /// items exist by the time it arrives. - /// - /// Field 4: `anchor_ordinal` - #[serde( - rename = "anchorOrdinal", - alias = "anchor_ordinal", - with = "::buffa::json_helpers::uint64" - )] - pub anchor_ordinal: u64, - /// The last SessionOrdinal delivered. The next page resumes strictly past it - /// in `direction`, which is why an item can be neither repeated nor skipped: - /// the boundary is the identity of a delivered row, not a count of them. - /// - /// Field 5: `last_delivered_ordinal` - #[serde( - rename = "lastDeliveredOrdinal", - alias = "last_delivered_ordinal", - with = "::buffa::json_helpers::uint64" - )] - pub last_delivered_ordinal: u64, - /// Field 6: `validity` - #[serde(rename = "validity")] - pub validity: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for HistoryScanCursor { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("HistoryScanCursor") - .field("session_id", &self.session_id) - .field("minted_contract", &self.minted_contract) - .field("direction", &self.direction) - .field("anchor_ordinal", &self.anchor_ordinal) - .field("last_delivered_ordinal", &self.last_delivered_ordinal) - .field("validity", &self.validity) - .finish() - } -} -impl HistoryScanCursor { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.HistoryScanCursor"; -} -::buffa::impl_default_instance!(HistoryScanCursor); -impl ::buffa::MessageName for HistoryScanCursor { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "HistoryScanCursor"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.HistoryScanCursor"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.HistoryScanCursor"; -} -impl ::buffa::Message for HistoryScanCursor { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.minted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.minted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.direction.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.anchor_ordinal) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.last_delivered_ordinal) as u64; - if self.validity.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.validity.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.minted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.minted_contract.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.direction.to_i32(), buf); - ::buffa::types::put_uint64_field(4u32, self.anchor_ordinal, buf); - ::buffa::types::put_uint64_field(5u32, self.last_delivered_ordinal, buf); - if self.validity.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.validity.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.minted_contract.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.direction = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.anchor_ordinal = ::buffa::types::decode_uint64(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.last_delivered_ordinal = ::buffa::types::decode_uint64(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.validity.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.minted_contract = ::buffa::MessageField::none(); - self.direction = ::buffa::EnumValue::from(0); - self.anchor_ordinal = 0u64; - self.last_delivered_ordinal = 0u64; - self.validity = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for HistoryScanCursor { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __HISTORY_SCAN_CURSOR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.HistoryScanCursor", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// SessionListScanCursor is a position within a list scan. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionListScanCursor { - /// Field 1: `minted_contract` - #[serde(rename = "mintedContract", alias = "minted_contract")] - pub minted_contract: ::buffa::MessageField< - ContractVersion, - ::buffa::Inline, - >, - /// Field 2: `selector` - #[serde(rename = "selector")] - pub selector: ::buffa::MessageField< - ListScanSelector, - ::buffa::Inline, - >, - /// Last row delivered. The next page resumes strictly after it in the scan's - /// ordering. - /// - /// Field 3: `last_delivered` - #[serde(rename = "lastDelivered", alias = "last_delivered")] - pub last_delivered: ::buffa::MessageField< - SessionOrderingKey, - ::buffa::Inline, - >, - /// Field 4: `validity` - #[serde(rename = "validity")] - pub validity: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for SessionListScanCursor { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionListScanCursor") - .field("minted_contract", &self.minted_contract) - .field("selector", &self.selector) - .field("last_delivered", &self.last_delivered) - .field("validity", &self.validity) - .finish() - } -} -impl SessionListScanCursor { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionListScanCursor"; -} -::buffa::impl_default_instance!(SessionListScanCursor); -impl ::buffa::MessageName for SessionListScanCursor { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "SessionListScanCursor"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.SessionListScanCursor"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionListScanCursor"; -} -impl ::buffa::Message for SessionListScanCursor { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.minted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.minted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.selector.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.selector.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.last_delivered.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.last_delivered.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.validity.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.validity.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.minted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.minted_contract.write_to(__cache, buf); - } - if self.selector.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.selector.write_to(__cache, buf); - } - if self.last_delivered.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.last_delivered.write_to(__cache, buf); - } - if self.validity.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.validity.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.minted_contract.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.selector.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.last_delivered.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.validity.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.minted_contract = ::buffa::MessageField::none(); - self.selector = ::buffa::MessageField::none(); - self.last_delivered = ::buffa::MessageField::none(); - self.validity = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionListScanCursor { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_LIST_SCAN_CURSOR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionListScanCursor", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ListScanSelector is the request shape the scan was opened with. -/// -/// A continuation whose request disagrees with this is MALFORMED_CURSOR rather -/// than a silently re-scoped scan. Changing the scope, workspace, or archived -/// filter mid-scan produces a page sequence that is neither the old selection -/// nor the new one, and the caller has no way to notice. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ListScanSelector { - /// Field 1: `scope` - #[serde(rename = "scope", with = "::buffa::json_helpers::proto_enum")] - pub scope: ::buffa::EnumValue, - /// Field 2: `workspace_id` - #[serde( - rename = "workspaceId", - alias = "workspace_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub workspace_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 3: `archived` - #[serde(rename = "archived", with = "::buffa::json_helpers::proto_enum")] - pub archived: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for ListScanSelector { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ListScanSelector") - .field("scope", &self.scope) - .field("workspace_id", &self.workspace_id) - .field("archived", &self.archived) - .finish() - } -} -impl ListScanSelector { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ListScanSelector"; -} -impl ListScanSelector { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::workspace_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_workspace_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.workspace_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ListScanSelector); -impl ::buffa::MessageName for ListScanSelector { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ListScanSelector"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ListScanSelector"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ListScanSelector"; -} -impl ::buffa::Message for ListScanSelector { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.scope.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.workspace_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - { - let val = self.archived.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.scope.to_i32(), buf); - if let Some(ref v) = self.workspace_id { - ::buffa::types::put_string_field(2u32, v, buf); - } - ::buffa::types::put_int32_field(3u32, self.archived.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.scope = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .workspace_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.archived = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.scope = ::buffa::EnumValue::from(0); - self.workspace_id = ::core::option::Option::None; - self.archived = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ListScanSelector { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __LIST_SCAN_SELECTOR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ListScanSelector", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// SessionOrderingKey is one row's position in the list ordering. -/// -/// Ordering is by `ordering_value` descending, then `session_id` ascending. The -/// tie-breaker is not decoration: ordering values collide, and a boundary that -/// cannot distinguish two rows sharing one must either re-emit both or drop -/// both. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionOrderingKey { - /// The row's ordering value as of the scan's pinned watermark, not as of now. - /// - /// Recency ordering is the thing a session picker wants and is also mutable, a - /// combination that breaks naive pagination: a row that gains activity after - /// the cursor has passed its old position jumps ahead of the cursor and is - /// never delivered. Reading the ordering as of a fixed watermark is what - /// removes that skip, and it is an obligation on the list projection rather - /// than something this contract can assert by itself. - /// - /// Field 1: `ordering_value` - #[serde( - rename = "orderingValue", - alias = "ordering_value", - with = "::buffa::json_helpers::uint64" - )] - pub ordering_value: u64, - /// Field 2: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for SessionOrderingKey { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionOrderingKey") - .field("ordering_value", &self.ordering_value) - .field("session_id", &self.session_id) - .finish() - } -} -impl SessionOrderingKey { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionOrderingKey"; -} -::buffa::impl_default_instance!(SessionOrderingKey); -impl ::buffa::MessageName for SessionOrderingKey { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "SessionOrderingKey"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.SessionOrderingKey"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionOrderingKey"; -} -impl ::buffa::Message for SessionOrderingKey { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.ordering_value) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.ordering_value, buf); - ::buffa::types::put_string_field(2u32, &self.session_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.ordering_value = ::buffa::types::decode_uint64(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.ordering_value = 0u64; - self.session_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionOrderingKey { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_ORDERING_KEY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionOrderingKey", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// CursorValidity is everything a cursor binds to besides its position. -/// -/// Each field answers one question: is the sequence this cursor was cut from -/// still the same sequence? A change in any of them means resuming would produce -/// a page sequence that never existed as a whole, so the server refuses with -/// QUERY_ERROR_CODE_STALE_CURSOR and the matching StaleCursorReason instead of -/// serving a plausible page. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CursorValidity { - /// Identifies the projection instance. A rebuild under a new generation makes - /// ordering values from the old one meaningless. - /// Mismatch: STALE_CURSOR_REASON_PROJECTION_REPLACED. - /// - /// Field 1: `projection_generation` - #[serde( - rename = "projectionGeneration", - alias = "projection_generation", - with = "::buffa::json_helpers::proto_string" - )] - pub projection_generation: ::buffa::alloc::string::String, - /// The projection position the scan is pinned to. Constant across every page - /// of one scan. - /// - /// A pinned scan requires the projection to still be able to answer as of this - /// point, which is what cursor expiry bounds. - /// - /// Field 2: `pinned_watermark` - #[serde( - rename = "pinnedWatermark", - alias = "pinned_watermark", - with = "::buffa::json_helpers::uint64" - )] - pub pinned_watermark: u64, - /// Bumped whenever the set of effective events changes shape: rewind, which - /// retracts history the scan may already have passed, and compaction, which - /// replaces a span with a summary. Either leaves a cursor describing a prefix - /// that no longer exists. - /// - /// Mismatch is STALE_CURSOR_REASON_REWOUND or STALE_CURSOR_REASON_COMPACTED - /// depending on which change advanced it, so the server must know the cause of - /// an advance and not only that one happened. The distinction matters to a - /// caller: a compaction lost nothing, a rewind did. - /// - /// Field 3: `effective_history_revision` - #[serde( - rename = "effectiveHistoryRevision", - alias = "effective_history_revision", - with = "::buffa::json_helpers::uint64" - )] - pub effective_history_revision: u64, - /// Bumped by redaction and artifact erasure. Tracked separately from - /// effective_history_revision because it is the field that must be checked - /// even when nothing else moved: continuing to serve a scan cut before an - /// erasure would keep handing out content that was ordered destroyed. - /// Mismatch: STALE_CURSOR_REASON_PRIVACY_CHANGED. - /// - /// Field 4: `privacy_revision` - #[serde( - rename = "privacyRevision", - alias = "privacy_revision", - with = "::buffa::json_helpers::uint64" - )] - pub privacy_revision: u64, -} -impl ::core::fmt::Debug for CursorValidity { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CursorValidity") - .field("projection_generation", &self.projection_generation) - .field("pinned_watermark", &self.pinned_watermark) - .field("effective_history_revision", &self.effective_history_revision) - .field("privacy_revision", &self.privacy_revision) - .finish() - } -} -impl CursorValidity { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CursorValidity"; -} -::buffa::impl_default_instance!(CursorValidity); -impl ::buffa::MessageName for CursorValidity { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "CursorValidity"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.CursorValidity"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CursorValidity"; -} -impl ::buffa::Message for CursorValidity { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.projection_generation) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.pinned_watermark) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.effective_history_revision) - as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.privacy_revision) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.projection_generation, buf); - ::buffa::types::put_uint64_field(2u32, self.pinned_watermark, buf); - ::buffa::types::put_uint64_field(3u32, self.effective_history_revision, buf); - ::buffa::types::put_uint64_field(4u32, self.privacy_revision, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.projection_generation, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.pinned_watermark = ::buffa::types::decode_uint64(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.effective_history_revision = ::buffa::types::decode_uint64(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.privacy_revision = ::buffa::types::decode_uint64(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.projection_generation.clear(); - self.pinned_watermark = 0u64; - self.effective_history_revision = 0u64; - self.privacy_revision = 0u64; - } -} -impl ::buffa::json_helpers::ProtoElemJson for CursorValidity { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CURSOR_VALIDITY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CursorValidity", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.presentation_cache.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.presentation_cache.__view.rs deleted file mode 100644 index a02fdc0b2..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.presentation_cache.__view.rs +++ /dev/null @@ -1,1484 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/presentation_cache.proto - -/// PresentationCacheBinding is the projection state a client-side cache was -/// rendered against. -/// -/// A client that reopens a session wants to paint the timeline before the first -/// query returns. The cached copy is only safe to paint if the projection it -/// came from still exists and still says the same things. This message is what -/// the cache stores alongside its rendered content so that question has an -/// answer other than a guess about elapsed time. -/// -/// The four projection coordinates are the same four a page cursor pins in -/// `CursorValidity`, because the events that invalidate a cursor and the events -/// that invalidate a cache are the same events. They are separate messages -/// rather than one shared one because they are checked by different parties: a -/// cursor is minted by the server, opaque to the client, and validated by the -/// server on the next page; a binding is held by the client, readable by the -/// client, and checked before anything is painted. Sharing the type would make -/// a change made for one validator's benefit land on the other's. -/// -/// Nothing here describes the rendering itself. Terminal width, scroll position, -/// theme, and ANSI handling are the client's state and stay in the client: the -/// Session event log records what happened, not what a viewer looked like while -/// watching it, and a projection that stored presentation state would be one -/// that has to be rebuilt every time a renderer changes. -#[derive(Clone, Debug, Default)] -pub struct PresentationCacheBindingView<'a> { - /// The projection instance that produced the cached content. A projection - /// rebuild mints a new generation, and content from the old one is not a - /// stale version of the new one, it is output from a different computation. - /// - /// Field 1: `projection_generation` - pub projection_generation: &'a str, - /// Stream position the projection had applied through when it rendered this. - /// - /// Field 2: `processed_watermark` - pub processed_watermark: u64, - /// Revision of the session's effective history, bumped by rewind and by - /// compaction. - /// - /// This is the field that makes "my cache is just older" checkable rather than - /// assumed. A cache at a lower watermark is a safe prefix of the current view - /// only when history is append-only between the two positions. Rewind and - /// compaction retract content that was there, so after either one a lower - /// watermark is not a prefix of a higher one and the cache is wrong rather - /// than incomplete. - /// - /// Field 3: `effective_history_revision` - pub effective_history_revision: u64, - /// Revision of the session's privacy state, bumped by redaction and by - /// artifact erasure. - /// - /// Tracked apart from history because it is the one that must be checked even - /// when nothing else moved, and because getting it wrong is not a staleness - /// annoyance. A cache painted after a redaction shows content someone - /// deliberately destroyed, on a screen, to a person, which is the failure the - /// redaction was performed to prevent. - /// - /// Field 4: `privacy_revision` - pub privacy_revision: u64, - /// Query contract version the cached content was rendered at. A cache built - /// from a response the current contract would render differently is not - /// reusable even when every projection coordinate still matches. - /// - /// Field 5: `contract_version` - pub contract_version: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'a>, - >, - /// Opaque identifier for the client-side rendering code that produced the - /// cached content. - /// - /// The server never interprets it and never compares it. It is carried so a - /// client that ships a new renderer can discard its own caches without the - /// server having to know anything about renderers, which is the arrangement - /// that keeps rendering changes from being a server deployment. - /// - /// Field 6: `renderer_version` - pub renderer_version: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> PresentationCacheBindingView<'a> { - /**Whether required field `projection_generation` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_projection_generation(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `processed_watermark` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_processed_watermark(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `effective_history_revision` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_effective_history_revision(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `privacy_revision` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_privacy_revision(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `contract_version` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_contract_version(&self) -> bool { - self.contract_version.is_set() - } - /**Whether required field `renderer_version` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_renderer_version(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for PresentationCacheBindingView<'a> { - type Owned = super::super::PresentationCacheBinding; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.projection_generation = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.processed_watermark = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.effective_history_revision = ::buffa::types::decode_uint64( - &mut cur, - )?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.privacy_revision = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.contract_version.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.contract_version = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.renderer_version = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::PresentationCacheBinding, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::PresentationCacheBinding, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::PresentationCacheBinding { - projection_generation: self.projection_generation.to_string(), - processed_watermark: self.processed_watermark, - effective_history_revision: self.effective_history_revision, - privacy_revision: self.privacy_revision, - contract_version: match self.contract_version.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractVersion, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - renderer_version: self.renderer_version.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for PresentationCacheBindingView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.projection_generation) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.processed_watermark) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.effective_history_revision) - as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.privacy_revision) as u64; - if self.contract_version.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.contract_version.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.renderer_version) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.projection_generation, buf); - ::buffa::types::put_uint64_field(2u32, self.processed_watermark, buf); - ::buffa::types::put_uint64_field(3u32, self.effective_history_revision, buf); - ::buffa::types::put_uint64_field(4u32, self.privacy_revision, buf); - if self.contract_version.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.contract_version.write_to(__cache, buf); - } - ::buffa::types::put_string_field(6u32, &self.renderer_version, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for PresentationCacheBindingView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("projectionGeneration", self.projection_generation)?; - } - { - __map - .serialize_entry( - "processedWatermark", - &::buffa::json_helpers::ProtoJson(&self.processed_watermark), - )?; - } - { - __map - .serialize_entry( - "effectiveHistoryRevision", - &::buffa::json_helpers::ProtoJson(&self.effective_history_revision), - )?; - } - { - __map - .serialize_entry( - "privacyRevision", - &::buffa::json_helpers::ProtoJson(&self.privacy_revision), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.contract_version.as_option() - { - __map.serialize_entry("contractVersion", __v)?; - } - } - { - __map.serialize_entry("rendererVersion", self.renderer_version)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for PresentationCacheBindingView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "PresentationCacheBinding"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.PresentationCacheBinding"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.PresentationCacheBinding"; -} -::buffa::impl_default_view_instance!(PresentationCacheBindingView); -::buffa::impl_view_reborrow!(PresentationCacheBindingView); -/** Self-contained, `'static` owned view of a `PresentationCacheBinding` message. - - Wraps [`::buffa::OwnedView`]`<`[`PresentationCacheBindingView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`PresentationCacheBindingView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct PresentationCacheBindingOwnedView( - ::buffa::OwnedView>, -); -impl PresentationCacheBindingOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - PresentationCacheBindingOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - PresentationCacheBindingOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::PresentationCacheBinding, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - PresentationCacheBindingOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`PresentationCacheBindingView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &PresentationCacheBindingView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::PresentationCacheBinding { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The projection instance that produced the cached content. A projection - /// rebuild mints a new generation, and content from the old one is not a - /// stale version of the new one, it is output from a different computation. - /// - /// Field 1: `projection_generation` - #[must_use] - pub fn projection_generation(&self) -> &'_ str { - self.0.reborrow().projection_generation - } - /// Stream position the projection had applied through when it rendered this. - /// - /// Field 2: `processed_watermark` - #[must_use] - pub fn processed_watermark(&self) -> u64 { - self.0.reborrow().processed_watermark - } - /// Revision of the session's effective history, bumped by rewind and by - /// compaction. - /// - /// This is the field that makes "my cache is just older" checkable rather than - /// assumed. A cache at a lower watermark is a safe prefix of the current view - /// only when history is append-only between the two positions. Rewind and - /// compaction retract content that was there, so after either one a lower - /// watermark is not a prefix of a higher one and the cache is wrong rather - /// than incomplete. - /// - /// Field 3: `effective_history_revision` - #[must_use] - pub fn effective_history_revision(&self) -> u64 { - self.0.reborrow().effective_history_revision - } - /// Revision of the session's privacy state, bumped by redaction and by - /// artifact erasure. - /// - /// Tracked apart from history because it is the one that must be checked even - /// when nothing else moved, and because getting it wrong is not a staleness - /// annoyance. A cache painted after a redaction shows content someone - /// deliberately destroyed, on a screen, to a person, which is the failure the - /// redaction was performed to prevent. - /// - /// Field 4: `privacy_revision` - #[must_use] - pub fn privacy_revision(&self) -> u64 { - self.0.reborrow().privacy_revision - } - /// Query contract version the cached content was rendered at. A cache built - /// from a response the current contract would render differently is not - /// reusable even when every projection coordinate still matches. - /// - /// Field 5: `contract_version` - #[must_use] - pub fn contract_version( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'_>, - > { - &self.0.reborrow().contract_version - } - /// Opaque identifier for the client-side rendering code that produced the - /// cached content. - /// - /// The server never interprets it and never compares it. It is carried so a - /// client that ships a new renderer can discard its own caches without the - /// server having to know anything about renderers, which is the arrangement - /// that keeps rendering changes from being a server deployment. - /// - /// Field 6: `renderer_version` - #[must_use] - pub fn renderer_version(&self) -> &'_ str { - self.0.reborrow().renderer_version - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for PresentationCacheBindingOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - PresentationCacheBindingOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: PresentationCacheBindingOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for PresentationCacheBindingOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::PresentationCacheBinding { - type View<'a> = PresentationCacheBindingView<'a>; - type ViewHandle = PresentationCacheBindingOwnedView; -} -impl ::serde::Serialize for PresentationCacheBindingOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// CheckPresentationCacheRequest asks whether a held cache may still be shown. -/// -/// It is deliberately not a read. A caller that wanted the content would call -/// GetSessionHistory; this exists for the caller that already has content and -/// needs a verdict cheaper than fetching it again. There is no field here that -/// could make it return timeline data, so it cannot quietly become the -/// expensive path it was added to avoid. -#[derive(Clone, Debug, Default)] -pub struct CheckPresentationCacheRequestView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `accepted_contract` - pub accepted_contract: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'a>, - >, - /// What the held cache was rendered against. - /// - /// Field 3: `binding` - pub binding: ::buffa::MessageFieldView< - super::super::__buffa::view::PresentationCacheBindingView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CheckPresentationCacheRequestView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `accepted_contract` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_accepted_contract(&self) -> bool { - self.accepted_contract.is_set() - } - /**Whether required field `binding` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_binding(&self) -> bool { - self.binding.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for CheckPresentationCacheRequestView<'a> { - type Owned = super::super::CheckPresentationCacheRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.accepted_contract.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.accepted_contract = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.binding.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.binding = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::CheckPresentationCacheRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::CheckPresentationCacheRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CheckPresentationCacheRequest { - session_id: self.session_id.to_string(), - accepted_contract: match self.accepted_contract.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractVersion, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - binding: match self.binding.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::PresentationCacheBinding, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CheckPresentationCacheRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.accepted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.accepted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.binding.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.binding.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.accepted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.accepted_contract.write_to(__cache, buf); - } - if self.binding.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.binding.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CheckPresentationCacheRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.accepted_contract.as_option() - { - __map.serialize_entry("acceptedContract", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.binding.as_option() { - __map.serialize_entry("binding", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CheckPresentationCacheRequestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "CheckPresentationCacheRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.CheckPresentationCacheRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CheckPresentationCacheRequest"; -} -::buffa::impl_default_view_instance!(CheckPresentationCacheRequestView); -::buffa::impl_view_reborrow!(CheckPresentationCacheRequestView); -/** Self-contained, `'static` owned view of a `CheckPresentationCacheRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`CheckPresentationCacheRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CheckPresentationCacheRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CheckPresentationCacheRequestOwnedView( - ::buffa::OwnedView>, -); -impl CheckPresentationCacheRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckPresentationCacheRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckPresentationCacheRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CheckPresentationCacheRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckPresentationCacheRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CheckPresentationCacheRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CheckPresentationCacheRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CheckPresentationCacheRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `accepted_contract` - #[must_use] - pub fn accepted_contract( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'_>, - > { - &self.0.reborrow().accepted_contract - } - /// What the held cache was rendered against. - /// - /// Field 3: `binding` - #[must_use] - pub fn binding( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::PresentationCacheBindingView<'_>, - > { - &self.0.reborrow().binding - } -} -impl ::core::convert::From< - ::buffa::OwnedView>, -> for CheckPresentationCacheRequestOwnedView { - fn from( - inner: ::buffa::OwnedView>, - ) -> Self { - CheckPresentationCacheRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CheckPresentationCacheRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef< - ::buffa::OwnedView>, -> for CheckPresentationCacheRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CheckPresentationCacheRequest { - type View<'a> = CheckPresentationCacheRequestView<'a>; - type ViewHandle = CheckPresentationCacheRequestOwnedView; -} -impl ::serde::Serialize for CheckPresentationCacheRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// CheckPresentationCacheResponse is the verdict on a held cache. -#[derive(Clone, Debug, Default)] -pub struct CheckPresentationCacheResponseView<'a> { - /// Field 1: `contract` - pub contract: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractNegotiationView<'a>, - >, - /// Field 2: `usability` - pub usability: ::buffa::EnumValue, - /// What a cache rendered now would be bound to. - /// - /// Present on every verdict, including a discard, so a client that is about to - /// refetch knows what to bind the replacement to without a second round trip. - /// - /// Field 3: `current` - pub current: ::buffa::MessageFieldView< - super::super::__buffa::view::PresentationCacheBindingView<'a>, - >, - /// How current the projection that answered was. A usable verdict from a - /// lagging projection is a verdict about a lagging view, and the caller is - /// owed that distinction. - /// - /// Field 4: `freshness` - pub freshness: ::buffa::MessageFieldView< - super::super::__buffa::view::ProjectionFreshnessView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CheckPresentationCacheResponseView<'a> { - /**Whether required field `contract` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_contract(&self) -> bool { - self.contract.is_set() - } - /**Whether required field `usability` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_usability(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `current` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_current(&self) -> bool { - self.current.is_set() - } - /**Whether required field `freshness` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_freshness(&self) -> bool { - self.freshness.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for CheckPresentationCacheResponseView<'a> { - type Owned = super::super::CheckPresentationCacheResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.contract.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.contract = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.usability = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.current.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.current = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.freshness.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.freshness = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::CheckPresentationCacheResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::CheckPresentationCacheResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CheckPresentationCacheResponse { - contract: match self.contract.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractNegotiation, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - usability: self.usability, - current: match self.current.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::PresentationCacheBinding, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - freshness: match self.freshness.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ProjectionFreshness, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CheckPresentationCacheResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.usability.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.current.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.current.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.freshness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.freshness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.contract.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(2u32, self.usability.to_i32(), buf); - if self.current.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.current.write_to(__cache, buf); - } - if self.freshness.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.freshness.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CheckPresentationCacheResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.contract.as_option() { - __map.serialize_entry("contract", __v)?; - } - } - { - __map.serialize_entry("usability", &self.usability)?; - } - { - if let ::core::option::Option::Some(__v) = self.current.as_option() { - __map.serialize_entry("current", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.freshness.as_option() { - __map.serialize_entry("freshness", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CheckPresentationCacheResponseView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "CheckPresentationCacheResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.CheckPresentationCacheResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CheckPresentationCacheResponse"; -} -::buffa::impl_default_view_instance!(CheckPresentationCacheResponseView); -::buffa::impl_view_reborrow!(CheckPresentationCacheResponseView); -/** Self-contained, `'static` owned view of a `CheckPresentationCacheResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`CheckPresentationCacheResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CheckPresentationCacheResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CheckPresentationCacheResponseOwnedView( - ::buffa::OwnedView>, -); -impl CheckPresentationCacheResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckPresentationCacheResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckPresentationCacheResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CheckPresentationCacheResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckPresentationCacheResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CheckPresentationCacheResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CheckPresentationCacheResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CheckPresentationCacheResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `contract` - #[must_use] - pub fn contract( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractNegotiationView<'_>, - > { - &self.0.reborrow().contract - } - /// Field 2: `usability` - #[must_use] - pub fn usability(&self) -> ::buffa::EnumValue { - self.0.reborrow().usability - } - /// What a cache rendered now would be bound to. - /// - /// Present on every verdict, including a discard, so a client that is about to - /// refetch knows what to bind the replacement to without a second round trip. - /// - /// Field 3: `current` - #[must_use] - pub fn current( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::PresentationCacheBindingView<'_>, - > { - &self.0.reborrow().current - } - /// How current the projection that answered was. A usable verdict from a - /// lagging projection is a verdict about a lagging view, and the caller is - /// owed that distinction. - /// - /// Field 4: `freshness` - #[must_use] - pub fn freshness( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ProjectionFreshnessView<'_>, - > { - &self.0.reborrow().freshness - } -} -impl ::core::convert::From< - ::buffa::OwnedView>, -> for CheckPresentationCacheResponseOwnedView { - fn from( - inner: ::buffa::OwnedView>, - ) -> Self { - CheckPresentationCacheResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CheckPresentationCacheResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef< - ::buffa::OwnedView>, -> for CheckPresentationCacheResponseOwnedView { - fn as_ref( - &self, - ) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CheckPresentationCacheResponse { - type View<'a> = CheckPresentationCacheResponseView<'a>; - type ViewHandle = CheckPresentationCacheResponseOwnedView; -} -impl ::serde::Serialize for CheckPresentationCacheResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.presentation_cache.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.presentation_cache.rs deleted file mode 100644 index 96d296243..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.presentation_cache.rs +++ /dev/null @@ -1,913 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/presentation_cache.proto - -/// CacheUsability is what a client may do with the cache it holds. -/// -/// The values are ordered by how much of the cache survives, and the zero value -/// is the one that discards, so a client that reads a variant it does not know -/// falls back to fetching rather than to painting. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum CacheUsability { - /// Unknown verdict. Treat as DISCARD. - CACHE_USABILITY_UNSPECIFIED = 0i32, - /// Every coordinate matches. The cache is the current view and may be painted - /// as final. - CACHE_USABILITY_CURRENT = 1i32, - /// The cache is a strict prefix: same generation, same history revision, same - /// privacy revision, lower watermark. - /// - /// It may be painted immediately and then extended by reading forward from - /// `binding.processed_watermark`. This is the only variant that lets a client - /// show something before its first query returns, and it is gated on the - /// revisions rather than on the watermark, because a lower watermark alone - /// does not establish that the interval between them only added. - CACHE_USABILITY_APPENDABLE = 2i32, - /// Content the cache holds no longer exists, because a rewind, a compaction, a - /// redaction, or an artifact erasure removed it. - /// - /// Distinct from REPLACED because the projection is fine; the history changed - /// underneath it. Distinct from STALE because there is no safe subset: the - /// client cannot know which of its rows were the retracted ones, so it - /// discards all of them. - CACHE_USABILITY_RETRACTED = 3i32, - /// The projection generation differs. The cache came from a computation that - /// no longer runs, so it is not old output, it is foreign output. - CACHE_USABILITY_REPLACED = 4i32, - /// The contract major or the renderer version differs from what a fresh render - /// would use. The content may still be accurate and is still not reusable. - CACHE_USABILITY_INCOMPATIBLE = 5i32, - /// The server could not decide, because its own projection state is unknown to - /// it. Reported rather than resolved to DISCARD so a client can tell a cache - /// that was rejected from a cache that was never judged, and so a degraded - /// server does not silently trigger a refetch storm it cannot serve. - CACHE_USABILITY_INDETERMINATE = 6i32, -} -impl CacheUsability { - ///Idiomatic alias for [`Self::CACHE_USABILITY_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::CACHE_USABILITY_UNSPECIFIED; - ///Idiomatic alias for [`Self::CACHE_USABILITY_CURRENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Current: Self = Self::CACHE_USABILITY_CURRENT; - ///Idiomatic alias for [`Self::CACHE_USABILITY_APPENDABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Appendable: Self = Self::CACHE_USABILITY_APPENDABLE; - ///Idiomatic alias for [`Self::CACHE_USABILITY_RETRACTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Retracted: Self = Self::CACHE_USABILITY_RETRACTED; - ///Idiomatic alias for [`Self::CACHE_USABILITY_REPLACED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Replaced: Self = Self::CACHE_USABILITY_REPLACED; - ///Idiomatic alias for [`Self::CACHE_USABILITY_INCOMPATIBLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Incompatible: Self = Self::CACHE_USABILITY_INCOMPATIBLE; - ///Idiomatic alias for [`Self::CACHE_USABILITY_INDETERMINATE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Indeterminate: Self = Self::CACHE_USABILITY_INDETERMINATE; -} -impl ::core::default::Default for CacheUsability { - fn default() -> Self { - Self::CACHE_USABILITY_UNSPECIFIED - } -} -impl ::serde::Serialize for CacheUsability { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for CacheUsability { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = CacheUsability; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(CacheUsability) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for CacheUsability { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for CacheUsability { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::CACHE_USABILITY_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::CACHE_USABILITY_CURRENT), - 2i32 => ::core::option::Option::Some(Self::CACHE_USABILITY_APPENDABLE), - 3i32 => ::core::option::Option::Some(Self::CACHE_USABILITY_RETRACTED), - 4i32 => ::core::option::Option::Some(Self::CACHE_USABILITY_REPLACED), - 5i32 => ::core::option::Option::Some(Self::CACHE_USABILITY_INCOMPATIBLE), - 6i32 => ::core::option::Option::Some(Self::CACHE_USABILITY_INDETERMINATE), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::CACHE_USABILITY_UNSPECIFIED => "CACHE_USABILITY_UNSPECIFIED", - Self::CACHE_USABILITY_CURRENT => "CACHE_USABILITY_CURRENT", - Self::CACHE_USABILITY_APPENDABLE => "CACHE_USABILITY_APPENDABLE", - Self::CACHE_USABILITY_RETRACTED => "CACHE_USABILITY_RETRACTED", - Self::CACHE_USABILITY_REPLACED => "CACHE_USABILITY_REPLACED", - Self::CACHE_USABILITY_INCOMPATIBLE => "CACHE_USABILITY_INCOMPATIBLE", - Self::CACHE_USABILITY_INDETERMINATE => "CACHE_USABILITY_INDETERMINATE", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "CACHE_USABILITY_UNSPECIFIED" => { - ::core::option::Option::Some(Self::CACHE_USABILITY_UNSPECIFIED) - } - "CACHE_USABILITY_CURRENT" => { - ::core::option::Option::Some(Self::CACHE_USABILITY_CURRENT) - } - "CACHE_USABILITY_APPENDABLE" => { - ::core::option::Option::Some(Self::CACHE_USABILITY_APPENDABLE) - } - "CACHE_USABILITY_RETRACTED" => { - ::core::option::Option::Some(Self::CACHE_USABILITY_RETRACTED) - } - "CACHE_USABILITY_REPLACED" => { - ::core::option::Option::Some(Self::CACHE_USABILITY_REPLACED) - } - "CACHE_USABILITY_INCOMPATIBLE" => { - ::core::option::Option::Some(Self::CACHE_USABILITY_INCOMPATIBLE) - } - "CACHE_USABILITY_INDETERMINATE" => { - ::core::option::Option::Some(Self::CACHE_USABILITY_INDETERMINATE) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::CACHE_USABILITY_UNSPECIFIED, - Self::CACHE_USABILITY_CURRENT, - Self::CACHE_USABILITY_APPENDABLE, - Self::CACHE_USABILITY_RETRACTED, - Self::CACHE_USABILITY_REPLACED, - Self::CACHE_USABILITY_INCOMPATIBLE, - Self::CACHE_USABILITY_INDETERMINATE, - ] - } -} -/// PresentationCacheBinding is the projection state a client-side cache was -/// rendered against. -/// -/// A client that reopens a session wants to paint the timeline before the first -/// query returns. The cached copy is only safe to paint if the projection it -/// came from still exists and still says the same things. This message is what -/// the cache stores alongside its rendered content so that question has an -/// answer other than a guess about elapsed time. -/// -/// The four projection coordinates are the same four a page cursor pins in -/// `CursorValidity`, because the events that invalidate a cursor and the events -/// that invalidate a cache are the same events. They are separate messages -/// rather than one shared one because they are checked by different parties: a -/// cursor is minted by the server, opaque to the client, and validated by the -/// server on the next page; a binding is held by the client, readable by the -/// client, and checked before anything is painted. Sharing the type would make -/// a change made for one validator's benefit land on the other's. -/// -/// Nothing here describes the rendering itself. Terminal width, scroll position, -/// theme, and ANSI handling are the client's state and stay in the client: the -/// Session event log records what happened, not what a viewer looked like while -/// watching it, and a projection that stored presentation state would be one -/// that has to be rebuilt every time a renderer changes. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct PresentationCacheBinding { - /// The projection instance that produced the cached content. A projection - /// rebuild mints a new generation, and content from the old one is not a - /// stale version of the new one, it is output from a different computation. - /// - /// Field 1: `projection_generation` - #[serde( - rename = "projectionGeneration", - alias = "projection_generation", - with = "::buffa::json_helpers::proto_string" - )] - pub projection_generation: ::buffa::alloc::string::String, - /// Stream position the projection had applied through when it rendered this. - /// - /// Field 2: `processed_watermark` - #[serde( - rename = "processedWatermark", - alias = "processed_watermark", - with = "::buffa::json_helpers::uint64" - )] - pub processed_watermark: u64, - /// Revision of the session's effective history, bumped by rewind and by - /// compaction. - /// - /// This is the field that makes "my cache is just older" checkable rather than - /// assumed. A cache at a lower watermark is a safe prefix of the current view - /// only when history is append-only between the two positions. Rewind and - /// compaction retract content that was there, so after either one a lower - /// watermark is not a prefix of a higher one and the cache is wrong rather - /// than incomplete. - /// - /// Field 3: `effective_history_revision` - #[serde( - rename = "effectiveHistoryRevision", - alias = "effective_history_revision", - with = "::buffa::json_helpers::uint64" - )] - pub effective_history_revision: u64, - /// Revision of the session's privacy state, bumped by redaction and by - /// artifact erasure. - /// - /// Tracked apart from history because it is the one that must be checked even - /// when nothing else moved, and because getting it wrong is not a staleness - /// annoyance. A cache painted after a redaction shows content someone - /// deliberately destroyed, on a screen, to a person, which is the failure the - /// redaction was performed to prevent. - /// - /// Field 4: `privacy_revision` - #[serde( - rename = "privacyRevision", - alias = "privacy_revision", - with = "::buffa::json_helpers::uint64" - )] - pub privacy_revision: u64, - /// Query contract version the cached content was rendered at. A cache built - /// from a response the current contract would render differently is not - /// reusable even when every projection coordinate still matches. - /// - /// Field 5: `contract_version` - #[serde(rename = "contractVersion", alias = "contract_version")] - pub contract_version: ::buffa::MessageField< - ContractVersion, - ::buffa::Inline, - >, - /// Opaque identifier for the client-side rendering code that produced the - /// cached content. - /// - /// The server never interprets it and never compares it. It is carried so a - /// client that ships a new renderer can discard its own caches without the - /// server having to know anything about renderers, which is the arrangement - /// that keeps rendering changes from being a server deployment. - /// - /// Field 6: `renderer_version` - #[serde( - rename = "rendererVersion", - alias = "renderer_version", - with = "::buffa::json_helpers::proto_string" - )] - pub renderer_version: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for PresentationCacheBinding { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("PresentationCacheBinding") - .field("projection_generation", &self.projection_generation) - .field("processed_watermark", &self.processed_watermark) - .field("effective_history_revision", &self.effective_history_revision) - .field("privacy_revision", &self.privacy_revision) - .field("contract_version", &self.contract_version) - .field("renderer_version", &self.renderer_version) - .finish() - } -} -impl PresentationCacheBinding { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.PresentationCacheBinding"; -} -::buffa::impl_default_instance!(PresentationCacheBinding); -impl ::buffa::MessageName for PresentationCacheBinding { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "PresentationCacheBinding"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.PresentationCacheBinding"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.PresentationCacheBinding"; -} -impl ::buffa::Message for PresentationCacheBinding { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.projection_generation) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.processed_watermark) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.effective_history_revision) - as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.privacy_revision) as u64; - if self.contract_version.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.contract_version.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.renderer_version) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.projection_generation, buf); - ::buffa::types::put_uint64_field(2u32, self.processed_watermark, buf); - ::buffa::types::put_uint64_field(3u32, self.effective_history_revision, buf); - ::buffa::types::put_uint64_field(4u32, self.privacy_revision, buf); - if self.contract_version.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.contract_version.write_to(__cache, buf); - } - ::buffa::types::put_string_field(6u32, &self.renderer_version, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.projection_generation, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.processed_watermark = ::buffa::types::decode_uint64(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.effective_history_revision = ::buffa::types::decode_uint64(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.privacy_revision = ::buffa::types::decode_uint64(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.contract_version.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.renderer_version, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.projection_generation.clear(); - self.processed_watermark = 0u64; - self.effective_history_revision = 0u64; - self.privacy_revision = 0u64; - self.contract_version = ::buffa::MessageField::none(); - self.renderer_version.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for PresentationCacheBinding { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PRESENTATION_CACHE_BINDING_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.PresentationCacheBinding", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// CheckPresentationCacheRequest asks whether a held cache may still be shown. -/// -/// It is deliberately not a read. A caller that wanted the content would call -/// GetSessionHistory; this exists for the caller that already has content and -/// needs a verdict cheaper than fetching it again. There is no field here that -/// could make it return timeline data, so it cannot quietly become the -/// expensive path it was added to avoid. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CheckPresentationCacheRequest { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `accepted_contract` - #[serde(rename = "acceptedContract", alias = "accepted_contract")] - pub accepted_contract: ::buffa::MessageField< - ContractVersion, - ::buffa::Inline, - >, - /// What the held cache was rendered against. - /// - /// Field 3: `binding` - #[serde(rename = "binding")] - pub binding: ::buffa::MessageField< - PresentationCacheBinding, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for CheckPresentationCacheRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CheckPresentationCacheRequest") - .field("session_id", &self.session_id) - .field("accepted_contract", &self.accepted_contract) - .field("binding", &self.binding) - .finish() - } -} -impl CheckPresentationCacheRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CheckPresentationCacheRequest"; -} -::buffa::impl_default_instance!(CheckPresentationCacheRequest); -impl ::buffa::MessageName for CheckPresentationCacheRequest { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "CheckPresentationCacheRequest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.CheckPresentationCacheRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CheckPresentationCacheRequest"; -} -impl ::buffa::Message for CheckPresentationCacheRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.accepted_contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.accepted_contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.binding.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.binding.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.accepted_contract.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.accepted_contract.write_to(__cache, buf); - } - if self.binding.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.binding.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.accepted_contract.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.binding.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.accepted_contract = ::buffa::MessageField::none(); - self.binding = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CheckPresentationCacheRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CHECK_PRESENTATION_CACHE_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CheckPresentationCacheRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// CheckPresentationCacheResponse is the verdict on a held cache. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CheckPresentationCacheResponse { - /// Field 1: `contract` - #[serde(rename = "contract")] - pub contract: ::buffa::MessageField< - ContractNegotiation, - ::buffa::Inline, - >, - /// Field 2: `usability` - #[serde(rename = "usability", with = "::buffa::json_helpers::proto_enum")] - pub usability: ::buffa::EnumValue, - /// What a cache rendered now would be bound to. - /// - /// Present on every verdict, including a discard, so a client that is about to - /// refetch knows what to bind the replacement to without a second round trip. - /// - /// Field 3: `current` - #[serde(rename = "current")] - pub current: ::buffa::MessageField< - PresentationCacheBinding, - ::buffa::Inline, - >, - /// How current the projection that answered was. A usable verdict from a - /// lagging projection is a verdict about a lagging view, and the caller is - /// owed that distinction. - /// - /// Field 4: `freshness` - #[serde(rename = "freshness")] - pub freshness: ::buffa::MessageField< - ProjectionFreshness, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for CheckPresentationCacheResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CheckPresentationCacheResponse") - .field("contract", &self.contract) - .field("usability", &self.usability) - .field("current", &self.current) - .field("freshness", &self.freshness) - .finish() - } -} -impl CheckPresentationCacheResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CheckPresentationCacheResponse"; -} -::buffa::impl_default_instance!(CheckPresentationCacheResponse); -impl ::buffa::MessageName for CheckPresentationCacheResponse { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "CheckPresentationCacheResponse"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.CheckPresentationCacheResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CheckPresentationCacheResponse"; -} -impl ::buffa::Message for CheckPresentationCacheResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.contract.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.contract.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.usability.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.current.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.current.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.freshness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.freshness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.contract.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.contract.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(2u32, self.usability.to_i32(), buf); - if self.current.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.current.write_to(__cache, buf); - } - if self.freshness.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.freshness.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.contract.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.usability = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.current.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.freshness.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.contract = ::buffa::MessageField::none(); - self.usability = ::buffa::EnumValue::from(0); - self.current = ::buffa::MessageField::none(); - self.freshness = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CheckPresentationCacheResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CHECK_PRESENTATION_CACHE_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.CheckPresentationCacheResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.projection_freshness.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.projection_freshness.__view.rs deleted file mode 100644 index e1f973c55..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.projection_freshness.__view.rs +++ /dev/null @@ -1,953 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/projection_freshness.proto - -/// ProjectionFreshness is how current the read model was when it answered. -/// -/// Every successful Session query carries one. A response that parses is not -/// evidence that it reflects a write the caller just made, and a caller with no -/// way to tell will present a stale view as the truth. Reporting freshness on -/// every answer, rather than only when something is wrong, is what makes "this -/// is current" a statement the server made instead of one the caller assumed. -/// -/// This is query metadata. None of it is derived from Session events, and none -/// of it belongs in one: it describes the read path's progress, which is not a -/// fact about the session. -#[derive(Clone, Debug, Default)] -pub struct ProjectionFreshnessView<'a> { - /// Field 1: `condition` - pub condition: ::buffa::EnumValue, - /// Identifies the projection instance. A rebuild under a new generation - /// invalidates positions and orderings minted against the old one, which is - /// what page cursors bind to (see CursorValidity). - /// - /// Field 2: `projection_generation` - pub projection_generation: &'a str, - /// How far the projection has applied. For a session-scoped read this is a - /// SessionOrdinal on that session's stream, which is what a ConsistencyToken - /// is compared against. - /// - /// Field 3: `processed_watermark` - pub processed_watermark: u64, - /// Event time of the last applied event. Useful for a human-facing "as of", - /// and useless as a consistency boundary: event time is not monotonic across - /// writers, so a caller must compare watermarks, not timestamps. - /// - /// Field 4: `processed_at` - pub processed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// The source stream head as most recently observed. - /// - /// Unset means the head was not observed for this read, which is not the same - /// as a head of zero. Observing it costs a round trip the read path does not - /// always pay, so the contract lets a server decline rather than report a - /// fabricated value. When it is unset the condition is INDETERMINATE. - /// - /// Field 5: `source_high_watermark` - pub source_high_watermark: ::core::option::Option, - /// When source_high_watermark was observed. A cached observation is still - /// useful and still needs its age disclosed, because lag computed against a - /// stale head understates the real lag. - /// - /// Field 6: `source_observed_at` - pub source_observed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// Field 7: `consistency` - pub consistency: ::buffa::MessageFieldView< - super::super::__buffa::view::ConsistencyOutcomeView<'a>, - >, - /// Field 8: `source` - pub source: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ProjectionFreshnessView<'a> { - /**Whether required field `condition` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_condition(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `projection_generation` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_projection_generation(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `processed_watermark` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_processed_watermark(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `consistency` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_consistency(&self) -> bool { - self.consistency.is_set() - } - /**Whether required field `source` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ProjectionFreshnessView<'a> { - type Owned = super::super::ProjectionFreshness; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.condition = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.projection_generation = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.processed_watermark = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.processed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.processed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.source_high_watermark = Some( - ::buffa::types::decode_uint64(&mut cur)?, - ); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.source_observed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.source_observed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.consistency.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.consistency = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.source = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ProjectionFreshness, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ProjectionFreshness, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ProjectionFreshness { - condition: self.condition, - projection_generation: self.projection_generation.to_string(), - processed_watermark: self.processed_watermark, - processed_at: match self.processed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - source_high_watermark: self.source_high_watermark, - source_observed_at: match self.source_observed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - consistency: match self.consistency.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ConsistencyOutcome, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - source: self.source, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ProjectionFreshnessView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.condition.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.projection_generation) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.processed_watermark) as u64; - if self.processed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.processed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(v) = self.source_high_watermark { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.source_observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.consistency.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.consistency.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.source.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.condition.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.projection_generation, buf); - ::buffa::types::put_uint64_field(3u32, self.processed_watermark, buf); - if self.processed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.processed_at.write_to(__cache, buf); - } - if let Some(v) = self.source_high_watermark { - ::buffa::types::put_uint64_field(5u32, v, buf); - } - if self.source_observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_observed_at.write_to(__cache, buf); - } - if self.consistency.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.consistency.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(8u32, self.source.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ProjectionFreshnessView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("condition", &self.condition)?; - } - { - __map.serialize_entry("projectionGeneration", self.projection_generation)?; - } - { - __map - .serialize_entry( - "processedWatermark", - &::buffa::json_helpers::ProtoJson(&self.processed_watermark), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.processed_at.as_option() { - __map.serialize_entry("processedAt", __v)?; - } - } - if let ::core::option::Option::Some(__v) = self.source_high_watermark { - __map - .serialize_entry( - "sourceHighWatermark", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - { - if let ::core::option::Option::Some(__v) = self - .source_observed_at - .as_option() - { - __map.serialize_entry("sourceObservedAt", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.consistency.as_option() { - __map.serialize_entry("consistency", __v)?; - } - } - { - __map.serialize_entry("source", &self.source)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ProjectionFreshnessView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ProjectionFreshness"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ProjectionFreshness"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ProjectionFreshness"; -} -::buffa::impl_default_view_instance!(ProjectionFreshnessView); -::buffa::impl_view_reborrow!(ProjectionFreshnessView); -/** Self-contained, `'static` owned view of a `ProjectionFreshness` message. - - Wraps [`::buffa::OwnedView`]`<`[`ProjectionFreshnessView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ProjectionFreshnessView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ProjectionFreshnessOwnedView( - ::buffa::OwnedView>, -); -impl ProjectionFreshnessOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProjectionFreshnessOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProjectionFreshnessOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ProjectionFreshness, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProjectionFreshnessOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ProjectionFreshnessView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ProjectionFreshnessView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ProjectionFreshness { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `condition` - #[must_use] - pub fn condition(&self) -> ::buffa::EnumValue { - self.0.reborrow().condition - } - /// Identifies the projection instance. A rebuild under a new generation - /// invalidates positions and orderings minted against the old one, which is - /// what page cursors bind to (see CursorValidity). - /// - /// Field 2: `projection_generation` - #[must_use] - pub fn projection_generation(&self) -> &'_ str { - self.0.reborrow().projection_generation - } - /// How far the projection has applied. For a session-scoped read this is a - /// SessionOrdinal on that session's stream, which is what a ConsistencyToken - /// is compared against. - /// - /// Field 3: `processed_watermark` - #[must_use] - pub fn processed_watermark(&self) -> u64 { - self.0.reborrow().processed_watermark - } - /// Event time of the last applied event. Useful for a human-facing "as of", - /// and useless as a consistency boundary: event time is not monotonic across - /// writers, so a caller must compare watermarks, not timestamps. - /// - /// Field 4: `processed_at` - #[must_use] - pub fn processed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().processed_at - } - /// The source stream head as most recently observed. - /// - /// Unset means the head was not observed for this read, which is not the same - /// as a head of zero. Observing it costs a round trip the read path does not - /// always pay, so the contract lets a server decline rather than report a - /// fabricated value. When it is unset the condition is INDETERMINATE. - /// - /// Field 5: `source_high_watermark` - #[must_use] - pub fn source_high_watermark(&self) -> ::core::option::Option { - self.0.reborrow().source_high_watermark - } - /// When source_high_watermark was observed. A cached observation is still - /// useful and still needs its age disclosed, because lag computed against a - /// stale head understates the real lag. - /// - /// Field 6: `source_observed_at` - #[must_use] - pub fn source_observed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().source_observed_at - } - /// Field 7: `consistency` - #[must_use] - pub fn consistency( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ConsistencyOutcomeView<'_>, - > { - &self.0.reborrow().consistency - } - /// Field 8: `source` - #[must_use] - pub fn source(&self) -> ::buffa::EnumValue { - self.0.reborrow().source - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ProjectionFreshnessOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ProjectionFreshnessOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ProjectionFreshnessOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ProjectionFreshnessOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ProjectionFreshness { - type View<'a> = ProjectionFreshnessView<'a>; - type ViewHandle = ProjectionFreshnessOwnedView; -} -impl ::serde::Serialize for ProjectionFreshnessOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ConsistencyOutcome reports what the server did about the caller's -/// ReadConsistency, so a satisfied requirement is affirmed rather than implied -/// by the absence of an error. -#[derive(Clone, Debug, Default)] -pub struct ConsistencyOutcomeView<'a> { - /// Field 1: `result` - pub result: ::buffa::EnumValue, - /// How long the read waited before answering. Zero for both NOT_REQUESTED and - /// SATISFIED_IMMEDIATELY. - /// - /// Field 2: `waited_millis` - pub waited_millis: u32, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, - #[doc(hidden)] - pub __buffa_phantom: ::core::marker::PhantomData<&'a ()>, -} -impl<'a> ConsistencyOutcomeView<'a> { - /**Whether required field `result` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_result(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `waited_millis` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_waited_millis(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ConsistencyOutcomeView<'a> { - type Owned = super::super::ConsistencyOutcome; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.result = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.waited_millis = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ConsistencyOutcome { - result: self.result, - waited_millis: self.waited_millis, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ConsistencyOutcomeView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.result.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.waited_millis) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.result.to_i32(), buf); - ::buffa::types::put_uint32_field(2u32, self.waited_millis, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ConsistencyOutcomeView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("result", &self.result)?; - } - { - __map - .serialize_entry( - "waitedMillis", - &::buffa::json_helpers::ProtoJson(&self.waited_millis), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ConsistencyOutcomeView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ConsistencyOutcome"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ConsistencyOutcome"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ConsistencyOutcome"; -} -::buffa::impl_default_view_instance!(ConsistencyOutcomeView); -::buffa::impl_view_reborrow!(ConsistencyOutcomeView); -/** Self-contained, `'static` owned view of a `ConsistencyOutcome` message. - - Wraps [`::buffa::OwnedView`]`<`[`ConsistencyOutcomeView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ConsistencyOutcomeView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ConsistencyOutcomeOwnedView( - ::buffa::OwnedView>, -); -impl ConsistencyOutcomeOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ConsistencyOutcomeOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ConsistencyOutcomeOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ConsistencyOutcome, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ConsistencyOutcomeOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ConsistencyOutcomeView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ConsistencyOutcomeView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ConsistencyOutcome { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `result` - #[must_use] - pub fn result(&self) -> ::buffa::EnumValue { - self.0.reborrow().result - } - /// How long the read waited before answering. Zero for both NOT_REQUESTED and - /// SATISFIED_IMMEDIATELY. - /// - /// Field 2: `waited_millis` - #[must_use] - pub fn waited_millis(&self) -> u32 { - self.0.reborrow().waited_millis - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ConsistencyOutcomeOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ConsistencyOutcomeOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ConsistencyOutcomeOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ConsistencyOutcomeOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ConsistencyOutcome { - type View<'a> = ConsistencyOutcomeView<'a>; - type ViewHandle = ConsistencyOutcomeOwnedView; -} -impl ::serde::Serialize for ConsistencyOutcomeOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.projection_freshness.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.projection_freshness.rs deleted file mode 100644 index b5f01a007..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.projection_freshness.rs +++ /dev/null @@ -1,1030 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/projection_freshness.proto - -/// AnswerSource is what actually produced this answer. -/// -/// A projection that cannot serve does not have to mean the read fails. For a -/// read scoped to one session the server can fold that session's stream directly -/// and answer from the log, which is the authoritative source the projection is -/// only a cache of. The caller needs to be told, because the answer is better -/// than a projection answer and more expensive than one, and because a few -/// things it would normally be allowed to do with the response no longer hold. -/// -/// Falling back is admissible only for a session-scoped read. A read across -/// sessions has no bounded stream to fold, so a list query has exactly two -/// honest outcomes: a projection answer, or -/// QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE. Stating that here is cheaper than -/// discovering it the first time a degraded list query tries to replay a -/// tenant. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum AnswerSource { - ANSWER_SOURCE_UNSPECIFIED = 0i32, - /// Served from the materialized read model. - ANSWER_SOURCE_PROJECTION = 1i32, - /// Served by folding the session's own stream, because the projection could - /// not answer. - /// - /// The condition is CURRENT, since the fold ran to the head it read at. The - /// `projection_generation` is empty, because no projection instance produced - /// this and a synthetic id would be a generation a page cursor could bind to - /// that nothing is able to honor later. Which is the constraint that follows: - /// a replay answer must not mint a page cursor, so a caller needing to - /// paginate through a projection outage has to wait for the projection rather - /// than scan against a fallback. - ANSWER_SOURCE_AUTHORITATIVE_REPLAY = 2i32, -} -impl AnswerSource { - ///Idiomatic alias for [`Self::ANSWER_SOURCE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::ANSWER_SOURCE_UNSPECIFIED; - ///Idiomatic alias for [`Self::ANSWER_SOURCE_PROJECTION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Projection: Self = Self::ANSWER_SOURCE_PROJECTION; - ///Idiomatic alias for [`Self::ANSWER_SOURCE_AUTHORITATIVE_REPLAY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const AuthoritativeReplay: Self = Self::ANSWER_SOURCE_AUTHORITATIVE_REPLAY; -} -impl ::core::default::Default for AnswerSource { - fn default() -> Self { - Self::ANSWER_SOURCE_UNSPECIFIED - } -} -impl ::serde::Serialize for AnswerSource { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for AnswerSource { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = AnswerSource; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(AnswerSource)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for AnswerSource { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for AnswerSource { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::ANSWER_SOURCE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::ANSWER_SOURCE_PROJECTION), - 2i32 => { - ::core::option::Option::Some(Self::ANSWER_SOURCE_AUTHORITATIVE_REPLAY) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::ANSWER_SOURCE_UNSPECIFIED => "ANSWER_SOURCE_UNSPECIFIED", - Self::ANSWER_SOURCE_PROJECTION => "ANSWER_SOURCE_PROJECTION", - Self::ANSWER_SOURCE_AUTHORITATIVE_REPLAY => { - "ANSWER_SOURCE_AUTHORITATIVE_REPLAY" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "ANSWER_SOURCE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::ANSWER_SOURCE_UNSPECIFIED) - } - "ANSWER_SOURCE_PROJECTION" => { - ::core::option::Option::Some(Self::ANSWER_SOURCE_PROJECTION) - } - "ANSWER_SOURCE_AUTHORITATIVE_REPLAY" => { - ::core::option::Option::Some(Self::ANSWER_SOURCE_AUTHORITATIVE_REPLAY) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::ANSWER_SOURCE_UNSPECIFIED, - Self::ANSWER_SOURCE_PROJECTION, - Self::ANSWER_SOURCE_AUTHORITATIVE_REPLAY, - ] - } -} -/// ProjectionCondition is the projection's state on the success path. -/// -/// It is deliberately smaller than the set of states a projection can be in. -/// Rebuilding, invalid, and missing are failure-path conditions: a projection in -/// one of those either serves nothing, in which case the caller gets -/// QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE with the matching reason, or serves a -/// readable prior generation, in which case it is simply LAGGING. Duplicating -/// them here would create two places to express one state and invite them to -/// disagree. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ProjectionCondition { - PROJECTION_CONDITION_UNSPECIFIED = 0i32, - /// Applied through the observed source head. Nothing known is missing. - PROJECTION_CONDITION_CURRENT = 1i32, - /// Known to be behind the observed source head. - PROJECTION_CONDITION_LAGGING = 2i32, - /// The source head was not observed, so currency could not be determined. - /// - /// This is not a degraded CURRENT. A caller that needs to know it is reading a - /// write it just made must state that with ReadConsistency rather than infer - /// it from a condition that says the server did not check. - PROJECTION_CONDITION_INDETERMINATE = 3i32, -} -impl ProjectionCondition { - ///Idiomatic alias for [`Self::PROJECTION_CONDITION_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::PROJECTION_CONDITION_UNSPECIFIED; - ///Idiomatic alias for [`Self::PROJECTION_CONDITION_CURRENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Current: Self = Self::PROJECTION_CONDITION_CURRENT; - ///Idiomatic alias for [`Self::PROJECTION_CONDITION_LAGGING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Lagging: Self = Self::PROJECTION_CONDITION_LAGGING; - ///Idiomatic alias for [`Self::PROJECTION_CONDITION_INDETERMINATE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Indeterminate: Self = Self::PROJECTION_CONDITION_INDETERMINATE; -} -impl ::core::default::Default for ProjectionCondition { - fn default() -> Self { - Self::PROJECTION_CONDITION_UNSPECIFIED - } -} -impl ::serde::Serialize for ProjectionCondition { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ProjectionCondition { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ProjectionCondition; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(ProjectionCondition) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ProjectionCondition { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ProjectionCondition { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::PROJECTION_CONDITION_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::PROJECTION_CONDITION_CURRENT), - 2i32 => ::core::option::Option::Some(Self::PROJECTION_CONDITION_LAGGING), - 3i32 => { - ::core::option::Option::Some(Self::PROJECTION_CONDITION_INDETERMINATE) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::PROJECTION_CONDITION_UNSPECIFIED => "PROJECTION_CONDITION_UNSPECIFIED", - Self::PROJECTION_CONDITION_CURRENT => "PROJECTION_CONDITION_CURRENT", - Self::PROJECTION_CONDITION_LAGGING => "PROJECTION_CONDITION_LAGGING", - Self::PROJECTION_CONDITION_INDETERMINATE => { - "PROJECTION_CONDITION_INDETERMINATE" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "PROJECTION_CONDITION_UNSPECIFIED" => { - ::core::option::Option::Some(Self::PROJECTION_CONDITION_UNSPECIFIED) - } - "PROJECTION_CONDITION_CURRENT" => { - ::core::option::Option::Some(Self::PROJECTION_CONDITION_CURRENT) - } - "PROJECTION_CONDITION_LAGGING" => { - ::core::option::Option::Some(Self::PROJECTION_CONDITION_LAGGING) - } - "PROJECTION_CONDITION_INDETERMINATE" => { - ::core::option::Option::Some(Self::PROJECTION_CONDITION_INDETERMINATE) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::PROJECTION_CONDITION_UNSPECIFIED, - Self::PROJECTION_CONDITION_CURRENT, - Self::PROJECTION_CONDITION_LAGGING, - Self::PROJECTION_CONDITION_INDETERMINATE, - ] - } -} -/// ConsistencyResult is how a read's consistency requirement was resolved. -/// -/// There is no unsatisfied value. A requirement the server could not meet is a -/// failure, not a success carrying a flag, because a success shape with an -/// ignored flag is exactly what a caller in a hurry will read as an answer. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ConsistencyResult { - CONSISTENCY_RESULT_UNSPECIFIED = 0i32, - /// The caller asked for an eventual read. Freshness is still reported. - CONSISTENCY_RESULT_NOT_REQUESTED = 1i32, - /// The projection had already applied the required position. - CONSISTENCY_RESULT_SATISFIED_IMMEDIATELY = 2i32, - /// The read waited for the projection to catch up, then answered. - CONSISTENCY_RESULT_SATISFIED_AFTER_WAIT = 3i32, -} -impl ConsistencyResult { - ///Idiomatic alias for [`Self::CONSISTENCY_RESULT_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::CONSISTENCY_RESULT_UNSPECIFIED; - ///Idiomatic alias for [`Self::CONSISTENCY_RESULT_NOT_REQUESTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NotRequested: Self = Self::CONSISTENCY_RESULT_NOT_REQUESTED; - ///Idiomatic alias for [`Self::CONSISTENCY_RESULT_SATISFIED_IMMEDIATELY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SatisfiedImmediately: Self = Self::CONSISTENCY_RESULT_SATISFIED_IMMEDIATELY; - ///Idiomatic alias for [`Self::CONSISTENCY_RESULT_SATISFIED_AFTER_WAIT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SatisfiedAfterWait: Self = Self::CONSISTENCY_RESULT_SATISFIED_AFTER_WAIT; -} -impl ::core::default::Default for ConsistencyResult { - fn default() -> Self { - Self::CONSISTENCY_RESULT_UNSPECIFIED - } -} -impl ::serde::Serialize for ConsistencyResult { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ConsistencyResult { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ConsistencyResult; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(ConsistencyResult) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ConsistencyResult { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ConsistencyResult { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::CONSISTENCY_RESULT_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::CONSISTENCY_RESULT_NOT_REQUESTED), - 2i32 => { - ::core::option::Option::Some( - Self::CONSISTENCY_RESULT_SATISFIED_IMMEDIATELY, - ) - } - 3i32 => { - ::core::option::Option::Some( - Self::CONSISTENCY_RESULT_SATISFIED_AFTER_WAIT, - ) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::CONSISTENCY_RESULT_UNSPECIFIED => "CONSISTENCY_RESULT_UNSPECIFIED", - Self::CONSISTENCY_RESULT_NOT_REQUESTED => "CONSISTENCY_RESULT_NOT_REQUESTED", - Self::CONSISTENCY_RESULT_SATISFIED_IMMEDIATELY => { - "CONSISTENCY_RESULT_SATISFIED_IMMEDIATELY" - } - Self::CONSISTENCY_RESULT_SATISFIED_AFTER_WAIT => { - "CONSISTENCY_RESULT_SATISFIED_AFTER_WAIT" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "CONSISTENCY_RESULT_UNSPECIFIED" => { - ::core::option::Option::Some(Self::CONSISTENCY_RESULT_UNSPECIFIED) - } - "CONSISTENCY_RESULT_NOT_REQUESTED" => { - ::core::option::Option::Some(Self::CONSISTENCY_RESULT_NOT_REQUESTED) - } - "CONSISTENCY_RESULT_SATISFIED_IMMEDIATELY" => { - ::core::option::Option::Some( - Self::CONSISTENCY_RESULT_SATISFIED_IMMEDIATELY, - ) - } - "CONSISTENCY_RESULT_SATISFIED_AFTER_WAIT" => { - ::core::option::Option::Some( - Self::CONSISTENCY_RESULT_SATISFIED_AFTER_WAIT, - ) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::CONSISTENCY_RESULT_UNSPECIFIED, - Self::CONSISTENCY_RESULT_NOT_REQUESTED, - Self::CONSISTENCY_RESULT_SATISFIED_IMMEDIATELY, - Self::CONSISTENCY_RESULT_SATISFIED_AFTER_WAIT, - ] - } -} -/// ProjectionFreshness is how current the read model was when it answered. -/// -/// Every successful Session query carries one. A response that parses is not -/// evidence that it reflects a write the caller just made, and a caller with no -/// way to tell will present a stale view as the truth. Reporting freshness on -/// every answer, rather than only when something is wrong, is what makes "this -/// is current" a statement the server made instead of one the caller assumed. -/// -/// This is query metadata. None of it is derived from Session events, and none -/// of it belongs in one: it describes the read path's progress, which is not a -/// fact about the session. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ProjectionFreshness { - /// Field 1: `condition` - #[serde(rename = "condition", with = "::buffa::json_helpers::proto_enum")] - pub condition: ::buffa::EnumValue, - /// Identifies the projection instance. A rebuild under a new generation - /// invalidates positions and orderings minted against the old one, which is - /// what page cursors bind to (see CursorValidity). - /// - /// Field 2: `projection_generation` - #[serde( - rename = "projectionGeneration", - alias = "projection_generation", - with = "::buffa::json_helpers::proto_string" - )] - pub projection_generation: ::buffa::alloc::string::String, - /// How far the projection has applied. For a session-scoped read this is a - /// SessionOrdinal on that session's stream, which is what a ConsistencyToken - /// is compared against. - /// - /// Field 3: `processed_watermark` - #[serde( - rename = "processedWatermark", - alias = "processed_watermark", - with = "::buffa::json_helpers::uint64" - )] - pub processed_watermark: u64, - /// Event time of the last applied event. Useful for a human-facing "as of", - /// and useless as a consistency boundary: event time is not monotonic across - /// writers, so a caller must compare watermarks, not timestamps. - /// - /// Field 4: `processed_at` - #[serde( - rename = "processedAt", - alias = "processed_at", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub processed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// The source stream head as most recently observed. - /// - /// Unset means the head was not observed for this read, which is not the same - /// as a head of zero. Observing it costs a round trip the read path does not - /// always pay, so the contract lets a server decline rather than report a - /// fabricated value. When it is unset the condition is INDETERMINATE. - /// - /// Field 5: `source_high_watermark` - #[serde( - rename = "sourceHighWatermark", - alias = "source_high_watermark", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub source_high_watermark: ::core::option::Option, - /// When source_high_watermark was observed. A cached observation is still - /// useful and still needs its age disclosed, because lag computed against a - /// stale head understates the real lag. - /// - /// Field 6: `source_observed_at` - #[serde( - rename = "sourceObservedAt", - alias = "source_observed_at", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub source_observed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// Field 7: `consistency` - #[serde(rename = "consistency")] - pub consistency: ::buffa::MessageField< - ConsistencyOutcome, - ::buffa::Inline, - >, - /// Field 8: `source` - #[serde(rename = "source", with = "::buffa::json_helpers::proto_enum")] - pub source: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for ProjectionFreshness { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ProjectionFreshness") - .field("condition", &self.condition) - .field("projection_generation", &self.projection_generation) - .field("processed_watermark", &self.processed_watermark) - .field("processed_at", &self.processed_at) - .field("source_high_watermark", &self.source_high_watermark) - .field("source_observed_at", &self.source_observed_at) - .field("consistency", &self.consistency) - .field("source", &self.source) - .finish() - } -} -impl ProjectionFreshness { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ProjectionFreshness"; -} -impl ProjectionFreshness { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::source_high_watermark`] to `Some(value)`, consuming and returning `self`. - pub fn with_source_high_watermark(mut self, value: u64) -> Self { - self.source_high_watermark = Some(value); - self - } -} -::buffa::impl_default_instance!(ProjectionFreshness); -impl ::buffa::MessageName for ProjectionFreshness { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ProjectionFreshness"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ProjectionFreshness"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ProjectionFreshness"; -} -impl ::buffa::Message for ProjectionFreshness { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.condition.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.projection_generation) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.processed_watermark) as u64; - if self.processed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.processed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(v) = self.source_high_watermark { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.source_observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.consistency.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.consistency.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.source.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.condition.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.projection_generation, buf); - ::buffa::types::put_uint64_field(3u32, self.processed_watermark, buf); - if self.processed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.processed_at.write_to(__cache, buf); - } - if let Some(v) = self.source_high_watermark { - ::buffa::types::put_uint64_field(5u32, v, buf); - } - if self.source_observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_observed_at.write_to(__cache, buf); - } - if self.consistency.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.consistency.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(8u32, self.source.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.condition = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.projection_generation, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.processed_watermark = ::buffa::types::decode_uint64(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.processed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.source_high_watermark = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.source_observed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.consistency.get_or_insert_default(), - buf, - ctx, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.source = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.condition = ::buffa::EnumValue::from(0); - self.projection_generation.clear(); - self.processed_watermark = 0u64; - self.processed_at = ::buffa::MessageField::none(); - self.source_high_watermark = ::core::option::Option::None; - self.source_observed_at = ::buffa::MessageField::none(); - self.consistency = ::buffa::MessageField::none(); - self.source = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ProjectionFreshness { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PROJECTION_FRESHNESS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ProjectionFreshness", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ConsistencyOutcome reports what the server did about the caller's -/// ReadConsistency, so a satisfied requirement is affirmed rather than implied -/// by the absence of an error. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ConsistencyOutcome { - /// Field 1: `result` - #[serde(rename = "result", with = "::buffa::json_helpers::proto_enum")] - pub result: ::buffa::EnumValue, - /// How long the read waited before answering. Zero for both NOT_REQUESTED and - /// SATISFIED_IMMEDIATELY. - /// - /// Field 2: `waited_millis` - #[serde( - rename = "waitedMillis", - alias = "waited_millis", - with = "::buffa::json_helpers::uint32" - )] - pub waited_millis: u32, -} -impl ::core::fmt::Debug for ConsistencyOutcome { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ConsistencyOutcome") - .field("result", &self.result) - .field("waited_millis", &self.waited_millis) - .finish() - } -} -impl ConsistencyOutcome { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ConsistencyOutcome"; -} -::buffa::impl_default_instance!(ConsistencyOutcome); -impl ::buffa::MessageName for ConsistencyOutcome { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ConsistencyOutcome"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ConsistencyOutcome"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ConsistencyOutcome"; -} -impl ::buffa::Message for ConsistencyOutcome { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.result.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.waited_millis) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.result.to_i32(), buf); - ::buffa::types::put_uint32_field(2u32, self.waited_millis, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.result = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.waited_millis = ::buffa::types::decode_uint32(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.result = ::buffa::EnumValue::from(0); - self.waited_millis = 0u32; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ConsistencyOutcome { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CONSISTENCY_OUTCOME_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ConsistencyOutcome", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.query_error.__oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.query_error.__oneof.rs deleted file mode 100644 index 3198464d0..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.query_error.__oneof.rs +++ /dev/null @@ -1,94 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/query_error.proto - -pub mod query_error { - #[allow(unused_imports)] - use super::*; - /// Machine-readable specifics for the codes that have them. A caller must - /// tolerate an unset detail: a code may gain one additively, and an older - /// caller will not decode a variant added after its minor. - #[derive(Clone, PartialEq, Debug)] - pub enum Detail { - UnsupportedContractVersion( - ::buffa::alloc::boxed::Box< - super::super::super::UnsupportedContractVersionDetail, - >, - ), - StaleCursor(::buffa::alloc::boxed::Box), - ProjectionUnavailable( - ::buffa::alloc::boxed::Box, - ), - InvalidArgument( - ::buffa::alloc::boxed::Box, - ), - } - impl ::buffa::Oneof for Detail {} - impl From for Detail { - fn from(v: super::super::super::UnsupportedContractVersionDetail) -> Self { - Self::UnsupportedContractVersion(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::UnsupportedContractVersionDetail) -> Self { - Self::Some(Detail::from(v)) - } - } - impl From for Detail { - fn from(v: super::super::super::StaleCursorDetail) -> Self { - Self::StaleCursor(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::StaleCursorDetail) -> Self { - Self::Some(Detail::from(v)) - } - } - impl From for Detail { - fn from(v: super::super::super::ProjectionUnavailableDetail) -> Self { - Self::ProjectionUnavailable(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::ProjectionUnavailableDetail) -> Self { - Self::Some(Detail::from(v)) - } - } - impl From for Detail { - fn from(v: super::super::super::InvalidArgumentDetail) -> Self { - Self::InvalidArgument(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::InvalidArgumentDetail) -> Self { - Self::Some(Detail::from(v)) - } - } - impl serde::Serialize for Detail { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::UnsupportedContractVersion(v) => { - map.serialize_entry("unsupportedContractVersion", v)?; - } - Self::StaleCursor(v) => { - map.serialize_entry("staleCursor", v)?; - } - Self::ProjectionUnavailable(v) => { - map.serialize_entry("projectionUnavailable", v)?; - } - Self::InvalidArgument(v) => { - map.serialize_entry("invalidArgument", v)?; - } - } - map.end() - } - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.query_error.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.query_error.__view.rs deleted file mode 100644 index d31b6a20e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.query_error.__view.rs +++ /dev/null @@ -1,2294 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/query_error.proto - -/// QueryError is the typed failure payload for every Session query. -/// -/// It is not carried inside a success response. A query either answers or -/// fails, and collapsing the two into one message invites a caller to read a -/// zero-valued success shape as an empty result. On the JSON-RPC-over-NATS -/// binding (ADR#0056) this rides in the error object's `data`; the numeric code -/// assignment is a separate reservation and is deliberately not invented here. -/// -/// `code` is the machine-readable discriminant and the only field a caller -/// should branch on. `message` is for humans and may change at any time without -/// a version bump, so treating it as an API is a bug. -#[derive(Clone, Debug, Default)] -pub struct QueryErrorView<'a> { - /// Field 1: `code` - pub code: ::buffa::EnumValue, - /// Human-readable, non-contractual, safe to log. Never parse it. - /// - /// Field 2: `message` - pub message: &'a str, - pub detail: ::core::option::Option< - super::super::__buffa::view::oneof::query_error::Detail<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> QueryErrorView<'a> { - /**Whether required field `code` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_code(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `message` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for QueryErrorView<'a> { - type Owned = super::super::QueryError; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.code = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.message = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::query_error::Detail::UnsupportedContractVersion( - ref mut existing, - ), - ) = view.detail - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.detail = Some( - super::super::__buffa::view::oneof::query_error::Detail::UnsupportedContractVersion( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::query_error::Detail::StaleCursor( - ref mut existing, - ), - ) = view.detail - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.detail = Some( - super::super::__buffa::view::oneof::query_error::Detail::StaleCursor( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::query_error::Detail::ProjectionUnavailable( - ref mut existing, - ), - ) = view.detail - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.detail = Some( - super::super::__buffa::view::oneof::query_error::Detail::ProjectionUnavailable( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::query_error::Detail::InvalidArgument( - ref mut existing, - ), - ) = view.detail - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.detail = Some( - super::super::__buffa::view::oneof::query_error::Detail::InvalidArgument( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::QueryError { - code: self.code, - message: self.message.to_string(), - detail: match self.detail.as_ref() { - ::core::option::Option::Some(v) => { - ::core::option::Option::Some( - match v { - super::super::__buffa::view::oneof::query_error::Detail::UnsupportedContractVersion( - v, - ) => { - super::super::__buffa::oneof::query_error::Detail::UnsupportedContractVersion( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::query_error::Detail::StaleCursor( - v, - ) => { - super::super::__buffa::oneof::query_error::Detail::StaleCursor( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::query_error::Detail::ProjectionUnavailable( - v, - ) => { - super::super::__buffa::oneof::query_error::Detail::ProjectionUnavailable( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::query_error::Detail::InvalidArgument( - v, - ) => { - super::super::__buffa::oneof::query_error::Detail::InvalidArgument( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - }, - ) - } - ::core::option::Option::None => ::core::option::Option::None, - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for QueryErrorView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.code.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.message) as u64; - if let ::core::option::Option::Some(ref v) = self.detail { - match v { - super::super::__buffa::view::oneof::query_error::Detail::UnsupportedContractVersion( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::query_error::Detail::StaleCursor( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::query_error::Detail::ProjectionUnavailable( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::query_error::Detail::InvalidArgument( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.code.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.message, buf); - if let ::core::option::Option::Some(ref v) = self.detail { - match v { - super::super::__buffa::view::oneof::query_error::Detail::UnsupportedContractVersion( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::query_error::Detail::StaleCursor( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::query_error::Detail::ProjectionUnavailable( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::query_error::Detail::InvalidArgument( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for QueryErrorView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("code", &self.code)?; - } - { - __map.serialize_entry("message", self.message)?; - } - if let ::core::option::Option::Some(ref __ov) = self.detail { - match __ov { - super::super::__buffa::view::oneof::query_error::Detail::UnsupportedContractVersion( - v, - ) => { - __map.serialize_entry("unsupportedContractVersion", v)?; - } - super::super::__buffa::view::oneof::query_error::Detail::StaleCursor( - v, - ) => { - __map.serialize_entry("staleCursor", v)?; - } - super::super::__buffa::view::oneof::query_error::Detail::ProjectionUnavailable( - v, - ) => { - __map.serialize_entry("projectionUnavailable", v)?; - } - super::super::__buffa::view::oneof::query_error::Detail::InvalidArgument( - v, - ) => { - __map.serialize_entry("invalidArgument", v)?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for QueryErrorView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "QueryError"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.QueryError"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.QueryError"; -} -::buffa::impl_default_view_instance!(QueryErrorView); -::buffa::impl_view_reborrow!(QueryErrorView); -/** Self-contained, `'static` owned view of a `QueryError` message. - - Wraps [`::buffa::OwnedView`]`<`[`QueryErrorView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`QueryErrorView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct QueryErrorOwnedView(::buffa::OwnedView>); -impl QueryErrorOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - QueryErrorOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - QueryErrorOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::QueryError, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - QueryErrorOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`QueryErrorView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &QueryErrorView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::QueryError { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `code` - #[must_use] - pub fn code(&self) -> ::buffa::EnumValue { - self.0.reborrow().code - } - /// Human-readable, non-contractual, safe to log. Never parse it. - /// - /// Field 2: `message` - #[must_use] - pub fn message(&self) -> &'_ str { - self.0.reborrow().message - } - /// Oneof `detail`. - #[must_use] - pub fn detail( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::query_error::Detail<'_>, - > { - self.0.reborrow().detail.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for QueryErrorOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - QueryErrorOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: QueryErrorOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for QueryErrorOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::QueryError { - type View<'a> = QueryErrorView<'a>; - type ViewHandle = QueryErrorOwnedView; -} -impl ::serde::Serialize for QueryErrorOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// UnsupportedContractVersionDetail tells the caller what it would have to -/// speak, so an incompatibility is actionable rather than merely reported. -#[derive(Clone, Debug, Default)] -pub struct UnsupportedContractVersionDetailView<'a> { - /// Field 1: `requested` - pub requested: ::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'a>, - >, - /// Inclusive range of majors this server can render. - /// - /// Field 2: `supported_major_min` - pub supported_major_min: u32, - /// Field 3: `supported_major_max` - pub supported_major_max: u32, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> UnsupportedContractVersionDetailView<'a> { - /**Whether required field `requested` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_requested(&self) -> bool { - self.requested.is_set() - } - /**Whether required field `supported_major_min` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_supported_major_min(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `supported_major_max` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_supported_major_max(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for UnsupportedContractVersionDetailView<'a> { - type Owned = super::super::UnsupportedContractVersionDetail; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.requested.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.requested = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.supported_major_min = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.supported_major_max = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::UnsupportedContractVersionDetail, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::UnsupportedContractVersionDetail, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::UnsupportedContractVersionDetail { - requested: match self.requested.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContractVersion, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - supported_major_min: self.supported_major_min, - supported_major_max: self.supported_major_max, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for UnsupportedContractVersionDetailView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.requested.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.requested.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.supported_major_min) as u64; - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.supported_major_max) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.requested.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.requested.write_to(__cache, buf); - } - ::buffa::types::put_uint32_field(2u32, self.supported_major_min, buf); - ::buffa::types::put_uint32_field(3u32, self.supported_major_max, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for UnsupportedContractVersionDetailView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.requested.as_option() { - __map.serialize_entry("requested", __v)?; - } - } - { - __map - .serialize_entry( - "supportedMajorMin", - &::buffa::json_helpers::ProtoJson(&self.supported_major_min), - )?; - } - { - __map - .serialize_entry( - "supportedMajorMax", - &::buffa::json_helpers::ProtoJson(&self.supported_major_max), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for UnsupportedContractVersionDetailView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "UnsupportedContractVersionDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.UnsupportedContractVersionDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.UnsupportedContractVersionDetail"; -} -::buffa::impl_default_view_instance!(UnsupportedContractVersionDetailView); -::buffa::impl_view_reborrow!(UnsupportedContractVersionDetailView); -/** Self-contained, `'static` owned view of a `UnsupportedContractVersionDetail` message. - - Wraps [`::buffa::OwnedView`]`<`[`UnsupportedContractVersionDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`UnsupportedContractVersionDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct UnsupportedContractVersionDetailOwnedView( - ::buffa::OwnedView>, -); -impl UnsupportedContractVersionDetailOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UnsupportedContractVersionDetailOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UnsupportedContractVersionDetailOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::UnsupportedContractVersionDetail, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UnsupportedContractVersionDetailOwnedView( - ::buffa::OwnedView::from_owned(msg)?, - ), - ) - } - /// Borrow the full [`UnsupportedContractVersionDetailView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &UnsupportedContractVersionDetailView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::UnsupportedContractVersionDetail { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `requested` - #[must_use] - pub fn requested( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ContractVersionView<'_>, - > { - &self.0.reborrow().requested - } - /// Inclusive range of majors this server can render. - /// - /// Field 2: `supported_major_min` - #[must_use] - pub fn supported_major_min(&self) -> u32 { - self.0.reborrow().supported_major_min - } - /// Field 3: `supported_major_max` - #[must_use] - pub fn supported_major_max(&self) -> u32 { - self.0.reborrow().supported_major_max - } -} -impl ::core::convert::From< - ::buffa::OwnedView>, -> for UnsupportedContractVersionDetailOwnedView { - fn from( - inner: ::buffa::OwnedView>, - ) -> Self { - UnsupportedContractVersionDetailOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: UnsupportedContractVersionDetailOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef< - ::buffa::OwnedView>, -> for UnsupportedContractVersionDetailOwnedView { - fn as_ref( - &self, - ) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::UnsupportedContractVersionDetail { - type View<'a> = UnsupportedContractVersionDetailView<'a>; - type ViewHandle = UnsupportedContractVersionDetailOwnedView; -} -impl ::serde::Serialize for UnsupportedContractVersionDetailOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// StaleCursorDetail says why a previously valid cursor stopped being valid, so -/// a caller can tell a benign restart from a view that changed underneath it. -#[derive(Clone, Debug, Default)] -pub struct StaleCursorDetailView<'a> { - /// Field 1: `reason` - pub reason: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, - #[doc(hidden)] - pub __buffa_phantom: ::core::marker::PhantomData<&'a ()>, -} -impl<'a> StaleCursorDetailView<'a> { - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for StaleCursorDetailView<'a> { - type Owned = super::super::StaleCursorDetail; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::StaleCursorDetail { - reason: self.reason, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for StaleCursorDetailView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for StaleCursorDetailView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("reason", &self.reason)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for StaleCursorDetailView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "StaleCursorDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.StaleCursorDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.StaleCursorDetail"; -} -::buffa::impl_default_view_instance!(StaleCursorDetailView); -::buffa::impl_view_reborrow!(StaleCursorDetailView); -/** Self-contained, `'static` owned view of a `StaleCursorDetail` message. - - Wraps [`::buffa::OwnedView`]`<`[`StaleCursorDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`StaleCursorDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct StaleCursorDetailOwnedView( - ::buffa::OwnedView>, -); -impl StaleCursorDetailOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StaleCursorDetailOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StaleCursorDetailOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::StaleCursorDetail, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StaleCursorDetailOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`StaleCursorDetailView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &StaleCursorDetailView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::StaleCursorDetail { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for StaleCursorDetailOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - StaleCursorDetailOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: StaleCursorDetailOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for StaleCursorDetailOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::StaleCursorDetail { - type View<'a> = StaleCursorDetailView<'a>; - type ViewHandle = StaleCursorDetailOwnedView; -} -impl ::serde::Serialize for StaleCursorDetailOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ProjectionUnavailableDetail distinguishes "come back shortly" from "this is -/// broken", which a caller cannot guess from the code alone. -#[derive(Clone, Debug, Default)] -pub struct ProjectionUnavailableDetailView<'a> { - /// Field 1: `reason` - pub reason: ::buffa::EnumValue, - /// How current the projection was when it gave up. Present for REASON_LAGGING, - /// where it is the difference between an actionable failure and a bare one: a - /// caller that can see it reached the required position minus two can retry - /// with a larger budget, while one that cannot see it can only guess. - /// - /// Field 2: `freshness` - pub freshness: ::buffa::MessageFieldView< - super::super::__buffa::view::ProjectionFreshnessView<'a>, - >, - /// How far along the rebuild is. Present for REASON_REBUILDING when the - /// rebuilder can report it. - /// - /// Without this, "come back shortly" is a claim with no number attached, and a - /// caller has to choose between polling a rebuild that will take four hours - /// and giving up on one that will take four seconds. Absent means the - /// rebuilder could not say, which is different from a rebuild that has made no - /// progress. - /// - /// Field 3: `rebuild` - pub rebuild: ::buffa::MessageFieldView< - super::super::__buffa::view::RebuildProgressView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ProjectionUnavailableDetailView<'a> { - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ProjectionUnavailableDetailView<'a> { - type Owned = super::super::ProjectionUnavailableDetail; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.freshness.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.freshness = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.rebuild.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.rebuild = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ProjectionUnavailableDetail, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ProjectionUnavailableDetail, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ProjectionUnavailableDetail { - reason: self.reason, - freshness: match self.freshness.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ProjectionFreshness, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - rebuild: match self.rebuild.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::RebuildProgress, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ProjectionUnavailableDetailView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.freshness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.freshness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.rebuild.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.rebuild.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - if self.freshness.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.freshness.write_to(__cache, buf); - } - if self.rebuild.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.rebuild.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ProjectionUnavailableDetailView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("reason", &self.reason)?; - } - { - if let ::core::option::Option::Some(__v) = self.freshness.as_option() { - __map.serialize_entry("freshness", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.rebuild.as_option() { - __map.serialize_entry("rebuild", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ProjectionUnavailableDetailView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ProjectionUnavailableDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ProjectionUnavailableDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ProjectionUnavailableDetail"; -} -::buffa::impl_default_view_instance!(ProjectionUnavailableDetailView); -::buffa::impl_view_reborrow!(ProjectionUnavailableDetailView); -/** Self-contained, `'static` owned view of a `ProjectionUnavailableDetail` message. - - Wraps [`::buffa::OwnedView`]`<`[`ProjectionUnavailableDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ProjectionUnavailableDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ProjectionUnavailableDetailOwnedView( - ::buffa::OwnedView>, -); -impl ProjectionUnavailableDetailOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProjectionUnavailableDetailOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProjectionUnavailableDetailOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ProjectionUnavailableDetail, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProjectionUnavailableDetailOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ProjectionUnavailableDetailView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ProjectionUnavailableDetailView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ProjectionUnavailableDetail { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `reason` - #[must_use] - pub fn reason( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// How current the projection was when it gave up. Present for REASON_LAGGING, - /// where it is the difference between an actionable failure and a bare one: a - /// caller that can see it reached the required position minus two can retry - /// with a larger budget, while one that cannot see it can only guess. - /// - /// Field 2: `freshness` - #[must_use] - pub fn freshness( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ProjectionFreshnessView<'_>, - > { - &self.0.reborrow().freshness - } - /// How far along the rebuild is. Present for REASON_REBUILDING when the - /// rebuilder can report it. - /// - /// Without this, "come back shortly" is a claim with no number attached, and a - /// caller has to choose between polling a rebuild that will take four hours - /// and giving up on one that will take four seconds. Absent means the - /// rebuilder could not say, which is different from a rebuild that has made no - /// progress. - /// - /// Field 3: `rebuild` - #[must_use] - pub fn rebuild( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::RebuildProgressView<'_>, - > { - &self.0.reborrow().rebuild - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ProjectionUnavailableDetailOwnedView { - fn from( - inner: ::buffa::OwnedView>, - ) -> Self { - ProjectionUnavailableDetailOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ProjectionUnavailableDetailOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ProjectionUnavailableDetailOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ProjectionUnavailableDetail { - type View<'a> = ProjectionUnavailableDetailView<'a>; - type ViewHandle = ProjectionUnavailableDetailOwnedView; -} -impl ::serde::Serialize for ProjectionUnavailableDetailOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// RebuildProgress is how far a projection rebuild has got. -#[derive(Clone, Debug, Default)] -pub struct RebuildProgressView<'a> { - /// Field 1: `started_at` - pub started_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// Position the rebuild has applied through, in the same units the finished - /// projection will report as its processed watermark. - /// - /// Field 2: `processed_watermark` - pub processed_watermark: u64, - /// Position the rebuild is working toward, as known when it started. - /// - /// Unset when the rebuilder does not know its own end, which is the honest - /// answer for a rebuild over a stream that is still being written to. Reported - /// as unset rather than as the current head, because a target that moves is a - /// percentage that goes backwards. - /// - /// Field 3: `target_watermark` - pub target_watermark: ::core::option::Option, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RebuildProgressView<'a> { - /**Whether required field `started_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_started_at(&self) -> bool { - self.started_at.is_set() - } - /**Whether required field `processed_watermark` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_processed_watermark(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RebuildProgressView<'a> { - type Owned = super::super::RebuildProgress; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.started_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.started_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.processed_watermark = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.target_watermark = Some(::buffa::types::decode_uint64(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RebuildProgress { - started_at: match self.started_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - processed_watermark: self.processed_watermark, - target_watermark: self.target_watermark, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RebuildProgressView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.started_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.started_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.processed_watermark) as u64; - if let Some(v) = self.target_watermark { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.started_at.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.started_at.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(2u32, self.processed_watermark, buf); - if let Some(v) = self.target_watermark { - ::buffa::types::put_uint64_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RebuildProgressView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.started_at.as_option() { - __map.serialize_entry("startedAt", __v)?; - } - } - { - __map - .serialize_entry( - "processedWatermark", - &::buffa::json_helpers::ProtoJson(&self.processed_watermark), - )?; - } - if let ::core::option::Option::Some(__v) = self.target_watermark { - __map - .serialize_entry( - "targetWatermark", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RebuildProgressView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "RebuildProgress"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.RebuildProgress"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.RebuildProgress"; -} -::buffa::impl_default_view_instance!(RebuildProgressView); -::buffa::impl_view_reborrow!(RebuildProgressView); -/** Self-contained, `'static` owned view of a `RebuildProgress` message. - - Wraps [`::buffa::OwnedView`]`<`[`RebuildProgressView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RebuildProgressView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RebuildProgressOwnedView(::buffa::OwnedView>); -impl RebuildProgressOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RebuildProgressOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RebuildProgressOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RebuildProgress, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RebuildProgressOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RebuildProgressView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RebuildProgressView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RebuildProgress { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `started_at` - #[must_use] - pub fn started_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().started_at - } - /// Position the rebuild has applied through, in the same units the finished - /// projection will report as its processed watermark. - /// - /// Field 2: `processed_watermark` - #[must_use] - pub fn processed_watermark(&self) -> u64 { - self.0.reborrow().processed_watermark - } - /// Position the rebuild is working toward, as known when it started. - /// - /// Unset when the rebuilder does not know its own end, which is the honest - /// answer for a rebuild over a stream that is still being written to. Reported - /// as unset rather than as the current head, because a target that moves is a - /// percentage that goes backwards. - /// - /// Field 3: `target_watermark` - #[must_use] - pub fn target_watermark(&self) -> ::core::option::Option { - self.0.reborrow().target_watermark - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RebuildProgressOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RebuildProgressOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RebuildProgressOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RebuildProgressOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RebuildProgress { - type View<'a> = RebuildProgressView<'a>; - type ViewHandle = RebuildProgressOwnedView; -} -impl ::serde::Serialize for RebuildProgressOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// InvalidArgumentDetail names the offending input. It carries a field path -/// rather than a rendered sentence so a caller can map the failure back to its -/// own request structure. -#[derive(Clone, Debug, Default)] -pub struct InvalidArgumentDetailView<'a> { - /// Dotted path into the request message, for example `page_size`. - /// - /// Field 1: `field_path` - pub field_path: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> InvalidArgumentDetailView<'a> { - /**Whether required field `field_path` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_field_path(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for InvalidArgumentDetailView<'a> { - type Owned = super::super::InvalidArgumentDetail; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.field_path = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::InvalidArgumentDetail, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::InvalidArgumentDetail, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::InvalidArgumentDetail { - field_path: self.field_path.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for InvalidArgumentDetailView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.field_path) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.field_path, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for InvalidArgumentDetailView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("fieldPath", self.field_path)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for InvalidArgumentDetailView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "InvalidArgumentDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.InvalidArgumentDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.InvalidArgumentDetail"; -} -::buffa::impl_default_view_instance!(InvalidArgumentDetailView); -::buffa::impl_view_reborrow!(InvalidArgumentDetailView); -/** Self-contained, `'static` owned view of a `InvalidArgumentDetail` message. - - Wraps [`::buffa::OwnedView`]`<`[`InvalidArgumentDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`InvalidArgumentDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct InvalidArgumentDetailOwnedView( - ::buffa::OwnedView>, -); -impl InvalidArgumentDetailOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - InvalidArgumentDetailOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - InvalidArgumentDetailOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::InvalidArgumentDetail, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - InvalidArgumentDetailOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`InvalidArgumentDetailView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &InvalidArgumentDetailView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::InvalidArgumentDetail { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Dotted path into the request message, for example `page_size`. - /// - /// Field 1: `field_path` - #[must_use] - pub fn field_path(&self) -> &'_ str { - self.0.reborrow().field_path - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for InvalidArgumentDetailOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - InvalidArgumentDetailOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: InvalidArgumentDetailOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for InvalidArgumentDetailOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::InvalidArgumentDetail { - type View<'a> = InvalidArgumentDetailView<'a>; - type ViewHandle = InvalidArgumentDetailOwnedView; -} -impl ::serde::Serialize for InvalidArgumentDetailOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.query_error.__view_oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.query_error.__view_oneof.rs deleted file mode 100644 index f4f949a8c..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.query_error.__view_oneof.rs +++ /dev/null @@ -1,34 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/query_error.proto - -pub mod query_error { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Detail<'a> { - UnsupportedContractVersion( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::UnsupportedContractVersionDetailView< - 'a, - >, - >, - ), - StaleCursor( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::StaleCursorDetailView<'a>, - >, - ), - ProjectionUnavailable( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ProjectionUnavailableDetailView< - 'a, - >, - >, - ), - InvalidArgument( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::InvalidArgumentDetailView<'a>, - >, - ), - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.query_error.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.query_error.rs deleted file mode 100644 index 4ed1c6828..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.query_error.rs +++ /dev/null @@ -1,1967 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/query_error.proto - -/// QueryErrorCode is the closed set of reasons a Session query fails. -/// -/// A caller that receives an unknown value here has reached a server newer than -/// its contract minor and must treat it as a non-retryable failure, not as -/// success and not as an unconditional retry. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum QueryErrorCode { - QUERY_ERROR_CODE_UNSPECIFIED = 0i32, - /// The session id resolves to no stream. Distinct from an existing session the - /// caller may not see, which is QUERY_ERROR_CODE_PERMISSION_DENIED, so that - /// probing cannot use the difference to prove existence. - QUERY_ERROR_CODE_SESSION_NOT_FOUND = 1i32, - /// The caller's declared major is one this server cannot render. Fail closed: - /// answering in an unreadable shape is worse than not answering. - QUERY_ERROR_CODE_UNSUPPORTED_CONTRACT_VERSION = 2i32, - /// The request is malformed: an unparsable id, a page size out of range, a - /// filter combination with no meaning. - QUERY_ERROR_CODE_INVALID_ARGUMENT = 3i32, - /// The page token was minted by this contract but no longer names a valid - /// position. See CursorValidity for what a cursor binds to and - /// StaleCursorReason for which binding broke. Restarting the scan is the fix. - QUERY_ERROR_CODE_STALE_CURSOR = 4i32, - /// The page token was not minted by this contract, is corrupt, fails its MAC, - /// or does not match the request it was presented with. Distinct from stale: - /// stale means it was valid and the view moved, so a caller can restart the - /// scan; malformed means the caller sent something this server never issued - /// for this request, and retrying will not help. - QUERY_ERROR_CODE_MALFORMED_CURSOR = 5i32, - /// The backing projection cannot serve the read as asked. Also how an - /// unsatisfiable ReadConsistency is reported: a requirement the server could - /// not meet is a failure, not a success carrying a flag. - QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE = 6i32, - /// The caller is not authorized for this session. Returned in place of - /// NOT_FOUND when disclosing the difference would leak existence. - QUERY_ERROR_CODE_PERMISSION_DENIED = 7i32, - /// The request is valid but too expensive to serve as asked, for example a - /// page size above the configured admission limit. - QUERY_ERROR_CODE_RESOURCE_EXHAUSTED = 8i32, - /// An unexpected server-side failure. Carries no detail on purpose. - QUERY_ERROR_CODE_INTERNAL = 9i32, -} -impl QueryErrorCode { - ///Idiomatic alias for [`Self::QUERY_ERROR_CODE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::QUERY_ERROR_CODE_UNSPECIFIED; - ///Idiomatic alias for [`Self::QUERY_ERROR_CODE_SESSION_NOT_FOUND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SessionNotFound: Self = Self::QUERY_ERROR_CODE_SESSION_NOT_FOUND; - ///Idiomatic alias for [`Self::QUERY_ERROR_CODE_UNSUPPORTED_CONTRACT_VERSION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const UnsupportedContractVersion: Self = Self::QUERY_ERROR_CODE_UNSUPPORTED_CONTRACT_VERSION; - ///Idiomatic alias for [`Self::QUERY_ERROR_CODE_INVALID_ARGUMENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const InvalidArgument: Self = Self::QUERY_ERROR_CODE_INVALID_ARGUMENT; - ///Idiomatic alias for [`Self::QUERY_ERROR_CODE_STALE_CURSOR`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const StaleCursor: Self = Self::QUERY_ERROR_CODE_STALE_CURSOR; - ///Idiomatic alias for [`Self::QUERY_ERROR_CODE_MALFORMED_CURSOR`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const MalformedCursor: Self = Self::QUERY_ERROR_CODE_MALFORMED_CURSOR; - ///Idiomatic alias for [`Self::QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ProjectionUnavailable: Self = Self::QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE; - ///Idiomatic alias for [`Self::QUERY_ERROR_CODE_PERMISSION_DENIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const PermissionDenied: Self = Self::QUERY_ERROR_CODE_PERMISSION_DENIED; - ///Idiomatic alias for [`Self::QUERY_ERROR_CODE_RESOURCE_EXHAUSTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ResourceExhausted: Self = Self::QUERY_ERROR_CODE_RESOURCE_EXHAUSTED; - ///Idiomatic alias for [`Self::QUERY_ERROR_CODE_INTERNAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Internal: Self = Self::QUERY_ERROR_CODE_INTERNAL; -} -impl ::core::default::Default for QueryErrorCode { - fn default() -> Self { - Self::QUERY_ERROR_CODE_UNSPECIFIED - } -} -impl ::serde::Serialize for QueryErrorCode { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for QueryErrorCode { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = QueryErrorCode; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(QueryErrorCode) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for QueryErrorCode { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for QueryErrorCode { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::QUERY_ERROR_CODE_UNSPECIFIED), - 1i32 => { - ::core::option::Option::Some(Self::QUERY_ERROR_CODE_SESSION_NOT_FOUND) - } - 2i32 => { - ::core::option::Option::Some( - Self::QUERY_ERROR_CODE_UNSUPPORTED_CONTRACT_VERSION, - ) - } - 3i32 => ::core::option::Option::Some(Self::QUERY_ERROR_CODE_INVALID_ARGUMENT), - 4i32 => ::core::option::Option::Some(Self::QUERY_ERROR_CODE_STALE_CURSOR), - 5i32 => ::core::option::Option::Some(Self::QUERY_ERROR_CODE_MALFORMED_CURSOR), - 6i32 => { - ::core::option::Option::Some( - Self::QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE, - ) - } - 7i32 => { - ::core::option::Option::Some(Self::QUERY_ERROR_CODE_PERMISSION_DENIED) - } - 8i32 => { - ::core::option::Option::Some(Self::QUERY_ERROR_CODE_RESOURCE_EXHAUSTED) - } - 9i32 => ::core::option::Option::Some(Self::QUERY_ERROR_CODE_INTERNAL), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::QUERY_ERROR_CODE_UNSPECIFIED => "QUERY_ERROR_CODE_UNSPECIFIED", - Self::QUERY_ERROR_CODE_SESSION_NOT_FOUND => { - "QUERY_ERROR_CODE_SESSION_NOT_FOUND" - } - Self::QUERY_ERROR_CODE_UNSUPPORTED_CONTRACT_VERSION => { - "QUERY_ERROR_CODE_UNSUPPORTED_CONTRACT_VERSION" - } - Self::QUERY_ERROR_CODE_INVALID_ARGUMENT => { - "QUERY_ERROR_CODE_INVALID_ARGUMENT" - } - Self::QUERY_ERROR_CODE_STALE_CURSOR => "QUERY_ERROR_CODE_STALE_CURSOR", - Self::QUERY_ERROR_CODE_MALFORMED_CURSOR => { - "QUERY_ERROR_CODE_MALFORMED_CURSOR" - } - Self::QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE => { - "QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE" - } - Self::QUERY_ERROR_CODE_PERMISSION_DENIED => { - "QUERY_ERROR_CODE_PERMISSION_DENIED" - } - Self::QUERY_ERROR_CODE_RESOURCE_EXHAUSTED => { - "QUERY_ERROR_CODE_RESOURCE_EXHAUSTED" - } - Self::QUERY_ERROR_CODE_INTERNAL => "QUERY_ERROR_CODE_INTERNAL", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "QUERY_ERROR_CODE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::QUERY_ERROR_CODE_UNSPECIFIED) - } - "QUERY_ERROR_CODE_SESSION_NOT_FOUND" => { - ::core::option::Option::Some(Self::QUERY_ERROR_CODE_SESSION_NOT_FOUND) - } - "QUERY_ERROR_CODE_UNSUPPORTED_CONTRACT_VERSION" => { - ::core::option::Option::Some( - Self::QUERY_ERROR_CODE_UNSUPPORTED_CONTRACT_VERSION, - ) - } - "QUERY_ERROR_CODE_INVALID_ARGUMENT" => { - ::core::option::Option::Some(Self::QUERY_ERROR_CODE_INVALID_ARGUMENT) - } - "QUERY_ERROR_CODE_STALE_CURSOR" => { - ::core::option::Option::Some(Self::QUERY_ERROR_CODE_STALE_CURSOR) - } - "QUERY_ERROR_CODE_MALFORMED_CURSOR" => { - ::core::option::Option::Some(Self::QUERY_ERROR_CODE_MALFORMED_CURSOR) - } - "QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE" => { - ::core::option::Option::Some( - Self::QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE, - ) - } - "QUERY_ERROR_CODE_PERMISSION_DENIED" => { - ::core::option::Option::Some(Self::QUERY_ERROR_CODE_PERMISSION_DENIED) - } - "QUERY_ERROR_CODE_RESOURCE_EXHAUSTED" => { - ::core::option::Option::Some(Self::QUERY_ERROR_CODE_RESOURCE_EXHAUSTED) - } - "QUERY_ERROR_CODE_INTERNAL" => { - ::core::option::Option::Some(Self::QUERY_ERROR_CODE_INTERNAL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::QUERY_ERROR_CODE_UNSPECIFIED, - Self::QUERY_ERROR_CODE_SESSION_NOT_FOUND, - Self::QUERY_ERROR_CODE_UNSUPPORTED_CONTRACT_VERSION, - Self::QUERY_ERROR_CODE_INVALID_ARGUMENT, - Self::QUERY_ERROR_CODE_STALE_CURSOR, - Self::QUERY_ERROR_CODE_MALFORMED_CURSOR, - Self::QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE, - Self::QUERY_ERROR_CODE_PERMISSION_DENIED, - Self::QUERY_ERROR_CODE_RESOURCE_EXHAUSTED, - Self::QUERY_ERROR_CODE_INTERNAL, - ] - } -} -/// StaleCursorReason is what invalidated a cursor. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum StaleCursorReason { - STALE_CURSOR_REASON_UNSPECIFIED = 0i32, - /// A rewind moved the effective history boundary the cursor was anchored to. - STALE_CURSOR_REASON_REWOUND = 1i32, - /// A redaction or artifact erasure changed the prefix the cursor covered. - STALE_CURSOR_REASON_PRIVACY_CHANGED = 2i32, - /// The projection the cursor was minted against was replaced or rebuilt. - STALE_CURSOR_REASON_PROJECTION_REPLACED = 3i32, - /// The cursor was minted under a contract version this server no longer - /// renders. - STALE_CURSOR_REASON_CONTRACT_CHANGED = 4i32, - /// The cursor outlived the window a pinned scan is held open for. Nothing - /// about the session changed; the scan simply took too long. - STALE_CURSOR_REASON_EXPIRED = 5i32, - /// A compaction replaced a span the cursor was scanning. Reported separately - /// from REWOUND because nothing was retracted: the same history is still - /// there, summarized, and a caller may reasonably restart without treating it - /// as loss. - STALE_CURSOR_REASON_COMPACTED = 6i32, -} -impl StaleCursorReason { - ///Idiomatic alias for [`Self::STALE_CURSOR_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::STALE_CURSOR_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::STALE_CURSOR_REASON_REWOUND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Rewound: Self = Self::STALE_CURSOR_REASON_REWOUND; - ///Idiomatic alias for [`Self::STALE_CURSOR_REASON_PRIVACY_CHANGED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const PrivacyChanged: Self = Self::STALE_CURSOR_REASON_PRIVACY_CHANGED; - ///Idiomatic alias for [`Self::STALE_CURSOR_REASON_PROJECTION_REPLACED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ProjectionReplaced: Self = Self::STALE_CURSOR_REASON_PROJECTION_REPLACED; - ///Idiomatic alias for [`Self::STALE_CURSOR_REASON_CONTRACT_CHANGED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ContractChanged: Self = Self::STALE_CURSOR_REASON_CONTRACT_CHANGED; - ///Idiomatic alias for [`Self::STALE_CURSOR_REASON_EXPIRED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Expired: Self = Self::STALE_CURSOR_REASON_EXPIRED; - ///Idiomatic alias for [`Self::STALE_CURSOR_REASON_COMPACTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Compacted: Self = Self::STALE_CURSOR_REASON_COMPACTED; -} -impl ::core::default::Default for StaleCursorReason { - fn default() -> Self { - Self::STALE_CURSOR_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for StaleCursorReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for StaleCursorReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = StaleCursorReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(StaleCursorReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for StaleCursorReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for StaleCursorReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::STALE_CURSOR_REASON_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::STALE_CURSOR_REASON_REWOUND), - 2i32 => { - ::core::option::Option::Some(Self::STALE_CURSOR_REASON_PRIVACY_CHANGED) - } - 3i32 => { - ::core::option::Option::Some( - Self::STALE_CURSOR_REASON_PROJECTION_REPLACED, - ) - } - 4i32 => { - ::core::option::Option::Some(Self::STALE_CURSOR_REASON_CONTRACT_CHANGED) - } - 5i32 => ::core::option::Option::Some(Self::STALE_CURSOR_REASON_EXPIRED), - 6i32 => ::core::option::Option::Some(Self::STALE_CURSOR_REASON_COMPACTED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::STALE_CURSOR_REASON_UNSPECIFIED => "STALE_CURSOR_REASON_UNSPECIFIED", - Self::STALE_CURSOR_REASON_REWOUND => "STALE_CURSOR_REASON_REWOUND", - Self::STALE_CURSOR_REASON_PRIVACY_CHANGED => { - "STALE_CURSOR_REASON_PRIVACY_CHANGED" - } - Self::STALE_CURSOR_REASON_PROJECTION_REPLACED => { - "STALE_CURSOR_REASON_PROJECTION_REPLACED" - } - Self::STALE_CURSOR_REASON_CONTRACT_CHANGED => { - "STALE_CURSOR_REASON_CONTRACT_CHANGED" - } - Self::STALE_CURSOR_REASON_EXPIRED => "STALE_CURSOR_REASON_EXPIRED", - Self::STALE_CURSOR_REASON_COMPACTED => "STALE_CURSOR_REASON_COMPACTED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "STALE_CURSOR_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::STALE_CURSOR_REASON_UNSPECIFIED) - } - "STALE_CURSOR_REASON_REWOUND" => { - ::core::option::Option::Some(Self::STALE_CURSOR_REASON_REWOUND) - } - "STALE_CURSOR_REASON_PRIVACY_CHANGED" => { - ::core::option::Option::Some(Self::STALE_CURSOR_REASON_PRIVACY_CHANGED) - } - "STALE_CURSOR_REASON_PROJECTION_REPLACED" => { - ::core::option::Option::Some( - Self::STALE_CURSOR_REASON_PROJECTION_REPLACED, - ) - } - "STALE_CURSOR_REASON_CONTRACT_CHANGED" => { - ::core::option::Option::Some(Self::STALE_CURSOR_REASON_CONTRACT_CHANGED) - } - "STALE_CURSOR_REASON_EXPIRED" => { - ::core::option::Option::Some(Self::STALE_CURSOR_REASON_EXPIRED) - } - "STALE_CURSOR_REASON_COMPACTED" => { - ::core::option::Option::Some(Self::STALE_CURSOR_REASON_COMPACTED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::STALE_CURSOR_REASON_UNSPECIFIED, - Self::STALE_CURSOR_REASON_REWOUND, - Self::STALE_CURSOR_REASON_PRIVACY_CHANGED, - Self::STALE_CURSOR_REASON_PROJECTION_REPLACED, - Self::STALE_CURSOR_REASON_CONTRACT_CHANGED, - Self::STALE_CURSOR_REASON_EXPIRED, - Self::STALE_CURSOR_REASON_COMPACTED, - ] - } -} -/// ProjectionUnavailableReason is why the read could not be served. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ProjectionUnavailableReason { - PROJECTION_UNAVAILABLE_REASON_UNSPECIFIED = 0i32, - /// A rebuild is in progress and no prior generation is readable; the read is - /// expected to succeed later. A rebuild that keeps the prior generation - /// readable is not this: it answers, with PROJECTION_CONDITION_LAGGING. - PROJECTION_UNAVAILABLE_REASON_REBUILDING = 1i32, - /// The projection is present but failed its own validity checks. - PROJECTION_UNAVAILABLE_REASON_INVALID = 2i32, - /// No projection exists for this scope yet. - PROJECTION_UNAVAILABLE_REASON_MISSING = 3i32, - /// The projection is too far behind to satisfy the requested consistency. - PROJECTION_UNAVAILABLE_REASON_LAGGING = 4i32, -} -impl ProjectionUnavailableReason { - ///Idiomatic alias for [`Self::PROJECTION_UNAVAILABLE_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::PROJECTION_UNAVAILABLE_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::PROJECTION_UNAVAILABLE_REASON_REBUILDING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Rebuilding: Self = Self::PROJECTION_UNAVAILABLE_REASON_REBUILDING; - ///Idiomatic alias for [`Self::PROJECTION_UNAVAILABLE_REASON_INVALID`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Invalid: Self = Self::PROJECTION_UNAVAILABLE_REASON_INVALID; - ///Idiomatic alias for [`Self::PROJECTION_UNAVAILABLE_REASON_MISSING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Missing: Self = Self::PROJECTION_UNAVAILABLE_REASON_MISSING; - ///Idiomatic alias for [`Self::PROJECTION_UNAVAILABLE_REASON_LAGGING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Lagging: Self = Self::PROJECTION_UNAVAILABLE_REASON_LAGGING; -} -impl ::core::default::Default for ProjectionUnavailableReason { - fn default() -> Self { - Self::PROJECTION_UNAVAILABLE_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for ProjectionUnavailableReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ProjectionUnavailableReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ProjectionUnavailableReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(ProjectionUnavailableReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ProjectionUnavailableReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ProjectionUnavailableReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some( - Self::PROJECTION_UNAVAILABLE_REASON_UNSPECIFIED, - ) - } - 1i32 => { - ::core::option::Option::Some( - Self::PROJECTION_UNAVAILABLE_REASON_REBUILDING, - ) - } - 2i32 => { - ::core::option::Option::Some(Self::PROJECTION_UNAVAILABLE_REASON_INVALID) - } - 3i32 => { - ::core::option::Option::Some(Self::PROJECTION_UNAVAILABLE_REASON_MISSING) - } - 4i32 => { - ::core::option::Option::Some(Self::PROJECTION_UNAVAILABLE_REASON_LAGGING) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::PROJECTION_UNAVAILABLE_REASON_UNSPECIFIED => { - "PROJECTION_UNAVAILABLE_REASON_UNSPECIFIED" - } - Self::PROJECTION_UNAVAILABLE_REASON_REBUILDING => { - "PROJECTION_UNAVAILABLE_REASON_REBUILDING" - } - Self::PROJECTION_UNAVAILABLE_REASON_INVALID => { - "PROJECTION_UNAVAILABLE_REASON_INVALID" - } - Self::PROJECTION_UNAVAILABLE_REASON_MISSING => { - "PROJECTION_UNAVAILABLE_REASON_MISSING" - } - Self::PROJECTION_UNAVAILABLE_REASON_LAGGING => { - "PROJECTION_UNAVAILABLE_REASON_LAGGING" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "PROJECTION_UNAVAILABLE_REASON_UNSPECIFIED" => { - ::core::option::Option::Some( - Self::PROJECTION_UNAVAILABLE_REASON_UNSPECIFIED, - ) - } - "PROJECTION_UNAVAILABLE_REASON_REBUILDING" => { - ::core::option::Option::Some( - Self::PROJECTION_UNAVAILABLE_REASON_REBUILDING, - ) - } - "PROJECTION_UNAVAILABLE_REASON_INVALID" => { - ::core::option::Option::Some(Self::PROJECTION_UNAVAILABLE_REASON_INVALID) - } - "PROJECTION_UNAVAILABLE_REASON_MISSING" => { - ::core::option::Option::Some(Self::PROJECTION_UNAVAILABLE_REASON_MISSING) - } - "PROJECTION_UNAVAILABLE_REASON_LAGGING" => { - ::core::option::Option::Some(Self::PROJECTION_UNAVAILABLE_REASON_LAGGING) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::PROJECTION_UNAVAILABLE_REASON_UNSPECIFIED, - Self::PROJECTION_UNAVAILABLE_REASON_REBUILDING, - Self::PROJECTION_UNAVAILABLE_REASON_INVALID, - Self::PROJECTION_UNAVAILABLE_REASON_MISSING, - Self::PROJECTION_UNAVAILABLE_REASON_LAGGING, - ] - } -} -/// QueryError is the typed failure payload for every Session query. -/// -/// It is not carried inside a success response. A query either answers or -/// fails, and collapsing the two into one message invites a caller to read a -/// zero-valued success shape as an empty result. On the JSON-RPC-over-NATS -/// binding (ADR#0056) this rides in the error object's `data`; the numeric code -/// assignment is a separate reservation and is deliberately not invented here. -/// -/// `code` is the machine-readable discriminant and the only field a caller -/// should branch on. `message` is for humans and may change at any time without -/// a version bump, so treating it as an API is a bug. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct QueryError { - /// Field 1: `code` - #[serde(rename = "code", with = "::buffa::json_helpers::proto_enum")] - pub code: ::buffa::EnumValue, - /// Human-readable, non-contractual, safe to log. Never parse it. - /// - /// Field 2: `message` - #[serde(rename = "message", with = "::buffa::json_helpers::proto_string")] - pub message: ::buffa::alloc::string::String, - #[serde(flatten)] - pub detail: ::core::option::Option<__buffa::oneof::query_error::Detail>, -} -impl ::core::fmt::Debug for QueryError { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("QueryError") - .field("code", &self.code) - .field("message", &self.message) - .field("detail", &self.detail) - .finish() - } -} -impl QueryError { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.QueryError"; -} -::buffa::impl_default_instance!(QueryError); -impl ::buffa::MessageName for QueryError { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "QueryError"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.QueryError"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.QueryError"; -} -impl ::buffa::Message for QueryError { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.code.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.message) as u64; - if let ::core::option::Option::Some(ref v) = self.detail { - match v { - __buffa::oneof::query_error::Detail::UnsupportedContractVersion(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::query_error::Detail::StaleCursor(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::query_error::Detail::ProjectionUnavailable(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::query_error::Detail::InvalidArgument(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.code.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.message, buf); - if let ::core::option::Option::Some(ref v) = self.detail { - match v { - __buffa::oneof::query_error::Detail::UnsupportedContractVersion(x) => { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::query_error::Detail::StaleCursor(x) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::query_error::Detail::ProjectionUnavailable(x) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::query_error::Detail::InvalidArgument(x) => { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.code = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.message, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::query_error::Detail::UnsupportedContractVersion( - ref mut existing, - ), - ) = self.detail - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.detail = ::core::option::Option::Some( - __buffa::oneof::query_error::Detail::UnsupportedContractVersion( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::query_error::Detail::StaleCursor(ref mut existing), - ) = self.detail - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.detail = ::core::option::Option::Some( - __buffa::oneof::query_error::Detail::StaleCursor( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::query_error::Detail::ProjectionUnavailable( - ref mut existing, - ), - ) = self.detail - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.detail = ::core::option::Option::Some( - __buffa::oneof::query_error::Detail::ProjectionUnavailable( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::query_error::Detail::InvalidArgument( - ref mut existing, - ), - ) = self.detail - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.detail = ::core::option::Option::Some( - __buffa::oneof::query_error::Detail::InvalidArgument( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.code = ::buffa::EnumValue::from(0); - self.message.clear(); - self.detail = ::core::option::Option::None; - } -} -impl<'de> serde::Deserialize<'de> for QueryError { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = QueryError; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct QueryError") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __f_code: ::core::option::Option< - ::buffa::EnumValue, - > = None; - let mut __f_message: ::core::option::Option< - ::buffa::alloc::string::String, - > = None; - let mut __oneof_detail: ::core::option::Option< - __buffa::oneof::query_error::Detail, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "code" => { - __f_code = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::EnumValue; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::EnumValue, - D::Error, - > { - ::buffa::json_helpers::proto_enum::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "message" => { - __f_message = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::alloc::string::String; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::string::String, - D::Error, - > { - ::buffa::json_helpers::proto_string::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "unsupportedContractVersion" - | "unsupported_contract_version" => { - let v: ::core::option::Option< - UnsupportedContractVersionDetail, - > = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - UnsupportedContractVersionDetail, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_detail.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'detail'", - ), - ); - } - __oneof_detail = Some( - __buffa::oneof::query_error::Detail::UnsupportedContractVersion( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "staleCursor" | "stale_cursor" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - StaleCursorDetail, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_detail.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'detail'", - ), - ); - } - __oneof_detail = Some( - __buffa::oneof::query_error::Detail::StaleCursor( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "projectionUnavailable" | "projection_unavailable" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ProjectionUnavailableDetail, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_detail.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'detail'", - ), - ); - } - __oneof_detail = Some( - __buffa::oneof::query_error::Detail::ProjectionUnavailable( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "invalidArgument" | "invalid_argument" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - InvalidArgumentDetail, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_detail.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'detail'", - ), - ); - } - __oneof_detail = Some( - __buffa::oneof::query_error::Detail::InvalidArgument( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - if let ::core::option::Option::Some(v) = __f_code { - __r.code = v; - } - if let ::core::option::Option::Some(v) = __f_message { - __r.message = v; - } - __r.detail = __oneof_detail; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for QueryError { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __QUERY_ERROR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.QueryError", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod query_error { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::query_error::Detail; - #[doc(inline)] - pub use super::__buffa::view::oneof::query_error::Detail as DetailView; -} -/// UnsupportedContractVersionDetail tells the caller what it would have to -/// speak, so an incompatibility is actionable rather than merely reported. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct UnsupportedContractVersionDetail { - /// Field 1: `requested` - #[serde(rename = "requested")] - pub requested: ::buffa::MessageField< - ContractVersion, - ::buffa::Inline, - >, - /// Inclusive range of majors this server can render. - /// - /// Field 2: `supported_major_min` - #[serde( - rename = "supportedMajorMin", - alias = "supported_major_min", - with = "::buffa::json_helpers::uint32" - )] - pub supported_major_min: u32, - /// Field 3: `supported_major_max` - #[serde( - rename = "supportedMajorMax", - alias = "supported_major_max", - with = "::buffa::json_helpers::uint32" - )] - pub supported_major_max: u32, -} -impl ::core::fmt::Debug for UnsupportedContractVersionDetail { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("UnsupportedContractVersionDetail") - .field("requested", &self.requested) - .field("supported_major_min", &self.supported_major_min) - .field("supported_major_max", &self.supported_major_max) - .finish() - } -} -impl UnsupportedContractVersionDetail { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.UnsupportedContractVersionDetail"; -} -::buffa::impl_default_instance!(UnsupportedContractVersionDetail); -impl ::buffa::MessageName for UnsupportedContractVersionDetail { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "UnsupportedContractVersionDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.UnsupportedContractVersionDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.UnsupportedContractVersionDetail"; -} -impl ::buffa::Message for UnsupportedContractVersionDetail { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.requested.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.requested.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.supported_major_min) as u64; - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.supported_major_max) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.requested.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.requested.write_to(__cache, buf); - } - ::buffa::types::put_uint32_field(2u32, self.supported_major_min, buf); - ::buffa::types::put_uint32_field(3u32, self.supported_major_max, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.requested.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.supported_major_min = ::buffa::types::decode_uint32(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.supported_major_max = ::buffa::types::decode_uint32(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.requested = ::buffa::MessageField::none(); - self.supported_major_min = 0u32; - self.supported_major_max = 0u32; - } -} -impl ::buffa::json_helpers::ProtoElemJson for UnsupportedContractVersionDetail { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __UNSUPPORTED_CONTRACT_VERSION_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.UnsupportedContractVersionDetail", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// StaleCursorDetail says why a previously valid cursor stopped being valid, so -/// a caller can tell a benign restart from a view that changed underneath it. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct StaleCursorDetail { - /// Field 1: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for StaleCursorDetail { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("StaleCursorDetail").field("reason", &self.reason).finish() - } -} -impl StaleCursorDetail { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.StaleCursorDetail"; -} -::buffa::impl_default_instance!(StaleCursorDetail); -impl ::buffa::MessageName for StaleCursorDetail { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "StaleCursorDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.StaleCursorDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.StaleCursorDetail"; -} -impl ::buffa::Message for StaleCursorDetail { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.reason = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for StaleCursorDetail { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __STALE_CURSOR_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.StaleCursorDetail", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ProjectionUnavailableDetail distinguishes "come back shortly" from "this is -/// broken", which a caller cannot guess from the code alone. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ProjectionUnavailableDetail { - /// Field 1: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// How current the projection was when it gave up. Present for REASON_LAGGING, - /// where it is the difference between an actionable failure and a bare one: a - /// caller that can see it reached the required position minus two can retry - /// with a larger budget, while one that cannot see it can only guess. - /// - /// Field 2: `freshness` - #[serde( - rename = "freshness", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub freshness: ::buffa::MessageField< - ProjectionFreshness, - ::buffa::Inline, - >, - /// How far along the rebuild is. Present for REASON_REBUILDING when the - /// rebuilder can report it. - /// - /// Without this, "come back shortly" is a claim with no number attached, and a - /// caller has to choose between polling a rebuild that will take four hours - /// and giving up on one that will take four seconds. Absent means the - /// rebuilder could not say, which is different from a rebuild that has made no - /// progress. - /// - /// Field 3: `rebuild` - #[serde( - rename = "rebuild", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub rebuild: ::buffa::MessageField< - RebuildProgress, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for ProjectionUnavailableDetail { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ProjectionUnavailableDetail") - .field("reason", &self.reason) - .field("freshness", &self.freshness) - .field("rebuild", &self.rebuild) - .finish() - } -} -impl ProjectionUnavailableDetail { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ProjectionUnavailableDetail"; -} -::buffa::impl_default_instance!(ProjectionUnavailableDetail); -impl ::buffa::MessageName for ProjectionUnavailableDetail { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ProjectionUnavailableDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ProjectionUnavailableDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ProjectionUnavailableDetail"; -} -impl ::buffa::Message for ProjectionUnavailableDetail { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.freshness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.freshness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.rebuild.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.rebuild.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - if self.freshness.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.freshness.write_to(__cache, buf); - } - if self.rebuild.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.rebuild.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.freshness.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.rebuild.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.reason = ::buffa::EnumValue::from(0); - self.freshness = ::buffa::MessageField::none(); - self.rebuild = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ProjectionUnavailableDetail { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PROJECTION_UNAVAILABLE_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ProjectionUnavailableDetail", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// RebuildProgress is how far a projection rebuild has got. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RebuildProgress { - /// Field 1: `started_at` - #[serde(rename = "startedAt", alias = "started_at")] - pub started_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// Position the rebuild has applied through, in the same units the finished - /// projection will report as its processed watermark. - /// - /// Field 2: `processed_watermark` - #[serde( - rename = "processedWatermark", - alias = "processed_watermark", - with = "::buffa::json_helpers::uint64" - )] - pub processed_watermark: u64, - /// Position the rebuild is working toward, as known when it started. - /// - /// Unset when the rebuilder does not know its own end, which is the honest - /// answer for a rebuild over a stream that is still being written to. Reported - /// as unset rather than as the current head, because a target that moves is a - /// percentage that goes backwards. - /// - /// Field 3: `target_watermark` - #[serde( - rename = "targetWatermark", - alias = "target_watermark", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub target_watermark: ::core::option::Option, -} -impl ::core::fmt::Debug for RebuildProgress { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RebuildProgress") - .field("started_at", &self.started_at) - .field("processed_watermark", &self.processed_watermark) - .field("target_watermark", &self.target_watermark) - .finish() - } -} -impl RebuildProgress { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.RebuildProgress"; -} -impl RebuildProgress { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::target_watermark`] to `Some(value)`, consuming and returning `self`. - pub fn with_target_watermark(mut self, value: u64) -> Self { - self.target_watermark = Some(value); - self - } -} -::buffa::impl_default_instance!(RebuildProgress); -impl ::buffa::MessageName for RebuildProgress { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "RebuildProgress"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.RebuildProgress"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.RebuildProgress"; -} -impl ::buffa::Message for RebuildProgress { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.started_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.started_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.processed_watermark) as u64; - if let Some(v) = self.target_watermark { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.started_at.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.started_at.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(2u32, self.processed_watermark, buf); - if let Some(v) = self.target_watermark { - ::buffa::types::put_uint64_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.started_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.processed_watermark = ::buffa::types::decode_uint64(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.target_watermark = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.started_at = ::buffa::MessageField::none(); - self.processed_watermark = 0u64; - self.target_watermark = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for RebuildProgress { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REBUILD_PROGRESS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.RebuildProgress", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// InvalidArgumentDetail names the offending input. It carries a field path -/// rather than a rendered sentence so a caller can map the failure back to its -/// own request structure. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct InvalidArgumentDetail { - /// Dotted path into the request message, for example `page_size`. - /// - /// Field 1: `field_path` - #[serde( - rename = "fieldPath", - alias = "field_path", - with = "::buffa::json_helpers::proto_string" - )] - pub field_path: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for InvalidArgumentDetail { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("InvalidArgumentDetail") - .field("field_path", &self.field_path) - .finish() - } -} -impl InvalidArgumentDetail { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.InvalidArgumentDetail"; -} -::buffa::impl_default_instance!(InvalidArgumentDetail); -impl ::buffa::MessageName for InvalidArgumentDetail { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "InvalidArgumentDetail"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.InvalidArgumentDetail"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.InvalidArgumentDetail"; -} -impl ::buffa::Message for InvalidArgumentDetail { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.field_path) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.field_path, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.field_path, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.field_path.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for InvalidArgumentDetail { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __INVALID_ARGUMENT_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.InvalidArgumentDetail", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.read_consistency.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.read_consistency.__view.rs deleted file mode 100644 index 72602215d..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.read_consistency.__view.rs +++ /dev/null @@ -1,737 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/read_consistency.proto - -/// ReadConsistency is the freshness the caller requires, declared before the -/// server answers. -/// -/// The case it exists for is read-your-writes. A caller that has just issued a -/// command knows the position its write landed at, and an eventual read of a -/// projection that has not applied it yet returns a view that is correct and -/// wrong at the same time: correct as of the projection, wrong as of what the -/// caller knows to have happened. Redaction is the sharp version, since the view -/// still contains content the caller was told is gone. -/// -/// Every request carries one. Unset is EVENTUAL, which keeps the common read -/// cheap while still reporting freshness on the way back. -#[derive(Clone, Debug, Default)] -pub struct ReadConsistencyView<'a> { - /// Field 1: `mode` - pub mode: ::buffa::EnumValue, - /// Required for MODE_AT_LEAST, ignored otherwise. A MODE_AT_LEAST request with - /// no token is QUERY_ERROR_CODE_INVALID_ARGUMENT rather than a silent - /// downgrade to an eventual read. - /// - /// Field 2: `token` - pub token: ::buffa::MessageFieldView< - super::super::__buffa::view::ConsistencyTokenView<'a>, - >, - /// How long the read may wait for the projection to reach the token. Unset or - /// zero means do not wait: answer if the projection is already there, fail - /// otherwise. - /// - /// The budget is the caller's because only the caller knows whether it is - /// serving an interactive request. A read that cannot be satisfied within it - /// fails with QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE and - /// PROJECTION_UNAVAILABLE_REASON_LAGGING, carrying the freshness it reached so - /// the caller can retry with a larger budget or fall back to an eventual read - /// on purpose. - /// - /// Field 3: `max_wait` - pub max_wait: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReadConsistencyView<'a> { - /**Whether required field `mode` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_mode(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ReadConsistencyView<'a> { - type Owned = super::super::ReadConsistency; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.mode = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.token.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.token = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.max_wait.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.max_wait = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReadConsistency { - mode: self.mode, - token: match self.token.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ConsistencyToken, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - max_wait: match self.max_wait.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReadConsistencyView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.mode.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.token.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.token.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.max_wait.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.max_wait.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.mode.to_i32(), buf); - if self.token.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.token.write_to(__cache, buf); - } - if self.max_wait.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.max_wait.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReadConsistencyView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("mode", &self.mode)?; - } - { - if let ::core::option::Option::Some(__v) = self.token.as_option() { - __map.serialize_entry("token", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.max_wait.as_option() { - __map.serialize_entry("maxWait", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReadConsistencyView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ReadConsistency"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ReadConsistency"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ReadConsistency"; -} -::buffa::impl_default_view_instance!(ReadConsistencyView); -::buffa::impl_view_reborrow!(ReadConsistencyView); -/** Self-contained, `'static` owned view of a `ReadConsistency` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReadConsistencyView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReadConsistencyView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReadConsistencyOwnedView(::buffa::OwnedView>); -impl ReadConsistencyOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReadConsistencyOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReadConsistencyOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReadConsistency, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReadConsistencyOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReadConsistencyView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReadConsistencyView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReadConsistency { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `mode` - #[must_use] - pub fn mode(&self) -> ::buffa::EnumValue { - self.0.reborrow().mode - } - /// Required for MODE_AT_LEAST, ignored otherwise. A MODE_AT_LEAST request with - /// no token is QUERY_ERROR_CODE_INVALID_ARGUMENT rather than a silent - /// downgrade to an eventual read. - /// - /// Field 2: `token` - #[must_use] - pub fn token( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ConsistencyTokenView<'_>, - > { - &self.0.reborrow().token - } - /// How long the read may wait for the projection to reach the token. Unset or - /// zero means do not wait: answer if the projection is already there, fail - /// otherwise. - /// - /// The budget is the caller's because only the caller knows whether it is - /// serving an interactive request. A read that cannot be satisfied within it - /// fails with QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE and - /// PROJECTION_UNAVAILABLE_REASON_LAGGING, carrying the freshness it reached so - /// the caller can retry with a larger budget or fall back to an eventual read - /// on purpose. - /// - /// Field 3: `max_wait` - #[must_use] - pub fn max_wait( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().max_wait - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReadConsistencyOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReadConsistencyOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReadConsistencyOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReadConsistencyOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReadConsistency { - type View<'a> = ReadConsistencyView<'a>; - type ViewHandle = ReadConsistencyOwnedView; -} -impl ::serde::Serialize for ReadConsistencyOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ConsistencyToken names a write the read must reflect. -/// -/// Unlike a page cursor this is a plain typed message, not opaque authenticated -/// bytes, and the difference is deliberate. A cursor names a scan position and -/// is therefore an instruction the server follows, so a forged one is a way to -/// read what the caller should not. A token only ever makes a read wait or fail: -/// the worst a forged one achieves is the caller's own bounded wait followed by -/// a LAGGING error, and it discloses nothing. Paying for a MAC to prevent that -/// would buy nothing and cost every caller the ability to debug its own reads. -/// -/// The write path mints these. The command-response shape that hands one back is -/// not defined yet. -#[derive(Clone, Debug, Default)] -pub struct ConsistencyTokenView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// The SessionOrdinal the caller's write landed at. - /// - /// An ordinal rather than a stream sequence, for the same reason page cursors - /// use one: it is fold-derived and reproduces identically on replay, so it - /// survives a projection rebuild. A list read uses this too, since a list - /// projection that consumes many streams still knows how far it has applied - /// each one, and "the list reflects my change to session X" is the only - /// freshness question a caller actually has. - /// - /// Field 2: `session_ordinal` - pub session_ordinal: u64, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ConsistencyTokenView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `session_ordinal` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_ordinal(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ConsistencyTokenView<'a> { - type Owned = super::super::ConsistencyToken; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.session_ordinal = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ConsistencyToken { - session_id: self.session_id.to_string(), - session_ordinal: self.session_ordinal, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ConsistencyTokenView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.session_ordinal) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_uint64_field(2u32, self.session_ordinal, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ConsistencyTokenView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map - .serialize_entry( - "sessionOrdinal", - &::buffa::json_helpers::ProtoJson(&self.session_ordinal), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ConsistencyTokenView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ConsistencyToken"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ConsistencyToken"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ConsistencyToken"; -} -::buffa::impl_default_view_instance!(ConsistencyTokenView); -::buffa::impl_view_reborrow!(ConsistencyTokenView); -/** Self-contained, `'static` owned view of a `ConsistencyToken` message. - - Wraps [`::buffa::OwnedView`]`<`[`ConsistencyTokenView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ConsistencyTokenView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ConsistencyTokenOwnedView(::buffa::OwnedView>); -impl ConsistencyTokenOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ConsistencyTokenOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ConsistencyTokenOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ConsistencyToken, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ConsistencyTokenOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ConsistencyTokenView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ConsistencyTokenView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ConsistencyToken { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// The SessionOrdinal the caller's write landed at. - /// - /// An ordinal rather than a stream sequence, for the same reason page cursors - /// use one: it is fold-derived and reproduces identically on replay, so it - /// survives a projection rebuild. A list read uses this too, since a list - /// projection that consumes many streams still knows how far it has applied - /// each one, and "the list reflects my change to session X" is the only - /// freshness question a caller actually has. - /// - /// Field 2: `session_ordinal` - #[must_use] - pub fn session_ordinal(&self) -> u64 { - self.0.reborrow().session_ordinal - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ConsistencyTokenOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ConsistencyTokenOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ConsistencyTokenOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ConsistencyTokenOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ConsistencyToken { - type View<'a> = ConsistencyTokenView<'a>; - type ViewHandle = ConsistencyTokenOwnedView; -} -impl ::serde::Serialize for ConsistencyTokenOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.read_consistency.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.read_consistency.rs deleted file mode 100644 index ae6b08546..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.read_consistency.rs +++ /dev/null @@ -1,517 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/read_consistency.proto - -/// ReadConsistencyMode is how strictly the read is bound to a known write. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ReadConsistencyMode { - /// Treated as EVENTUAL. Unset is the ordinary case, not an error, because - /// most reads have no write to be consistent with. - READ_CONSISTENCY_MODE_UNSPECIFIED = 0i32, - /// Serve whatever the projection has applied. Freshness is still reported. - READ_CONSISTENCY_MODE_EVENTUAL = 1i32, - /// Serve only once the projection has applied `token`. - READ_CONSISTENCY_MODE_AT_LEAST = 2i32, -} -impl ReadConsistencyMode { - ///Idiomatic alias for [`Self::READ_CONSISTENCY_MODE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::READ_CONSISTENCY_MODE_UNSPECIFIED; - ///Idiomatic alias for [`Self::READ_CONSISTENCY_MODE_EVENTUAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Eventual: Self = Self::READ_CONSISTENCY_MODE_EVENTUAL; - ///Idiomatic alias for [`Self::READ_CONSISTENCY_MODE_AT_LEAST`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const AtLeast: Self = Self::READ_CONSISTENCY_MODE_AT_LEAST; -} -impl ::core::default::Default for ReadConsistencyMode { - fn default() -> Self { - Self::READ_CONSISTENCY_MODE_UNSPECIFIED - } -} -impl ::serde::Serialize for ReadConsistencyMode { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ReadConsistencyMode { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ReadConsistencyMode; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(ReadConsistencyMode) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReadConsistencyMode { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ReadConsistencyMode { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::READ_CONSISTENCY_MODE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::READ_CONSISTENCY_MODE_EVENTUAL), - 2i32 => ::core::option::Option::Some(Self::READ_CONSISTENCY_MODE_AT_LEAST), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::READ_CONSISTENCY_MODE_UNSPECIFIED => { - "READ_CONSISTENCY_MODE_UNSPECIFIED" - } - Self::READ_CONSISTENCY_MODE_EVENTUAL => "READ_CONSISTENCY_MODE_EVENTUAL", - Self::READ_CONSISTENCY_MODE_AT_LEAST => "READ_CONSISTENCY_MODE_AT_LEAST", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "READ_CONSISTENCY_MODE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::READ_CONSISTENCY_MODE_UNSPECIFIED) - } - "READ_CONSISTENCY_MODE_EVENTUAL" => { - ::core::option::Option::Some(Self::READ_CONSISTENCY_MODE_EVENTUAL) - } - "READ_CONSISTENCY_MODE_AT_LEAST" => { - ::core::option::Option::Some(Self::READ_CONSISTENCY_MODE_AT_LEAST) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::READ_CONSISTENCY_MODE_UNSPECIFIED, - Self::READ_CONSISTENCY_MODE_EVENTUAL, - Self::READ_CONSISTENCY_MODE_AT_LEAST, - ] - } -} -/// ReadConsistency is the freshness the caller requires, declared before the -/// server answers. -/// -/// The case it exists for is read-your-writes. A caller that has just issued a -/// command knows the position its write landed at, and an eventual read of a -/// projection that has not applied it yet returns a view that is correct and -/// wrong at the same time: correct as of the projection, wrong as of what the -/// caller knows to have happened. Redaction is the sharp version, since the view -/// still contains content the caller was told is gone. -/// -/// Every request carries one. Unset is EVENTUAL, which keeps the common read -/// cheap while still reporting freshness on the way back. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReadConsistency { - /// Field 1: `mode` - #[serde(rename = "mode", with = "::buffa::json_helpers::proto_enum")] - pub mode: ::buffa::EnumValue, - /// Required for MODE_AT_LEAST, ignored otherwise. A MODE_AT_LEAST request with - /// no token is QUERY_ERROR_CODE_INVALID_ARGUMENT rather than a silent - /// downgrade to an eventual read. - /// - /// Field 2: `token` - #[serde( - rename = "token", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub token: ::buffa::MessageField< - ConsistencyToken, - ::buffa::Inline, - >, - /// How long the read may wait for the projection to reach the token. Unset or - /// zero means do not wait: answer if the projection is already there, fail - /// otherwise. - /// - /// The budget is the caller's because only the caller knows whether it is - /// serving an interactive request. A read that cannot be satisfied within it - /// fails with QUERY_ERROR_CODE_PROJECTION_UNAVAILABLE and - /// PROJECTION_UNAVAILABLE_REASON_LAGGING, carrying the freshness it reached so - /// the caller can retry with a larger budget or fall back to an eventual read - /// on purpose. - /// - /// Field 3: `max_wait` - #[serde( - rename = "maxWait", - alias = "max_wait", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub max_wait: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, -} -impl ::core::fmt::Debug for ReadConsistency { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReadConsistency") - .field("mode", &self.mode) - .field("token", &self.token) - .field("max_wait", &self.max_wait) - .finish() - } -} -impl ReadConsistency { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ReadConsistency"; -} -::buffa::impl_default_instance!(ReadConsistency); -impl ::buffa::MessageName for ReadConsistency { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ReadConsistency"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ReadConsistency"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ReadConsistency"; -} -impl ::buffa::Message for ReadConsistency { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.mode.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.token.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.token.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.max_wait.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.max_wait.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.mode.to_i32(), buf); - if self.token.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.token.write_to(__cache, buf); - } - if self.max_wait.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.max_wait.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.mode = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.token.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.max_wait.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.mode = ::buffa::EnumValue::from(0); - self.token = ::buffa::MessageField::none(); - self.max_wait = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReadConsistency { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __READ_CONSISTENCY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ReadConsistency", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ConsistencyToken names a write the read must reflect. -/// -/// Unlike a page cursor this is a plain typed message, not opaque authenticated -/// bytes, and the difference is deliberate. A cursor names a scan position and -/// is therefore an instruction the server follows, so a forged one is a way to -/// read what the caller should not. A token only ever makes a read wait or fail: -/// the worst a forged one achieves is the caller's own bounded wait followed by -/// a LAGGING error, and it discloses nothing. Paying for a MAC to prevent that -/// would buy nothing and cost every caller the ability to debug its own reads. -/// -/// The write path mints these. The command-response shape that hands one back is -/// not defined yet. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ConsistencyToken { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// The SessionOrdinal the caller's write landed at. - /// - /// An ordinal rather than a stream sequence, for the same reason page cursors - /// use one: it is fold-derived and reproduces identically on replay, so it - /// survives a projection rebuild. A list read uses this too, since a list - /// projection that consumes many streams still knows how far it has applied - /// each one, and "the list reflects my change to session X" is the only - /// freshness question a caller actually has. - /// - /// Field 2: `session_ordinal` - #[serde( - rename = "sessionOrdinal", - alias = "session_ordinal", - with = "::buffa::json_helpers::uint64" - )] - pub session_ordinal: u64, -} -impl ::core::fmt::Debug for ConsistencyToken { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ConsistencyToken") - .field("session_id", &self.session_id) - .field("session_ordinal", &self.session_ordinal) - .finish() - } -} -impl ConsistencyToken { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ConsistencyToken"; -} -::buffa::impl_default_instance!(ConsistencyToken); -impl ::buffa::MessageName for ConsistencyToken { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ConsistencyToken"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ConsistencyToken"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ConsistencyToken"; -} -impl ::buffa::Message for ConsistencyToken { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.session_ordinal) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_uint64_field(2u32, self.session_ordinal, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.session_ordinal = ::buffa::types::decode_uint64(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.session_ordinal = 0u64; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ConsistencyToken { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CONSISTENCY_TOKEN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ConsistencyToken", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.session_view.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.session_view.__view.rs deleted file mode 100644 index 6262d2ff0..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.session_view.__view.rs +++ /dev/null @@ -1,3889 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/session_view.proto - -/// SessionSummary is the list-row shape: enough to render a picker, and no more. -/// -/// It deliberately excludes anything requiring a per-session fan-out to compute, -/// because a list query that costs one read per row stops being a list query. -#[derive(Clone, Debug, Default)] -pub struct SessionSummaryView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `lifecycle` - pub lifecycle: ::buffa::EnumValue, - /// Unset while the session is active. - /// - /// Field 3: `terminal_reason` - pub terminal_reason: ::core::option::Option< - ::buffa::EnumValue, - >, - /// Display name, resolved by the precedence on TitleSource. Always set: when - /// there is nothing to show it holds a server-chosen fallback rather than an - /// empty string, so a picker never has to invent one and two clients never - /// invent different ones. - /// - /// Field 4: `title` - pub title: &'a str, - /// Field 5: `title_source` - pub title_source: ::buffa::EnumValue, - /// Field 6: `workspace_id` - pub workspace_id: &'a str, - /// Field 7: `archived` - pub archived: bool, - /// Effective history length in SessionOrdinals, after rewind masking. A caller - /// must not treat this as a count of decodable history items: redaction can - /// mask an ordinal without removing it. - /// - /// Field 8: `effective_length` - pub effective_length: u64, - /// Set when this session is a copy salvaged from a damaged one. On the list row - /// and not only the detail view, because a picker that renders a salvaged - /// session identically to an intact one is where the substitution actually - /// happens: by the time a user opens it they have already decided it is theirs. - /// - /// Field 9: `recovery` - pub recovery: ::buffa::MessageFieldView< - super::super::__buffa::view::RecoveryProvenanceViewView<'a>, - >, - /// Short excerpt of the session's opening content. Always set, including when - /// there is nothing to preview, because the reason there is nothing is itself - /// what a caller needs in order to render the row honestly. - /// - /// Field 10: `preview` - pub preview: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionPreviewView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionSummaryView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `lifecycle` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_lifecycle(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `title` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_title(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `title_source` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_title_source(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `workspace_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_workspace_id(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } - /**Whether required field `archived` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_archived(&self) -> bool { - self.__buffa_required_seen_0 & 32u64 != 0 - } - /**Whether required field `effective_length` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_effective_length(&self) -> bool { - self.__buffa_required_seen_0 & 64u64 != 0 - } - /**Whether required field `preview` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_preview(&self) -> bool { - self.preview.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for SessionSummaryView<'a> { - type Owned = super::super::SessionSummary; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.lifecycle = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.terminal_reason = Some( - ::buffa::EnumValue::from(::buffa::types::decode_int32(&mut cur)?), - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.title = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.title_source = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 8u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.workspace_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.archived = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 32u64; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.effective_length = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 64u64; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.recovery.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.recovery = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.preview.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.preview = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionSummary { - session_id: self.session_id.to_string(), - lifecycle: self.lifecycle, - terminal_reason: self.terminal_reason, - title: self.title.to_string(), - title_source: self.title_source, - workspace_id: self.workspace_id.to_string(), - archived: self.archived, - effective_length: self.effective_length, - recovery: match self.recovery.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::RecoveryProvenanceView, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - preview: match self.preview.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionPreview, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionSummaryView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.lifecycle.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.terminal_reason { - size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.title) as u64; - { - let val = self.title_source.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.workspace_id) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.effective_length) as u64; - if self.recovery.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.recovery.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.preview.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.preview.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.lifecycle.to_i32(), buf); - if let Some(ref v) = self.terminal_reason { - ::buffa::types::put_int32_field(3u32, v.to_i32(), buf); - } - ::buffa::types::put_string_field(4u32, &self.title, buf); - ::buffa::types::put_int32_field(5u32, self.title_source.to_i32(), buf); - ::buffa::types::put_string_field(6u32, &self.workspace_id, buf); - ::buffa::types::put_bool_field(7u32, self.archived, buf); - ::buffa::types::put_uint64_field(8u32, self.effective_length, buf); - if self.recovery.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.recovery.write_to(__cache, buf); - } - if self.preview.is_set() { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - self.preview.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionSummaryView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("lifecycle", &self.lifecycle)?; - } - if let ::core::option::Option::Some(ref __v) = self.terminal_reason { - __map.serialize_entry("terminalReason", __v)?; - } - { - __map.serialize_entry("title", self.title)?; - } - { - __map.serialize_entry("titleSource", &self.title_source)?; - } - { - __map.serialize_entry("workspaceId", self.workspace_id)?; - } - { - __map.serialize_entry("archived", &self.archived)?; - } - { - __map - .serialize_entry( - "effectiveLength", - &::buffa::json_helpers::ProtoJson(&self.effective_length), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.recovery.as_option() { - __map.serialize_entry("recovery", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.preview.as_option() { - __map.serialize_entry("preview", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionSummaryView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "SessionSummary"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.SessionSummary"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionSummary"; -} -::buffa::impl_default_view_instance!(SessionSummaryView); -::buffa::impl_view_reborrow!(SessionSummaryView); -/** Self-contained, `'static` owned view of a `SessionSummary` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionSummaryView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionSummaryView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionSummaryOwnedView(::buffa::OwnedView>); -impl SessionSummaryOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionSummaryOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionSummaryOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionSummary, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionSummaryOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionSummaryView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionSummaryView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionSummary { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `lifecycle` - #[must_use] - pub fn lifecycle(&self) -> ::buffa::EnumValue { - self.0.reborrow().lifecycle - } - /// Unset while the session is active. - /// - /// Field 3: `terminal_reason` - #[must_use] - pub fn terminal_reason( - &self, - ) -> ::core::option::Option<::buffa::EnumValue> { - self.0.reborrow().terminal_reason - } - /// Display name, resolved by the precedence on TitleSource. Always set: when - /// there is nothing to show it holds a server-chosen fallback rather than an - /// empty string, so a picker never has to invent one and two clients never - /// invent different ones. - /// - /// Field 4: `title` - #[must_use] - pub fn title(&self) -> &'_ str { - self.0.reborrow().title - } - /// Field 5: `title_source` - #[must_use] - pub fn title_source(&self) -> ::buffa::EnumValue { - self.0.reborrow().title_source - } - /// Field 6: `workspace_id` - #[must_use] - pub fn workspace_id(&self) -> &'_ str { - self.0.reborrow().workspace_id - } - /// Field 7: `archived` - #[must_use] - pub fn archived(&self) -> bool { - self.0.reborrow().archived - } - /// Effective history length in SessionOrdinals, after rewind masking. A caller - /// must not treat this as a count of decodable history items: redaction can - /// mask an ordinal without removing it. - /// - /// Field 8: `effective_length` - #[must_use] - pub fn effective_length(&self) -> u64 { - self.0.reborrow().effective_length - } - /// Set when this session is a copy salvaged from a damaged one. On the list row - /// and not only the detail view, because a picker that renders a salvaged - /// session identically to an intact one is where the substitution actually - /// happens: by the time a user opens it they have already decided it is theirs. - /// - /// Field 9: `recovery` - #[must_use] - pub fn recovery( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::RecoveryProvenanceViewView<'_>, - > { - &self.0.reborrow().recovery - } - /// Short excerpt of the session's opening content. Always set, including when - /// there is nothing to preview, because the reason there is nothing is itself - /// what a caller needs in order to render the row honestly. - /// - /// Field 10: `preview` - #[must_use] - pub fn preview( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionPreviewView<'_>, - > { - &self.0.reborrow().preview - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionSummaryOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionSummaryOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionSummaryOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionSummaryOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionSummary { - type View<'a> = SessionSummaryView<'a>; - type ViewHandle = SessionSummaryOwnedView; -} -impl ::serde::Serialize for SessionSummaryOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// SessionPreview is the excerpt shown beneath a session's title. -/// -/// It is derived from effective history, which is what makes it a projection -/// concern rather than a stored string. Rewind masks ordinals, redaction removes -/// content from ordinals that remain, and either can take away the very message a -/// preview was cut from. A preview cached without regard for that is the case -/// where deliberately destroyed text reappears on a screen, which is a privacy -/// failure and not a staleness annoyance. -/// -/// Its validity therefore tracks `effective_history_revision` and -/// `privacy_revision`, the same two coordinates a presentation cache binds -/// against. A cached preview whose binding fails those two must be discarded, not -/// shown as merely older. -#[derive(Clone, Debug, Default)] -pub struct SessionPreviewView<'a> { - /// The excerpt, truncated at a server-chosen bound. Empty for every - /// availability other than SESSION_PREVIEW_AVAILABILITY_AVAILABLE. - /// - /// Field 1: `text` - pub text: &'a str, - /// Field 2: `availability` - pub availability: ::buffa::EnumValue, - /// True when the excerpt is shorter than the content it came from, so a - /// renderer can mark the cut rather than presenting a fragment as a whole - /// message. - /// - /// Field 3: `truncated` - pub truncated: bool, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionPreviewView<'a> { - /**Whether required field `text` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_text(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `availability` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_availability(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `truncated` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_truncated(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SessionPreviewView<'a> { - type Owned = super::super::SessionPreview; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.text = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.availability = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.truncated = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionPreview { - text: self.text.to_string(), - availability: self.availability, - truncated: self.truncated, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionPreviewView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - { - let val = self.availability.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.text, buf); - ::buffa::types::put_int32_field(2u32, self.availability.to_i32(), buf); - ::buffa::types::put_bool_field(3u32, self.truncated, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionPreviewView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("text", self.text)?; - } - { - __map.serialize_entry("availability", &self.availability)?; - } - { - __map.serialize_entry("truncated", &self.truncated)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionPreviewView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "SessionPreview"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.SessionPreview"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionPreview"; -} -::buffa::impl_default_view_instance!(SessionPreviewView); -::buffa::impl_view_reborrow!(SessionPreviewView); -/** Self-contained, `'static` owned view of a `SessionPreview` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionPreviewView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionPreviewView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionPreviewOwnedView(::buffa::OwnedView>); -impl SessionPreviewOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionPreviewOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionPreviewOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionPreview, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionPreviewOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionPreviewView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionPreviewView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionPreview { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The excerpt, truncated at a server-chosen bound. Empty for every - /// availability other than SESSION_PREVIEW_AVAILABILITY_AVAILABLE. - /// - /// Field 1: `text` - #[must_use] - pub fn text(&self) -> &'_ str { - self.0.reborrow().text - } - /// Field 2: `availability` - #[must_use] - pub fn availability( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().availability - } - /// True when the excerpt is shorter than the content it came from, so a - /// renderer can mark the cut rather than presenting a fragment as a whole - /// message. - /// - /// Field 3: `truncated` - #[must_use] - pub fn truncated(&self) -> bool { - self.0.reborrow().truncated - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionPreviewOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionPreviewOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionPreviewOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionPreviewOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionPreview { - type View<'a> = SessionPreviewView<'a>; - type ViewHandle = SessionPreviewOwnedView; -} -impl ::serde::Serialize for SessionPreviewOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// RecoveryProvenanceView marks a session that was salvaged rather than lived. -/// -/// Unset is the ordinary case. When set, a reader must not present the session as -/// the source: it has a different id, its ordinals are its own, and a partial -/// recovery is missing content the original had. -#[derive(Clone, Debug, Default)] -pub struct RecoveryProvenanceViewView<'a> { - /// Field 1: `source_session_id` - pub source_session_id: &'a str, - /// Field 2: `completeness` - pub completeness: ::buffa::EnumValue, - /// How many source items the salvage could not carry. The enumeration is an - /// operator-side record and is deliberately not on the read contract: a client - /// needs to know the session is incomplete, not to render a damage report. - /// - /// Field 3: `omitted_count` - pub omitted_count: u32, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RecoveryProvenanceViewView<'a> { - /**Whether required field `source_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `completeness` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_completeness(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `omitted_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_omitted_count(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RecoveryProvenanceViewView<'a> { - type Owned = super::super::RecoveryProvenanceView; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.completeness = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.omitted_count = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::RecoveryProvenanceView, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::RecoveryProvenanceView, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RecoveryProvenanceView { - source_session_id: self.source_session_id.to_string(), - completeness: self.completeness, - omitted_count: self.omitted_count, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RecoveryProvenanceViewView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - { - let val = self.completeness.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.omitted_count) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - ::buffa::types::put_int32_field(2u32, self.completeness.to_i32(), buf); - ::buffa::types::put_uint32_field(3u32, self.omitted_count, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RecoveryProvenanceViewView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sourceSessionId", self.source_session_id)?; - } - { - __map.serialize_entry("completeness", &self.completeness)?; - } - { - __map - .serialize_entry( - "omittedCount", - &::buffa::json_helpers::ProtoJson(&self.omitted_count), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RecoveryProvenanceViewView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "RecoveryProvenanceView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.RecoveryProvenanceView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.RecoveryProvenanceView"; -} -::buffa::impl_default_view_instance!(RecoveryProvenanceViewView); -::buffa::impl_view_reborrow!(RecoveryProvenanceViewView); -/** Self-contained, `'static` owned view of a `RecoveryProvenanceView` message. - - Wraps [`::buffa::OwnedView`]`<`[`RecoveryProvenanceViewView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RecoveryProvenanceViewView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RecoveryProvenanceViewOwnedView( - ::buffa::OwnedView>, -); -impl RecoveryProvenanceViewOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecoveryProvenanceViewOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecoveryProvenanceViewOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RecoveryProvenanceView, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecoveryProvenanceViewOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RecoveryProvenanceViewView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RecoveryProvenanceViewView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RecoveryProvenanceView { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `source_session_id` - #[must_use] - pub fn source_session_id(&self) -> &'_ str { - self.0.reborrow().source_session_id - } - /// Field 2: `completeness` - #[must_use] - pub fn completeness( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().completeness - } - /// How many source items the salvage could not carry. The enumeration is an - /// operator-side record and is deliberately not on the read contract: a client - /// needs to know the session is incomplete, not to render a damage report. - /// - /// Field 3: `omitted_count` - #[must_use] - pub fn omitted_count(&self) -> u32 { - self.0.reborrow().omitted_count - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RecoveryProvenanceViewOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RecoveryProvenanceViewOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RecoveryProvenanceViewOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RecoveryProvenanceViewOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RecoveryProvenanceView { - type View<'a> = RecoveryProvenanceViewView<'a>; - type ViewHandle = RecoveryProvenanceViewOwnedView; -} -impl ::serde::Serialize for RecoveryProvenanceViewOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// SessionView is the detail shape returned by GetSession. -/// -/// It reports lifecycle and shape, never the transcript. History is a separate, -/// paginated query because a session's history has no bound and a detail read -/// that inlines it has no bound either. -#[derive(Clone, Debug, Default)] -pub struct SessionViewView<'a> { - /// Field 1: `summary` - pub summary: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionSummaryView<'a>, - >, - /// Set when this session was forked from another. - /// - /// Field 2: `fork_origin` - pub fork_origin: ::buffa::MessageFieldView< - super::super::__buffa::view::ForkOriginViewView<'a>, - >, - /// Set when this session was dispatched by a parent. - /// - /// Field 3: `parent` - pub parent: ::buffa::MessageFieldView< - super::super::__buffa::view::ParentViewView<'a>, - >, - /// Sessions this one dispatched, parent side. - /// - /// Field 4: `delegations` - pub delegations: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::DelegationViewView<'a>, - >, - /// True when at least one tool call has started with no terminal outcome, or - /// at least one reserved operation is unsettled. This is the reader-visible - /// form of "something needs reconciling"; a caller must not conclude a session - /// is complete from a terminal lifecycle alone. - /// - /// Field 5: `has_unreconciled_work` - pub has_unreconciled_work: bool, - /// How much of this session's artifact content is still retrievable. Always - /// set, including when everything is intact, so a caller never has to read an - /// absent field as good news. - /// - /// Field 6: `artifacts` - pub artifacts: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactCompletenessViewView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionViewView<'a> { - /**Whether required field `summary` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_summary(&self) -> bool { - self.summary.is_set() - } - /**Whether required field `has_unreconciled_work` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_has_unreconciled_work(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `artifacts` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifacts(&self) -> bool { - self.artifacts.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for SessionViewView<'a> { - type Owned = super::super::SessionView; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.summary.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.summary = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.fork_origin.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.fork_origin = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.parent.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.parent = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.has_unreconciled_work = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.artifacts.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.artifacts = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::DelegationViewView, - >(), - )?; - view.delegations - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionView { - summary: match self.summary.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionSummary, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - fork_origin: match self.fork_origin.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ForkOriginView, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - parent: match self.parent.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ParentView, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - delegations: self - .delegations - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - has_unreconciled_work: self.has_unreconciled_work, - artifacts: match self.artifacts.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactCompletenessView, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionViewView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.summary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.summary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.fork_origin.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.fork_origin.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.parent.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.delegations { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - if self.artifacts.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.artifacts.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.summary.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.summary.write_to(__cache, buf); - } - if self.fork_origin.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.fork_origin.write_to(__cache, buf); - } - if self.parent.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent.write_to(__cache, buf); - } - for v in &self.delegations { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - ::buffa::types::put_bool_field(5u32, self.has_unreconciled_work, buf); - if self.artifacts.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.artifacts.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionViewView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.summary.as_option() { - __map.serialize_entry("summary", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.fork_origin.as_option() { - __map.serialize_entry("forkOrigin", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.parent.as_option() { - __map.serialize_entry("parent", __v)?; - } - } - if !self.delegations.is_empty() { - __map.serialize_entry("delegations", &*self.delegations)?; - } - { - __map.serialize_entry("hasUnreconciledWork", &self.has_unreconciled_work)?; - } - { - if let ::core::option::Option::Some(__v) = self.artifacts.as_option() { - __map.serialize_entry("artifacts", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionViewView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "SessionView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.SessionView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionView"; -} -::buffa::impl_default_view_instance!(SessionViewView); -::buffa::impl_view_reborrow!(SessionViewView); -/** Self-contained, `'static` owned view of a `SessionView` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionViewView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionViewView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionViewOwnedView(::buffa::OwnedView>); -impl SessionViewOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionViewOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionViewOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionView, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionViewOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionViewView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionViewView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionView { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `summary` - #[must_use] - pub fn summary( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionSummaryView<'_>, - > { - &self.0.reborrow().summary - } - /// Set when this session was forked from another. - /// - /// Field 2: `fork_origin` - #[must_use] - pub fn fork_origin( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ForkOriginViewView<'_>, - > { - &self.0.reborrow().fork_origin - } - /// Set when this session was dispatched by a parent. - /// - /// Field 3: `parent` - #[must_use] - pub fn parent( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().parent - } - /// Sessions this one dispatched, parent side. - /// - /// Field 4: `delegations` - #[must_use] - pub fn delegations( - &self, - ) -> &::buffa::RepeatedView< - '_, - super::super::__buffa::view::DelegationViewView<'_>, - > { - &self.0.reborrow().delegations - } - /// True when at least one tool call has started with no terminal outcome, or - /// at least one reserved operation is unsettled. This is the reader-visible - /// form of "something needs reconciling"; a caller must not conclude a session - /// is complete from a terminal lifecycle alone. - /// - /// Field 5: `has_unreconciled_work` - #[must_use] - pub fn has_unreconciled_work(&self) -> bool { - self.0.reborrow().has_unreconciled_work - } - /// How much of this session's artifact content is still retrievable. Always - /// set, including when everything is intact, so a caller never has to read an - /// absent field as good news. - /// - /// Field 6: `artifacts` - #[must_use] - pub fn artifacts( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactCompletenessViewView<'_>, - > { - &self.0.reborrow().artifacts - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionViewOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionViewOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionViewOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionViewOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionView { - type View<'a> = SessionViewView<'a>; - type ViewHandle = SessionViewOwnedView; -} -impl ::serde::Serialize for SessionViewOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ArtifactCompletenessView is how complete this session's artifact content is, -/// reported separately from its lifecycle. -/// -/// The two are independent and routinely disagree. A session can close having -/// done exactly what was asked and still be missing the output it produced, -/// because artifact bytes live outside the log and outlive nothing in -/// particular: they get erased under a retention policy, or under a deletion -/// request, or by a storage fault. A reader that infers retrievability from -/// TERMINAL_REASON_CLOSED will present an empty result as a successful one. -/// -/// This rollup counts only what the log itself establishes. Whether the bytes an -/// intact claim-check points to are actually there is a fact about an external -/// store, and learning it costs one probe per artifact, which is not something a -/// list or detail query can do and remain a query. That answer arrives through -/// `observed` when someone has gone and looked. -#[derive(Clone, Debug, Default)] -pub struct ArtifactCompletenessViewView<'a> { - /// Artifacts recorded on this session's effective history. Rewind-masked and - /// redacted ordinals contribute nothing, so this counts what the caller can - /// see referenced rather than everything ever recorded. - /// - /// Field 1: `recorded` - pub recorded: u32, - /// Recorded with durably stored bytes and no erasure since. This is the count - /// the log supports; it is a claim about what was promised, not about what a - /// store would return right now. - /// - /// Field 2: `claimed_retrievable` - pub claimed_retrievable: u32, - /// Destroyed on purpose, recorded by ArtifactErased. Counted apart from every - /// other absence because it is the one that is working as intended. - /// - /// Field 3: `erased` - pub erased: u32, - /// Recorded as an external reference whose bytes were never durably stored. - /// Nothing was lost; nothing was ever held. - /// - /// Field 4: `external_only` - pub external_only: u32, - /// Referenced by this session and not readable by this caller. Per-caller, so - /// two readers of the same session can see different totals, and the point of - /// surfacing it is that the difference is authorization rather than damage. - /// - /// Field 5: `hidden` - pub hidden: u32, - /// Set only when the artifact store has actually been checked for this - /// session. Unset means nobody has looked, which is not the same as nothing - /// being wrong, and the field is absent rather than zeroed so the two cannot - /// be confused. - /// - /// Field 6: `observed` - pub observed: ::buffa::MessageFieldView< - super::super::__buffa::view::ObservedIntegrityViewView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ArtifactCompletenessViewView<'a> { - /**Whether required field `recorded` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_recorded(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `claimed_retrievable` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_claimed_retrievable(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `erased` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_erased(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `external_only` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_external_only(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `hidden` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_hidden(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ArtifactCompletenessViewView<'a> { - type Owned = super::super::ArtifactCompletenessView; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.recorded = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.claimed_retrievable = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.erased = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.external_only = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.hidden = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ArtifactCompletenessView, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ArtifactCompletenessView, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ArtifactCompletenessView { - recorded: self.recorded, - claimed_retrievable: self.claimed_retrievable, - erased: self.erased, - external_only: self.external_only, - hidden: self.hidden, - observed: match self.observed.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ObservedIntegrityView, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ArtifactCompletenessViewView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.recorded) as u64; - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.claimed_retrievable) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.erased) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.external_only) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.hidden) as u64; - if self.observed.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.recorded, buf); - ::buffa::types::put_uint32_field(2u32, self.claimed_retrievable, buf); - ::buffa::types::put_uint32_field(3u32, self.erased, buf); - ::buffa::types::put_uint32_field(4u32, self.external_only, buf); - ::buffa::types::put_uint32_field(5u32, self.hidden, buf); - if self.observed.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ArtifactCompletenessViewView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "recorded", - &::buffa::json_helpers::ProtoJson(&self.recorded), - )?; - } - { - __map - .serialize_entry( - "claimedRetrievable", - &::buffa::json_helpers::ProtoJson(&self.claimed_retrievable), - )?; - } - { - __map - .serialize_entry( - "erased", - &::buffa::json_helpers::ProtoJson(&self.erased), - )?; - } - { - __map - .serialize_entry( - "externalOnly", - &::buffa::json_helpers::ProtoJson(&self.external_only), - )?; - } - { - __map - .serialize_entry( - "hidden", - &::buffa::json_helpers::ProtoJson(&self.hidden), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.observed.as_option() { - __map.serialize_entry("observed", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ArtifactCompletenessViewView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ArtifactCompletenessView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ArtifactCompletenessView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ArtifactCompletenessView"; -} -::buffa::impl_default_view_instance!(ArtifactCompletenessViewView); -::buffa::impl_view_reborrow!(ArtifactCompletenessViewView); -/** Self-contained, `'static` owned view of a `ArtifactCompletenessView` message. - - Wraps [`::buffa::OwnedView`]`<`[`ArtifactCompletenessViewView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ArtifactCompletenessViewView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ArtifactCompletenessViewOwnedView( - ::buffa::OwnedView>, -); -impl ArtifactCompletenessViewOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactCompletenessViewOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactCompletenessViewOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ArtifactCompletenessView, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactCompletenessViewOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ArtifactCompletenessViewView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ArtifactCompletenessViewView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ArtifactCompletenessView { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Artifacts recorded on this session's effective history. Rewind-masked and - /// redacted ordinals contribute nothing, so this counts what the caller can - /// see referenced rather than everything ever recorded. - /// - /// Field 1: `recorded` - #[must_use] - pub fn recorded(&self) -> u32 { - self.0.reborrow().recorded - } - /// Recorded with durably stored bytes and no erasure since. This is the count - /// the log supports; it is a claim about what was promised, not about what a - /// store would return right now. - /// - /// Field 2: `claimed_retrievable` - #[must_use] - pub fn claimed_retrievable(&self) -> u32 { - self.0.reborrow().claimed_retrievable - } - /// Destroyed on purpose, recorded by ArtifactErased. Counted apart from every - /// other absence because it is the one that is working as intended. - /// - /// Field 3: `erased` - #[must_use] - pub fn erased(&self) -> u32 { - self.0.reborrow().erased - } - /// Recorded as an external reference whose bytes were never durably stored. - /// Nothing was lost; nothing was ever held. - /// - /// Field 4: `external_only` - #[must_use] - pub fn external_only(&self) -> u32 { - self.0.reborrow().external_only - } - /// Referenced by this session and not readable by this caller. Per-caller, so - /// two readers of the same session can see different totals, and the point of - /// surfacing it is that the difference is authorization rather than damage. - /// - /// Field 5: `hidden` - #[must_use] - pub fn hidden(&self) -> u32 { - self.0.reborrow().hidden - } - /// Set only when the artifact store has actually been checked for this - /// session. Unset means nobody has looked, which is not the same as nothing - /// being wrong, and the field is absent rather than zeroed so the two cannot - /// be confused. - /// - /// Field 6: `observed` - #[must_use] - pub fn observed( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ObservedIntegrityViewView<'_>, - > { - &self.0.reborrow().observed - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ArtifactCompletenessViewOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ArtifactCompletenessViewOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ArtifactCompletenessViewOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ArtifactCompletenessViewOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ArtifactCompletenessView { - type View<'a> = ArtifactCompletenessViewView<'a>; - type ViewHandle = ArtifactCompletenessViewOwnedView; -} -impl ::serde::Serialize for ArtifactCompletenessViewOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ObservedIntegrityView is what a probe of the artifact store found, and when. -/// -/// These counts age. They describe a store at the instant it was read, and an -/// artifact can be lost the moment after; `observed_at` is here so a caller can -/// decide whether the answer is still worth acting on rather than treating a -/// stale all-clear as a current one. -#[derive(Clone, Debug, Default)] -pub struct ObservedIntegrityViewView<'a> { - /// Claim-checks the store had no object for, with no erasure recorded. This is - /// the count that means data was lost. - /// - /// Field 1: `missing` - pub missing: u32, - /// Objects present whose content does not match the digest on the log. - /// - /// Field 2: `digest_mismatch` - pub digest_mismatch: u32, - /// Objects that could not be read at all, which makes no claim about whether - /// they exist. Counted apart from `missing` because a transport or permissions - /// fault reported as data loss sends an operator looking for a backup instead - /// of a broken credential. - /// - /// Field 3: `unreadable` - pub unreadable: u32, - /// Field 4: `observed_at` - pub observed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ObservedIntegrityViewView<'a> { - /**Whether required field `missing` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_missing(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `digest_mismatch` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_digest_mismatch(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `unreadable` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_unreadable(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `observed_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_observed_at(&self) -> bool { - self.observed_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ObservedIntegrityViewView<'a> { - type Owned = super::super::ObservedIntegrityView; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.missing = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.digest_mismatch = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.unreadable = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ObservedIntegrityView, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ObservedIntegrityView, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ObservedIntegrityView { - missing: self.missing, - digest_mismatch: self.digest_mismatch, - unreadable: self.unreadable, - observed_at: match self.observed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ObservedIntegrityViewView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.missing) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.digest_mismatch) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.unreadable) as u64; - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.missing, buf); - ::buffa::types::put_uint32_field(2u32, self.digest_mismatch, buf); - ::buffa::types::put_uint32_field(3u32, self.unreadable, buf); - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ObservedIntegrityViewView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "missing", - &::buffa::json_helpers::ProtoJson(&self.missing), - )?; - } - { - __map - .serialize_entry( - "digestMismatch", - &::buffa::json_helpers::ProtoJson(&self.digest_mismatch), - )?; - } - { - __map - .serialize_entry( - "unreadable", - &::buffa::json_helpers::ProtoJson(&self.unreadable), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.observed_at.as_option() { - __map.serialize_entry("observedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ObservedIntegrityViewView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ObservedIntegrityView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ObservedIntegrityView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ObservedIntegrityView"; -} -::buffa::impl_default_view_instance!(ObservedIntegrityViewView); -::buffa::impl_view_reborrow!(ObservedIntegrityViewView); -/** Self-contained, `'static` owned view of a `ObservedIntegrityView` message. - - Wraps [`::buffa::OwnedView`]`<`[`ObservedIntegrityViewView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ObservedIntegrityViewView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ObservedIntegrityViewOwnedView( - ::buffa::OwnedView>, -); -impl ObservedIntegrityViewOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ObservedIntegrityViewOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ObservedIntegrityViewOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ObservedIntegrityView, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ObservedIntegrityViewOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ObservedIntegrityViewView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ObservedIntegrityViewView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ObservedIntegrityView { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Claim-checks the store had no object for, with no erasure recorded. This is - /// the count that means data was lost. - /// - /// Field 1: `missing` - #[must_use] - pub fn missing(&self) -> u32 { - self.0.reborrow().missing - } - /// Objects present whose content does not match the digest on the log. - /// - /// Field 2: `digest_mismatch` - #[must_use] - pub fn digest_mismatch(&self) -> u32 { - self.0.reborrow().digest_mismatch - } - /// Objects that could not be read at all, which makes no claim about whether - /// they exist. Counted apart from `missing` because a transport or permissions - /// fault reported as data loss sends an operator looking for a backup instead - /// of a broken credential. - /// - /// Field 3: `unreadable` - #[must_use] - pub fn unreadable(&self) -> u32 { - self.0.reborrow().unreadable - } - /// Field 4: `observed_at` - #[must_use] - pub fn observed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().observed_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ObservedIntegrityViewOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ObservedIntegrityViewOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ObservedIntegrityViewOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ObservedIntegrityViewOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ObservedIntegrityView { - type View<'a> = ObservedIntegrityViewView<'a>; - type ViewHandle = ObservedIntegrityViewOwnedView; -} -impl ::serde::Serialize for ObservedIntegrityViewOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ForkOriginView names the session this one branched from. -#[derive(Clone, Debug, Default)] -pub struct ForkOriginViewView<'a> { - /// Field 1: `source_session_id` - pub source_session_id: &'a str, - /// The source ordinal this session's inherited context ends at. - /// - /// Field 2: `context_prefix_boundary` - pub context_prefix_boundary: u64, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ForkOriginViewView<'a> { - /**Whether required field `source_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `context_prefix_boundary` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_context_prefix_boundary(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ForkOriginViewView<'a> { - type Owned = super::super::ForkOriginView; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.context_prefix_boundary = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ForkOriginView { - source_session_id: self.source_session_id.to_string(), - context_prefix_boundary: self.context_prefix_boundary, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ForkOriginViewView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.context_prefix_boundary) - as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - ::buffa::types::put_uint64_field(2u32, self.context_prefix_boundary, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ForkOriginViewView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sourceSessionId", self.source_session_id)?; - } - { - __map - .serialize_entry( - "contextPrefixBoundary", - &::buffa::json_helpers::ProtoJson(&self.context_prefix_boundary), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ForkOriginViewView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ForkOriginView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ForkOriginView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ForkOriginView"; -} -::buffa::impl_default_view_instance!(ForkOriginViewView); -::buffa::impl_view_reborrow!(ForkOriginViewView); -/** Self-contained, `'static` owned view of a `ForkOriginView` message. - - Wraps [`::buffa::OwnedView`]`<`[`ForkOriginViewView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ForkOriginViewView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ForkOriginViewOwnedView(::buffa::OwnedView>); -impl ForkOriginViewOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ForkOriginViewOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ForkOriginViewOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ForkOriginView, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ForkOriginViewOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ForkOriginViewView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ForkOriginViewView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ForkOriginView { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `source_session_id` - #[must_use] - pub fn source_session_id(&self) -> &'_ str { - self.0.reborrow().source_session_id - } - /// The source ordinal this session's inherited context ends at. - /// - /// Field 2: `context_prefix_boundary` - #[must_use] - pub fn context_prefix_boundary(&self) -> u64 { - self.0.reborrow().context_prefix_boundary - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ForkOriginViewOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ForkOriginViewOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ForkOriginViewOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ForkOriginViewOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ForkOriginView { - type View<'a> = ForkOriginViewView<'a>; - type ViewHandle = ForkOriginViewOwnedView; -} -impl ::serde::Serialize for ForkOriginViewOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ParentView names the session that dispatched this one, and whether that -/// lineage still holds. -#[derive(Clone, Debug, Default)] -pub struct ParentViewView<'a> { - /// Field 1: `parent_session_id` - pub parent_session_id: &'a str, - /// The parent ended and this session observed it. - /// - /// Field 2: `parent_terminated` - pub parent_terminated: bool, - /// The parent rewound past the dispatch: the inherited context no longer - /// exists, so this session's history is no longer grounded in the parent's. - /// - /// Field 3: `history_invalidated` - pub history_invalidated: bool, - /// The lineage was explicitly released. - /// - /// Field 4: `detached` - pub detached: bool, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ParentViewView<'a> { - /**Whether required field `parent_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `parent_terminated` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_terminated(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `history_invalidated` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_history_invalidated(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `detached` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_detached(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ParentViewView<'a> { - type Owned = super::super::ParentView; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.parent_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.parent_terminated = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.history_invalidated = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.detached = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ParentView { - parent_session_id: self.parent_session_id.to_string(), - parent_terminated: self.parent_terminated, - history_invalidated: self.history_invalidated, - detached: self.detached, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ParentViewView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.parent_session_id, buf); - ::buffa::types::put_bool_field(2u32, self.parent_terminated, buf); - ::buffa::types::put_bool_field(3u32, self.history_invalidated, buf); - ::buffa::types::put_bool_field(4u32, self.detached, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ParentViewView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("parentSessionId", self.parent_session_id)?; - } - { - __map.serialize_entry("parentTerminated", &self.parent_terminated)?; - } - { - __map.serialize_entry("historyInvalidated", &self.history_invalidated)?; - } - { - __map.serialize_entry("detached", &self.detached)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ParentViewView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ParentView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ParentView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ParentView"; -} -::buffa::impl_default_view_instance!(ParentViewView); -::buffa::impl_view_reborrow!(ParentViewView); -/** Self-contained, `'static` owned view of a `ParentView` message. - - Wraps [`::buffa::OwnedView`]`<`[`ParentViewView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ParentViewView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ParentViewOwnedView(::buffa::OwnedView>); -impl ParentViewOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentViewOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentViewOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ParentView, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentViewOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ParentViewView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ParentViewView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ParentView { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `parent_session_id` - #[must_use] - pub fn parent_session_id(&self) -> &'_ str { - self.0.reborrow().parent_session_id - } - /// The parent ended and this session observed it. - /// - /// Field 2: `parent_terminated` - #[must_use] - pub fn parent_terminated(&self) -> bool { - self.0.reborrow().parent_terminated - } - /// The parent rewound past the dispatch: the inherited context no longer - /// exists, so this session's history is no longer grounded in the parent's. - /// - /// Field 3: `history_invalidated` - #[must_use] - pub fn history_invalidated(&self) -> bool { - self.0.reborrow().history_invalidated - } - /// The lineage was explicitly released. - /// - /// Field 4: `detached` - #[must_use] - pub fn detached(&self) -> bool { - self.0.reborrow().detached - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ParentViewOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ParentViewOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ParentViewOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ParentViewOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ParentView { - type View<'a> = ParentViewView<'a>; - type ViewHandle = ParentViewOwnedView; -} -impl ::serde::Serialize for ParentViewOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// DelegationView is one dispatched child or external delegate. -#[derive(Clone, Debug, Default)] -pub struct DelegationViewView<'a> { - /// Field 1: `operation_id` - pub operation_id: &'a str, - /// Field 2: `kind` - pub kind: ::buffa::EnumValue, - /// Set for DELEGATION_KIND_VIEW_CHILD_SESSION. - /// - /// Field 3: `child_session_id` - pub child_session_id: ::core::option::Option<&'a str>, - /// Set for DELEGATION_KIND_VIEW_EXTERNAL. - /// - /// Field 4: `delegate_reference` - pub delegate_reference: ::core::option::Option<&'a str>, - /// Field 5: `detached` - pub detached: bool, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DelegationViewView<'a> { - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_kind(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `detached` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_detached(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for DelegationViewView<'a> { - type Owned = super::super::DelegationView; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.child_session_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.delegate_reference = Some(::buffa::types::borrow_str(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.detached = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DelegationView { - operation_id: self.operation_id.to_string(), - kind: self.kind, - child_session_id: self.child_session_id.map(|s| s.to_string()), - delegate_reference: self.delegate_reference.map(|s| s.to_string()), - detached: self.detached, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DelegationViewView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.child_session_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.delegate_reference { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.operation_id, buf); - ::buffa::types::put_int32_field(2u32, self.kind.to_i32(), buf); - if let Some(ref v) = self.child_session_id { - ::buffa::types::put_string_field(3u32, v, buf); - } - if let Some(ref v) = self.delegate_reference { - ::buffa::types::put_string_field(4u32, v, buf); - } - ::buffa::types::put_bool_field(5u32, self.detached, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DelegationViewView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("operationId", self.operation_id)?; - } - { - __map.serialize_entry("kind", &self.kind)?; - } - if let ::core::option::Option::Some(__v) = self.child_session_id { - __map.serialize_entry("childSessionId", __v)?; - } - if let ::core::option::Option::Some(__v) = self.delegate_reference { - __map.serialize_entry("delegateReference", __v)?; - } - { - __map.serialize_entry("detached", &self.detached)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DelegationViewView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "DelegationView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.DelegationView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.DelegationView"; -} -::buffa::impl_default_view_instance!(DelegationViewView); -::buffa::impl_view_reborrow!(DelegationViewView); -/** Self-contained, `'static` owned view of a `DelegationView` message. - - Wraps [`::buffa::OwnedView`]`<`[`DelegationViewView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DelegationViewView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DelegationViewOwnedView(::buffa::OwnedView>); -impl DelegationViewOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DelegationViewOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DelegationViewOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DelegationView, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DelegationViewOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DelegationViewView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DelegationViewView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DelegationView { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Field 2: `kind` - #[must_use] - pub fn kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().kind - } - /// Set for DELEGATION_KIND_VIEW_CHILD_SESSION. - /// - /// Field 3: `child_session_id` - #[must_use] - pub fn child_session_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().child_session_id - } - /// Set for DELEGATION_KIND_VIEW_EXTERNAL. - /// - /// Field 4: `delegate_reference` - #[must_use] - pub fn delegate_reference(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().delegate_reference - } - /// Field 5: `detached` - #[must_use] - pub fn detached(&self) -> bool { - self.0.reborrow().detached - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DelegationViewOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DelegationViewOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DelegationViewOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DelegationViewOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DelegationView { - type View<'a> = DelegationViewView<'a>; - type ViewHandle = DelegationViewOwnedView; -} -impl ::serde::Serialize for DelegationViewOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.session_view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.session_view.rs deleted file mode 100644 index c5774ce62..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.queries.v1alpha1.session_view.rs +++ /dev/null @@ -1,2986 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/queries/v1alpha1/session_view.proto - -/// Read-model value types for the Session query contract. -/// -/// These are redefined here rather than imported from the write side on purpose -/// (ADR#0035 facet 3). The write-side event and state types change whenever the -/// domain changes; a public read contract must be able to hold still across -/// those changes, and a shared type would forward every write-side edit straight -/// to every client. -/// -/// Every identifier here is opaque. A caller may compare ids for equality and -/// pass them back, and must not parse structure out of them. -/// -/// SessionLifecycle is the coarse lifecycle state a reader sees. -/// -/// It is deliberately coarser than the write side's terminal markers: a reader -/// needs to know whether a session is still going, not which command sealed it. -/// The specific marker is available on `terminal_reason`. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum SessionLifecycle { - SESSION_LIFECYCLE_UNSPECIFIED = 0i32, - SESSION_LIFECYCLE_ACTIVE = 1i32, - SESSION_LIFECYCLE_TERMINAL = 2i32, -} -impl SessionLifecycle { - ///Idiomatic alias for [`Self::SESSION_LIFECYCLE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::SESSION_LIFECYCLE_UNSPECIFIED; - ///Idiomatic alias for [`Self::SESSION_LIFECYCLE_ACTIVE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Active: Self = Self::SESSION_LIFECYCLE_ACTIVE; - ///Idiomatic alias for [`Self::SESSION_LIFECYCLE_TERMINAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Terminal: Self = Self::SESSION_LIFECYCLE_TERMINAL; -} -impl ::core::default::Default for SessionLifecycle { - fn default() -> Self { - Self::SESSION_LIFECYCLE_UNSPECIFIED - } -} -impl ::serde::Serialize for SessionLifecycle { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for SessionLifecycle { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = SessionLifecycle; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(SessionLifecycle) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionLifecycle { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for SessionLifecycle { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::SESSION_LIFECYCLE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::SESSION_LIFECYCLE_ACTIVE), - 2i32 => ::core::option::Option::Some(Self::SESSION_LIFECYCLE_TERMINAL), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::SESSION_LIFECYCLE_UNSPECIFIED => "SESSION_LIFECYCLE_UNSPECIFIED", - Self::SESSION_LIFECYCLE_ACTIVE => "SESSION_LIFECYCLE_ACTIVE", - Self::SESSION_LIFECYCLE_TERMINAL => "SESSION_LIFECYCLE_TERMINAL", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "SESSION_LIFECYCLE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::SESSION_LIFECYCLE_UNSPECIFIED) - } - "SESSION_LIFECYCLE_ACTIVE" => { - ::core::option::Option::Some(Self::SESSION_LIFECYCLE_ACTIVE) - } - "SESSION_LIFECYCLE_TERMINAL" => { - ::core::option::Option::Some(Self::SESSION_LIFECYCLE_TERMINAL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::SESSION_LIFECYCLE_UNSPECIFIED, - Self::SESSION_LIFECYCLE_ACTIVE, - Self::SESSION_LIFECYCLE_TERMINAL, - ] - } -} -/// TerminalReason is why a session ended, set only for a terminal session. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum TerminalReason { - TERMINAL_REASON_UNSPECIFIED = 0i32, - TERMINAL_REASON_CLOSED = 1i32, - TERMINAL_REASON_CANCELLED = 2i32, - TERMINAL_REASON_FAILED = 3i32, - TERMINAL_REASON_HIDDEN = 4i32, -} -impl TerminalReason { - ///Idiomatic alias for [`Self::TERMINAL_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::TERMINAL_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::TERMINAL_REASON_CLOSED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Closed: Self = Self::TERMINAL_REASON_CLOSED; - ///Idiomatic alias for [`Self::TERMINAL_REASON_CANCELLED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Cancelled: Self = Self::TERMINAL_REASON_CANCELLED; - ///Idiomatic alias for [`Self::TERMINAL_REASON_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Failed: Self = Self::TERMINAL_REASON_FAILED; - ///Idiomatic alias for [`Self::TERMINAL_REASON_HIDDEN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Hidden: Self = Self::TERMINAL_REASON_HIDDEN; -} -impl ::core::default::Default for TerminalReason { - fn default() -> Self { - Self::TERMINAL_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for TerminalReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for TerminalReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = TerminalReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(TerminalReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for TerminalReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for TerminalReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::TERMINAL_REASON_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::TERMINAL_REASON_CLOSED), - 2i32 => ::core::option::Option::Some(Self::TERMINAL_REASON_CANCELLED), - 3i32 => ::core::option::Option::Some(Self::TERMINAL_REASON_FAILED), - 4i32 => ::core::option::Option::Some(Self::TERMINAL_REASON_HIDDEN), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::TERMINAL_REASON_UNSPECIFIED => "TERMINAL_REASON_UNSPECIFIED", - Self::TERMINAL_REASON_CLOSED => "TERMINAL_REASON_CLOSED", - Self::TERMINAL_REASON_CANCELLED => "TERMINAL_REASON_CANCELLED", - Self::TERMINAL_REASON_FAILED => "TERMINAL_REASON_FAILED", - Self::TERMINAL_REASON_HIDDEN => "TERMINAL_REASON_HIDDEN", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "TERMINAL_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::TERMINAL_REASON_UNSPECIFIED) - } - "TERMINAL_REASON_CLOSED" => { - ::core::option::Option::Some(Self::TERMINAL_REASON_CLOSED) - } - "TERMINAL_REASON_CANCELLED" => { - ::core::option::Option::Some(Self::TERMINAL_REASON_CANCELLED) - } - "TERMINAL_REASON_FAILED" => { - ::core::option::Option::Some(Self::TERMINAL_REASON_FAILED) - } - "TERMINAL_REASON_HIDDEN" => { - ::core::option::Option::Some(Self::TERMINAL_REASON_HIDDEN) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::TERMINAL_REASON_UNSPECIFIED, - Self::TERMINAL_REASON_CLOSED, - Self::TERMINAL_REASON_CANCELLED, - Self::TERMINAL_REASON_FAILED, - Self::TERMINAL_REASON_HIDDEN, - ] - } -} -/// SessionPreviewAvailability is why a preview is or is not there. -/// -/// Absence has several causes with different meanings, and collapsing them into -/// an empty string tells a user that a session is empty when it may only be one -/// they are not cleared to see, or one whose opening message was deliberately -/// removed. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum SessionPreviewAvailability { - SESSION_PREVIEW_AVAILABILITY_UNSPECIFIED = 0i32, - /// An excerpt is present in `text`. - SESSION_PREVIEW_AVAILABILITY_AVAILABLE = 1i32, - /// The session has no effective authored content to preview. - SESSION_PREVIEW_AVAILABILITY_EMPTY = 2i32, - /// Content exists but is not text: an image-only or attachment-only opening. - SESSION_PREVIEW_AVAILABILITY_NON_TEXTUAL = 3i32, - /// The content a preview would come from was redacted. Distinguished from empty - /// because a session that was emptied on purpose is not a session that was - /// never used, and a UI that says "no messages" about a redaction is lying - /// about what happened. - SESSION_PREVIEW_AVAILABILITY_REDACTED = 4i32, - /// The content exists and this caller may not see it. Per-caller, like - /// ArtifactCompletenessView.hidden: two readers of the same session can get - /// different answers, and the difference is authorization rather than content. - SESSION_PREVIEW_AVAILABILITY_WITHHELD = 5i32, -} -impl SessionPreviewAvailability { - ///Idiomatic alias for [`Self::SESSION_PREVIEW_AVAILABILITY_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::SESSION_PREVIEW_AVAILABILITY_UNSPECIFIED; - ///Idiomatic alias for [`Self::SESSION_PREVIEW_AVAILABILITY_AVAILABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Available: Self = Self::SESSION_PREVIEW_AVAILABILITY_AVAILABLE; - ///Idiomatic alias for [`Self::SESSION_PREVIEW_AVAILABILITY_EMPTY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Empty: Self = Self::SESSION_PREVIEW_AVAILABILITY_EMPTY; - ///Idiomatic alias for [`Self::SESSION_PREVIEW_AVAILABILITY_NON_TEXTUAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NonTextual: Self = Self::SESSION_PREVIEW_AVAILABILITY_NON_TEXTUAL; - ///Idiomatic alias for [`Self::SESSION_PREVIEW_AVAILABILITY_REDACTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Redacted: Self = Self::SESSION_PREVIEW_AVAILABILITY_REDACTED; - ///Idiomatic alias for [`Self::SESSION_PREVIEW_AVAILABILITY_WITHHELD`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Withheld: Self = Self::SESSION_PREVIEW_AVAILABILITY_WITHHELD; -} -impl ::core::default::Default for SessionPreviewAvailability { - fn default() -> Self { - Self::SESSION_PREVIEW_AVAILABILITY_UNSPECIFIED - } -} -impl ::serde::Serialize for SessionPreviewAvailability { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for SessionPreviewAvailability { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = SessionPreviewAvailability; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(SessionPreviewAvailability) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionPreviewAvailability { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for SessionPreviewAvailability { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some( - Self::SESSION_PREVIEW_AVAILABILITY_UNSPECIFIED, - ) - } - 1i32 => { - ::core::option::Option::Some( - Self::SESSION_PREVIEW_AVAILABILITY_AVAILABLE, - ) - } - 2i32 => { - ::core::option::Option::Some(Self::SESSION_PREVIEW_AVAILABILITY_EMPTY) - } - 3i32 => { - ::core::option::Option::Some( - Self::SESSION_PREVIEW_AVAILABILITY_NON_TEXTUAL, - ) - } - 4i32 => { - ::core::option::Option::Some(Self::SESSION_PREVIEW_AVAILABILITY_REDACTED) - } - 5i32 => { - ::core::option::Option::Some(Self::SESSION_PREVIEW_AVAILABILITY_WITHHELD) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::SESSION_PREVIEW_AVAILABILITY_UNSPECIFIED => { - "SESSION_PREVIEW_AVAILABILITY_UNSPECIFIED" - } - Self::SESSION_PREVIEW_AVAILABILITY_AVAILABLE => { - "SESSION_PREVIEW_AVAILABILITY_AVAILABLE" - } - Self::SESSION_PREVIEW_AVAILABILITY_EMPTY => { - "SESSION_PREVIEW_AVAILABILITY_EMPTY" - } - Self::SESSION_PREVIEW_AVAILABILITY_NON_TEXTUAL => { - "SESSION_PREVIEW_AVAILABILITY_NON_TEXTUAL" - } - Self::SESSION_PREVIEW_AVAILABILITY_REDACTED => { - "SESSION_PREVIEW_AVAILABILITY_REDACTED" - } - Self::SESSION_PREVIEW_AVAILABILITY_WITHHELD => { - "SESSION_PREVIEW_AVAILABILITY_WITHHELD" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "SESSION_PREVIEW_AVAILABILITY_UNSPECIFIED" => { - ::core::option::Option::Some( - Self::SESSION_PREVIEW_AVAILABILITY_UNSPECIFIED, - ) - } - "SESSION_PREVIEW_AVAILABILITY_AVAILABLE" => { - ::core::option::Option::Some( - Self::SESSION_PREVIEW_AVAILABILITY_AVAILABLE, - ) - } - "SESSION_PREVIEW_AVAILABILITY_EMPTY" => { - ::core::option::Option::Some(Self::SESSION_PREVIEW_AVAILABILITY_EMPTY) - } - "SESSION_PREVIEW_AVAILABILITY_NON_TEXTUAL" => { - ::core::option::Option::Some( - Self::SESSION_PREVIEW_AVAILABILITY_NON_TEXTUAL, - ) - } - "SESSION_PREVIEW_AVAILABILITY_REDACTED" => { - ::core::option::Option::Some(Self::SESSION_PREVIEW_AVAILABILITY_REDACTED) - } - "SESSION_PREVIEW_AVAILABILITY_WITHHELD" => { - ::core::option::Option::Some(Self::SESSION_PREVIEW_AVAILABILITY_WITHHELD) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::SESSION_PREVIEW_AVAILABILITY_UNSPECIFIED, - Self::SESSION_PREVIEW_AVAILABILITY_AVAILABLE, - Self::SESSION_PREVIEW_AVAILABILITY_EMPTY, - Self::SESSION_PREVIEW_AVAILABILITY_NON_TEXTUAL, - Self::SESSION_PREVIEW_AVAILABILITY_REDACTED, - Self::SESSION_PREVIEW_AVAILABILITY_WITHHELD, - ] - } -} -/// RecoveryCompletenessView is how much of the source a salvaged session carries. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum RecoveryCompletenessView { - RECOVERY_COMPLETENESS_VIEW_UNSPECIFIED = 0i32, - RECOVERY_COMPLETENESS_VIEW_COMPLETE = 1i32, - RECOVERY_COMPLETENESS_VIEW_PARTIAL = 2i32, -} -impl RecoveryCompletenessView { - ///Idiomatic alias for [`Self::RECOVERY_COMPLETENESS_VIEW_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::RECOVERY_COMPLETENESS_VIEW_UNSPECIFIED; - ///Idiomatic alias for [`Self::RECOVERY_COMPLETENESS_VIEW_COMPLETE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Complete: Self = Self::RECOVERY_COMPLETENESS_VIEW_COMPLETE; - ///Idiomatic alias for [`Self::RECOVERY_COMPLETENESS_VIEW_PARTIAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Partial: Self = Self::RECOVERY_COMPLETENESS_VIEW_PARTIAL; -} -impl ::core::default::Default for RecoveryCompletenessView { - fn default() -> Self { - Self::RECOVERY_COMPLETENESS_VIEW_UNSPECIFIED - } -} -impl ::serde::Serialize for RecoveryCompletenessView { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for RecoveryCompletenessView { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = RecoveryCompletenessView; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(RecoveryCompletenessView) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for RecoveryCompletenessView { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for RecoveryCompletenessView { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some( - Self::RECOVERY_COMPLETENESS_VIEW_UNSPECIFIED, - ) - } - 1i32 => { - ::core::option::Option::Some(Self::RECOVERY_COMPLETENESS_VIEW_COMPLETE) - } - 2i32 => { - ::core::option::Option::Some(Self::RECOVERY_COMPLETENESS_VIEW_PARTIAL) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::RECOVERY_COMPLETENESS_VIEW_UNSPECIFIED => { - "RECOVERY_COMPLETENESS_VIEW_UNSPECIFIED" - } - Self::RECOVERY_COMPLETENESS_VIEW_COMPLETE => { - "RECOVERY_COMPLETENESS_VIEW_COMPLETE" - } - Self::RECOVERY_COMPLETENESS_VIEW_PARTIAL => { - "RECOVERY_COMPLETENESS_VIEW_PARTIAL" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "RECOVERY_COMPLETENESS_VIEW_UNSPECIFIED" => { - ::core::option::Option::Some( - Self::RECOVERY_COMPLETENESS_VIEW_UNSPECIFIED, - ) - } - "RECOVERY_COMPLETENESS_VIEW_COMPLETE" => { - ::core::option::Option::Some(Self::RECOVERY_COMPLETENESS_VIEW_COMPLETE) - } - "RECOVERY_COMPLETENESS_VIEW_PARTIAL" => { - ::core::option::Option::Some(Self::RECOVERY_COMPLETENESS_VIEW_PARTIAL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::RECOVERY_COMPLETENESS_VIEW_UNSPECIFIED, - Self::RECOVERY_COMPLETENESS_VIEW_COMPLETE, - Self::RECOVERY_COMPLETENESS_VIEW_PARTIAL, - ] - } -} -/// TitleSource says where a rendered title came from, and by doing so fixes the -/// precedence that produced it. -/// -/// The projection resolves a title in one order, always: the latest effective -/// SessionRenamed if one survives, otherwise a title derived from the first -/// effective user message, otherwise a fallback. Publishing which rule fired is -/// what makes the result checkable, and it lets a client style a guess -/// differently from a name a human chose. -/// -/// The two sources invalidate differently, and that asymmetry is the reason this -/// field exists rather than a `title_is_explicit` bool. A derived title is a -/// function of effective history, so a rewind past the first user message or a -/// redaction of it changes the title. An explicit title is an authoritative fact -/// of its own and survives both. What it does not survive is being redacted -/// itself, and when that happens the resolution falls back down the same -/// precedence rather than keeping a name whose source no longer exists. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum TitleSource { - TITLE_SOURCE_UNSPECIFIED = 0i32, - /// A human renamed the session, and that rename is still effective. - TITLE_SOURCE_EXPLICIT = 1i32, - /// Derived from the first effective user message. Follows effective history: - /// rewinding or redacting that message changes it. - TITLE_SOURCE_DERIVED = 2i32, - /// Nothing to derive from: an empty or image-only session, or one whose - /// openings are all masked. The server supplies the string. - TITLE_SOURCE_FALLBACK = 3i32, -} -impl TitleSource { - ///Idiomatic alias for [`Self::TITLE_SOURCE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::TITLE_SOURCE_UNSPECIFIED; - ///Idiomatic alias for [`Self::TITLE_SOURCE_EXPLICIT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Explicit: Self = Self::TITLE_SOURCE_EXPLICIT; - ///Idiomatic alias for [`Self::TITLE_SOURCE_DERIVED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Derived: Self = Self::TITLE_SOURCE_DERIVED; - ///Idiomatic alias for [`Self::TITLE_SOURCE_FALLBACK`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Fallback: Self = Self::TITLE_SOURCE_FALLBACK; -} -impl ::core::default::Default for TitleSource { - fn default() -> Self { - Self::TITLE_SOURCE_UNSPECIFIED - } -} -impl ::serde::Serialize for TitleSource { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for TitleSource { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = TitleSource; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(TitleSource)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for TitleSource { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for TitleSource { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::TITLE_SOURCE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::TITLE_SOURCE_EXPLICIT), - 2i32 => ::core::option::Option::Some(Self::TITLE_SOURCE_DERIVED), - 3i32 => ::core::option::Option::Some(Self::TITLE_SOURCE_FALLBACK), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::TITLE_SOURCE_UNSPECIFIED => "TITLE_SOURCE_UNSPECIFIED", - Self::TITLE_SOURCE_EXPLICIT => "TITLE_SOURCE_EXPLICIT", - Self::TITLE_SOURCE_DERIVED => "TITLE_SOURCE_DERIVED", - Self::TITLE_SOURCE_FALLBACK => "TITLE_SOURCE_FALLBACK", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "TITLE_SOURCE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::TITLE_SOURCE_UNSPECIFIED) - } - "TITLE_SOURCE_EXPLICIT" => { - ::core::option::Option::Some(Self::TITLE_SOURCE_EXPLICIT) - } - "TITLE_SOURCE_DERIVED" => { - ::core::option::Option::Some(Self::TITLE_SOURCE_DERIVED) - } - "TITLE_SOURCE_FALLBACK" => { - ::core::option::Option::Some(Self::TITLE_SOURCE_FALLBACK) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::TITLE_SOURCE_UNSPECIFIED, - Self::TITLE_SOURCE_EXPLICIT, - Self::TITLE_SOURCE_DERIVED, - Self::TITLE_SOURCE_FALLBACK, - ] - } -} -/// DelegationKindView is where delegated work runs. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum DelegationKindView { - DELEGATION_KIND_VIEW_UNSPECIFIED = 0i32, - DELEGATION_KIND_VIEW_CHILD_SESSION = 1i32, - DELEGATION_KIND_VIEW_EXTERNAL = 2i32, -} -impl DelegationKindView { - ///Idiomatic alias for [`Self::DELEGATION_KIND_VIEW_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::DELEGATION_KIND_VIEW_UNSPECIFIED; - ///Idiomatic alias for [`Self::DELEGATION_KIND_VIEW_CHILD_SESSION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ChildSession: Self = Self::DELEGATION_KIND_VIEW_CHILD_SESSION; - ///Idiomatic alias for [`Self::DELEGATION_KIND_VIEW_EXTERNAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const External: Self = Self::DELEGATION_KIND_VIEW_EXTERNAL; -} -impl ::core::default::Default for DelegationKindView { - fn default() -> Self { - Self::DELEGATION_KIND_VIEW_UNSPECIFIED - } -} -impl ::serde::Serialize for DelegationKindView { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for DelegationKindView { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = DelegationKindView; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(DelegationKindView) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for DelegationKindView { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for DelegationKindView { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::DELEGATION_KIND_VIEW_UNSPECIFIED), - 1i32 => { - ::core::option::Option::Some(Self::DELEGATION_KIND_VIEW_CHILD_SESSION) - } - 2i32 => ::core::option::Option::Some(Self::DELEGATION_KIND_VIEW_EXTERNAL), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::DELEGATION_KIND_VIEW_UNSPECIFIED => "DELEGATION_KIND_VIEW_UNSPECIFIED", - Self::DELEGATION_KIND_VIEW_CHILD_SESSION => { - "DELEGATION_KIND_VIEW_CHILD_SESSION" - } - Self::DELEGATION_KIND_VIEW_EXTERNAL => "DELEGATION_KIND_VIEW_EXTERNAL", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "DELEGATION_KIND_VIEW_UNSPECIFIED" => { - ::core::option::Option::Some(Self::DELEGATION_KIND_VIEW_UNSPECIFIED) - } - "DELEGATION_KIND_VIEW_CHILD_SESSION" => { - ::core::option::Option::Some(Self::DELEGATION_KIND_VIEW_CHILD_SESSION) - } - "DELEGATION_KIND_VIEW_EXTERNAL" => { - ::core::option::Option::Some(Self::DELEGATION_KIND_VIEW_EXTERNAL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::DELEGATION_KIND_VIEW_UNSPECIFIED, - Self::DELEGATION_KIND_VIEW_CHILD_SESSION, - Self::DELEGATION_KIND_VIEW_EXTERNAL, - ] - } -} -/// SessionSummary is the list-row shape: enough to render a picker, and no more. -/// -/// It deliberately excludes anything requiring a per-session fan-out to compute, -/// because a list query that costs one read per row stops being a list query. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionSummary { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `lifecycle` - #[serde(rename = "lifecycle", with = "::buffa::json_helpers::proto_enum")] - pub lifecycle: ::buffa::EnumValue, - /// Unset while the session is active. - /// - /// Field 3: `terminal_reason` - #[serde( - rename = "terminalReason", - alias = "terminal_reason", - with = "::buffa::json_helpers::opt_enum", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub terminal_reason: ::core::option::Option<::buffa::EnumValue>, - /// Display name, resolved by the precedence on TitleSource. Always set: when - /// there is nothing to show it holds a server-chosen fallback rather than an - /// empty string, so a picker never has to invent one and two clients never - /// invent different ones. - /// - /// Field 4: `title` - #[serde(rename = "title", with = "::buffa::json_helpers::proto_string")] - pub title: ::buffa::alloc::string::String, - /// Field 5: `title_source` - #[serde( - rename = "titleSource", - alias = "title_source", - with = "::buffa::json_helpers::proto_enum" - )] - pub title_source: ::buffa::EnumValue, - /// Field 6: `workspace_id` - #[serde( - rename = "workspaceId", - alias = "workspace_id", - with = "::buffa::json_helpers::proto_string" - )] - pub workspace_id: ::buffa::alloc::string::String, - /// Field 7: `archived` - #[serde(rename = "archived", with = "::buffa::json_helpers::proto_bool")] - pub archived: bool, - /// Effective history length in SessionOrdinals, after rewind masking. A caller - /// must not treat this as a count of decodable history items: redaction can - /// mask an ordinal without removing it. - /// - /// Field 8: `effective_length` - #[serde( - rename = "effectiveLength", - alias = "effective_length", - with = "::buffa::json_helpers::uint64" - )] - pub effective_length: u64, - /// Set when this session is a copy salvaged from a damaged one. On the list row - /// and not only the detail view, because a picker that renders a salvaged - /// session identically to an intact one is where the substitution actually - /// happens: by the time a user opens it they have already decided it is theirs. - /// - /// Field 9: `recovery` - #[serde( - rename = "recovery", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub recovery: ::buffa::MessageField< - RecoveryProvenanceView, - ::buffa::Inline, - >, - /// Short excerpt of the session's opening content. Always set, including when - /// there is nothing to preview, because the reason there is nothing is itself - /// what a caller needs in order to render the row honestly. - /// - /// Field 10: `preview` - #[serde(rename = "preview")] - pub preview: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for SessionSummary { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionSummary") - .field("session_id", &self.session_id) - .field("lifecycle", &self.lifecycle) - .field("terminal_reason", &self.terminal_reason) - .field("title", &self.title) - .field("title_source", &self.title_source) - .field("workspace_id", &self.workspace_id) - .field("archived", &self.archived) - .field("effective_length", &self.effective_length) - .field("recovery", &self.recovery) - .field("preview", &self.preview) - .finish() - } -} -impl SessionSummary { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionSummary"; -} -impl SessionSummary { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::terminal_reason`] to `Some(value)`, consuming and returning `self`. - pub fn with_terminal_reason( - mut self, - value: impl Into<::buffa::EnumValue>, - ) -> Self { - self.terminal_reason = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(SessionSummary); -impl ::buffa::MessageName for SessionSummary { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "SessionSummary"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.SessionSummary"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionSummary"; -} -impl ::buffa::Message for SessionSummary { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.lifecycle.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.terminal_reason { - size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.title) as u64; - { - let val = self.title_source.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.workspace_id) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.effective_length) as u64; - if self.recovery.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.recovery.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.preview.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.preview.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.lifecycle.to_i32(), buf); - if let Some(ref v) = self.terminal_reason { - ::buffa::types::put_int32_field(3u32, v.to_i32(), buf); - } - ::buffa::types::put_string_field(4u32, &self.title, buf); - ::buffa::types::put_int32_field(5u32, self.title_source.to_i32(), buf); - ::buffa::types::put_string_field(6u32, &self.workspace_id, buf); - ::buffa::types::put_bool_field(7u32, self.archived, buf); - ::buffa::types::put_uint64_field(8u32, self.effective_length, buf); - if self.recovery.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.recovery.write_to(__cache, buf); - } - if self.preview.is_set() { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - self.preview.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.lifecycle = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.terminal_reason = ::core::option::Option::Some( - ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?), - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.title, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.title_source = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.workspace_id, buf)?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.archived = ::buffa::types::decode_bool(buf)?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.effective_length = ::buffa::types::decode_uint64(buf)?; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.recovery.get_or_insert_default(), - buf, - ctx, - )?; - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.preview.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.lifecycle = ::buffa::EnumValue::from(0); - self.terminal_reason = ::core::option::Option::None; - self.title.clear(); - self.title_source = ::buffa::EnumValue::from(0); - self.workspace_id.clear(); - self.archived = false; - self.effective_length = 0u64; - self.recovery = ::buffa::MessageField::none(); - self.preview = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionSummary { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_SUMMARY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionSummary", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// SessionPreview is the excerpt shown beneath a session's title. -/// -/// It is derived from effective history, which is what makes it a projection -/// concern rather than a stored string. Rewind masks ordinals, redaction removes -/// content from ordinals that remain, and either can take away the very message a -/// preview was cut from. A preview cached without regard for that is the case -/// where deliberately destroyed text reappears on a screen, which is a privacy -/// failure and not a staleness annoyance. -/// -/// Its validity therefore tracks `effective_history_revision` and -/// `privacy_revision`, the same two coordinates a presentation cache binds -/// against. A cached preview whose binding fails those two must be discarded, not -/// shown as merely older. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionPreview { - /// The excerpt, truncated at a server-chosen bound. Empty for every - /// availability other than SESSION_PREVIEW_AVAILABILITY_AVAILABLE. - /// - /// Field 1: `text` - #[serde(rename = "text", with = "::buffa::json_helpers::proto_string")] - pub text: ::buffa::alloc::string::String, - /// Field 2: `availability` - #[serde(rename = "availability", with = "::buffa::json_helpers::proto_enum")] - pub availability: ::buffa::EnumValue, - /// True when the excerpt is shorter than the content it came from, so a - /// renderer can mark the cut rather than presenting a fragment as a whole - /// message. - /// - /// Field 3: `truncated` - #[serde(rename = "truncated", with = "::buffa::json_helpers::proto_bool")] - pub truncated: bool, -} -impl ::core::fmt::Debug for SessionPreview { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionPreview") - .field("text", &self.text) - .field("availability", &self.availability) - .field("truncated", &self.truncated) - .finish() - } -} -impl SessionPreview { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionPreview"; -} -::buffa::impl_default_instance!(SessionPreview); -impl ::buffa::MessageName for SessionPreview { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "SessionPreview"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.SessionPreview"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionPreview"; -} -impl ::buffa::Message for SessionPreview { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - { - let val = self.availability.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.text, buf); - ::buffa::types::put_int32_field(2u32, self.availability.to_i32(), buf); - ::buffa::types::put_bool_field(3u32, self.truncated, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.text, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.availability = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.truncated = ::buffa::types::decode_bool(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.text.clear(); - self.availability = ::buffa::EnumValue::from(0); - self.truncated = false; - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionPreview { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_PREVIEW_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionPreview", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// RecoveryProvenanceView marks a session that was salvaged rather than lived. -/// -/// Unset is the ordinary case. When set, a reader must not present the session as -/// the source: it has a different id, its ordinals are its own, and a partial -/// recovery is missing content the original had. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RecoveryProvenanceView { - /// Field 1: `source_session_id` - #[serde( - rename = "sourceSessionId", - alias = "source_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub source_session_id: ::buffa::alloc::string::String, - /// Field 2: `completeness` - #[serde(rename = "completeness", with = "::buffa::json_helpers::proto_enum")] - pub completeness: ::buffa::EnumValue, - /// How many source items the salvage could not carry. The enumeration is an - /// operator-side record and is deliberately not on the read contract: a client - /// needs to know the session is incomplete, not to render a damage report. - /// - /// Field 3: `omitted_count` - #[serde( - rename = "omittedCount", - alias = "omitted_count", - with = "::buffa::json_helpers::uint32" - )] - pub omitted_count: u32, -} -impl ::core::fmt::Debug for RecoveryProvenanceView { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RecoveryProvenanceView") - .field("source_session_id", &self.source_session_id) - .field("completeness", &self.completeness) - .field("omitted_count", &self.omitted_count) - .finish() - } -} -impl RecoveryProvenanceView { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.RecoveryProvenanceView"; -} -::buffa::impl_default_instance!(RecoveryProvenanceView); -impl ::buffa::MessageName for RecoveryProvenanceView { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "RecoveryProvenanceView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.RecoveryProvenanceView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.RecoveryProvenanceView"; -} -impl ::buffa::Message for RecoveryProvenanceView { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - { - let val = self.completeness.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.omitted_count) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - ::buffa::types::put_int32_field(2u32, self.completeness.to_i32(), buf); - ::buffa::types::put_uint32_field(3u32, self.omitted_count, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.source_session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.completeness = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.omitted_count = ::buffa::types::decode_uint32(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.source_session_id.clear(); - self.completeness = ::buffa::EnumValue::from(0); - self.omitted_count = 0u32; - } -} -impl ::buffa::json_helpers::ProtoElemJson for RecoveryProvenanceView { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECOVERY_PROVENANCE_VIEW_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.RecoveryProvenanceView", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// SessionView is the detail shape returned by GetSession. -/// -/// It reports lifecycle and shape, never the transcript. History is a separate, -/// paginated query because a session's history has no bound and a detail read -/// that inlines it has no bound either. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionView { - /// Field 1: `summary` - #[serde(rename = "summary")] - pub summary: ::buffa::MessageField>, - /// Set when this session was forked from another. - /// - /// Field 2: `fork_origin` - #[serde( - rename = "forkOrigin", - alias = "fork_origin", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub fork_origin: ::buffa::MessageField< - ForkOriginView, - ::buffa::Inline, - >, - /// Set when this session was dispatched by a parent. - /// - /// Field 3: `parent` - #[serde( - rename = "parent", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub parent: ::buffa::MessageField>, - /// Sessions this one dispatched, parent side. - /// - /// Field 4: `delegations` - #[serde( - rename = "delegations", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub delegations: ::buffa::alloc::vec::Vec, - /// True when at least one tool call has started with no terminal outcome, or - /// at least one reserved operation is unsettled. This is the reader-visible - /// form of "something needs reconciling"; a caller must not conclude a session - /// is complete from a terminal lifecycle alone. - /// - /// Field 5: `has_unreconciled_work` - #[serde( - rename = "hasUnreconciledWork", - alias = "has_unreconciled_work", - with = "::buffa::json_helpers::proto_bool" - )] - pub has_unreconciled_work: bool, - /// How much of this session's artifact content is still retrievable. Always - /// set, including when everything is intact, so a caller never has to read an - /// absent field as good news. - /// - /// Field 6: `artifacts` - #[serde(rename = "artifacts")] - pub artifacts: ::buffa::MessageField< - ArtifactCompletenessView, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for SessionView { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionView") - .field("summary", &self.summary) - .field("fork_origin", &self.fork_origin) - .field("parent", &self.parent) - .field("delegations", &self.delegations) - .field("has_unreconciled_work", &self.has_unreconciled_work) - .field("artifacts", &self.artifacts) - .finish() - } -} -impl SessionView { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionView"; -} -::buffa::impl_default_instance!(SessionView); -impl ::buffa::MessageName for SessionView { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "SessionView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.SessionView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionView"; -} -impl ::buffa::Message for SessionView { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.summary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.summary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.fork_origin.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.fork_origin.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.parent.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.delegations { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - if self.artifacts.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.artifacts.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.summary.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.summary.write_to(__cache, buf); - } - if self.fork_origin.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.fork_origin.write_to(__cache, buf); - } - if self.parent.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent.write_to(__cache, buf); - } - for v in &self.delegations { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - ::buffa::types::put_bool_field(5u32, self.has_unreconciled_work, buf); - if self.artifacts.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.artifacts.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.summary.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.fork_origin.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.parent.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.delegations.push(elem); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.has_unreconciled_work = ::buffa::types::decode_bool(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.artifacts.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.summary = ::buffa::MessageField::none(); - self.fork_origin = ::buffa::MessageField::none(); - self.parent = ::buffa::MessageField::none(); - self.delegations.clear(); - self.has_unreconciled_work = false; - self.artifacts = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionView { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_VIEW_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.SessionView", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ArtifactCompletenessView is how complete this session's artifact content is, -/// reported separately from its lifecycle. -/// -/// The two are independent and routinely disagree. A session can close having -/// done exactly what was asked and still be missing the output it produced, -/// because artifact bytes live outside the log and outlive nothing in -/// particular: they get erased under a retention policy, or under a deletion -/// request, or by a storage fault. A reader that infers retrievability from -/// TERMINAL_REASON_CLOSED will present an empty result as a successful one. -/// -/// This rollup counts only what the log itself establishes. Whether the bytes an -/// intact claim-check points to are actually there is a fact about an external -/// store, and learning it costs one probe per artifact, which is not something a -/// list or detail query can do and remain a query. That answer arrives through -/// `observed` when someone has gone and looked. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ArtifactCompletenessView { - /// Artifacts recorded on this session's effective history. Rewind-masked and - /// redacted ordinals contribute nothing, so this counts what the caller can - /// see referenced rather than everything ever recorded. - /// - /// Field 1: `recorded` - #[serde(rename = "recorded", with = "::buffa::json_helpers::uint32")] - pub recorded: u32, - /// Recorded with durably stored bytes and no erasure since. This is the count - /// the log supports; it is a claim about what was promised, not about what a - /// store would return right now. - /// - /// Field 2: `claimed_retrievable` - #[serde( - rename = "claimedRetrievable", - alias = "claimed_retrievable", - with = "::buffa::json_helpers::uint32" - )] - pub claimed_retrievable: u32, - /// Destroyed on purpose, recorded by ArtifactErased. Counted apart from every - /// other absence because it is the one that is working as intended. - /// - /// Field 3: `erased` - #[serde(rename = "erased", with = "::buffa::json_helpers::uint32")] - pub erased: u32, - /// Recorded as an external reference whose bytes were never durably stored. - /// Nothing was lost; nothing was ever held. - /// - /// Field 4: `external_only` - #[serde( - rename = "externalOnly", - alias = "external_only", - with = "::buffa::json_helpers::uint32" - )] - pub external_only: u32, - /// Referenced by this session and not readable by this caller. Per-caller, so - /// two readers of the same session can see different totals, and the point of - /// surfacing it is that the difference is authorization rather than damage. - /// - /// Field 5: `hidden` - #[serde(rename = "hidden", with = "::buffa::json_helpers::uint32")] - pub hidden: u32, - /// Set only when the artifact store has actually been checked for this - /// session. Unset means nobody has looked, which is not the same as nothing - /// being wrong, and the field is absent rather than zeroed so the two cannot - /// be confused. - /// - /// Field 6: `observed` - #[serde( - rename = "observed", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub observed: ::buffa::MessageField< - ObservedIntegrityView, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for ArtifactCompletenessView { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ArtifactCompletenessView") - .field("recorded", &self.recorded) - .field("claimed_retrievable", &self.claimed_retrievable) - .field("erased", &self.erased) - .field("external_only", &self.external_only) - .field("hidden", &self.hidden) - .field("observed", &self.observed) - .finish() - } -} -impl ArtifactCompletenessView { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ArtifactCompletenessView"; -} -::buffa::impl_default_instance!(ArtifactCompletenessView); -impl ::buffa::MessageName for ArtifactCompletenessView { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ArtifactCompletenessView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ArtifactCompletenessView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ArtifactCompletenessView"; -} -impl ::buffa::Message for ArtifactCompletenessView { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.recorded) as u64; - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.claimed_retrievable) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.erased) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.external_only) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.hidden) as u64; - if self.observed.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.recorded, buf); - ::buffa::types::put_uint32_field(2u32, self.claimed_retrievable, buf); - ::buffa::types::put_uint32_field(3u32, self.erased, buf); - ::buffa::types::put_uint32_field(4u32, self.external_only, buf); - ::buffa::types::put_uint32_field(5u32, self.hidden, buf); - if self.observed.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.recorded = ::buffa::types::decode_uint32(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.claimed_retrievable = ::buffa::types::decode_uint32(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.erased = ::buffa::types::decode_uint32(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.external_only = ::buffa::types::decode_uint32(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.hidden = ::buffa::types::decode_uint32(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.recorded = 0u32; - self.claimed_retrievable = 0u32; - self.erased = 0u32; - self.external_only = 0u32; - self.hidden = 0u32; - self.observed = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ArtifactCompletenessView { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ARTIFACT_COMPLETENESS_VIEW_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ArtifactCompletenessView", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ObservedIntegrityView is what a probe of the artifact store found, and when. -/// -/// These counts age. They describe a store at the instant it was read, and an -/// artifact can be lost the moment after; `observed_at` is here so a caller can -/// decide whether the answer is still worth acting on rather than treating a -/// stale all-clear as a current one. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ObservedIntegrityView { - /// Claim-checks the store had no object for, with no erasure recorded. This is - /// the count that means data was lost. - /// - /// Field 1: `missing` - #[serde(rename = "missing", with = "::buffa::json_helpers::uint32")] - pub missing: u32, - /// Objects present whose content does not match the digest on the log. - /// - /// Field 2: `digest_mismatch` - #[serde( - rename = "digestMismatch", - alias = "digest_mismatch", - with = "::buffa::json_helpers::uint32" - )] - pub digest_mismatch: u32, - /// Objects that could not be read at all, which makes no claim about whether - /// they exist. Counted apart from `missing` because a transport or permissions - /// fault reported as data loss sends an operator looking for a backup instead - /// of a broken credential. - /// - /// Field 3: `unreadable` - #[serde(rename = "unreadable", with = "::buffa::json_helpers::uint32")] - pub unreadable: u32, - /// Field 4: `observed_at` - #[serde(rename = "observedAt", alias = "observed_at")] - pub observed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for ObservedIntegrityView { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ObservedIntegrityView") - .field("missing", &self.missing) - .field("digest_mismatch", &self.digest_mismatch) - .field("unreadable", &self.unreadable) - .field("observed_at", &self.observed_at) - .finish() - } -} -impl ObservedIntegrityView { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ObservedIntegrityView"; -} -::buffa::impl_default_instance!(ObservedIntegrityView); -impl ::buffa::MessageName for ObservedIntegrityView { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ObservedIntegrityView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ObservedIntegrityView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ObservedIntegrityView"; -} -impl ::buffa::Message for ObservedIntegrityView { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.missing) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.digest_mismatch) as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.unreadable) as u64; - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint32_field(1u32, self.missing, buf); - ::buffa::types::put_uint32_field(2u32, self.digest_mismatch, buf); - ::buffa::types::put_uint32_field(3u32, self.unreadable, buf); - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.missing = ::buffa::types::decode_uint32(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.digest_mismatch = ::buffa::types::decode_uint32(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.unreadable = ::buffa::types::decode_uint32(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.missing = 0u32; - self.digest_mismatch = 0u32; - self.unreadable = 0u32; - self.observed_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ObservedIntegrityView { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __OBSERVED_INTEGRITY_VIEW_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ObservedIntegrityView", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ForkOriginView names the session this one branched from. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ForkOriginView { - /// Field 1: `source_session_id` - #[serde( - rename = "sourceSessionId", - alias = "source_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub source_session_id: ::buffa::alloc::string::String, - /// The source ordinal this session's inherited context ends at. - /// - /// Field 2: `context_prefix_boundary` - #[serde( - rename = "contextPrefixBoundary", - alias = "context_prefix_boundary", - with = "::buffa::json_helpers::uint64" - )] - pub context_prefix_boundary: u64, -} -impl ::core::fmt::Debug for ForkOriginView { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ForkOriginView") - .field("source_session_id", &self.source_session_id) - .field("context_prefix_boundary", &self.context_prefix_boundary) - .finish() - } -} -impl ForkOriginView { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ForkOriginView"; -} -::buffa::impl_default_instance!(ForkOriginView); -impl ::buffa::MessageName for ForkOriginView { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ForkOriginView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ForkOriginView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ForkOriginView"; -} -impl ::buffa::Message for ForkOriginView { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.context_prefix_boundary) - as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - ::buffa::types::put_uint64_field(2u32, self.context_prefix_boundary, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.source_session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.context_prefix_boundary = ::buffa::types::decode_uint64(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.source_session_id.clear(); - self.context_prefix_boundary = 0u64; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ForkOriginView { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __FORK_ORIGIN_VIEW_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ForkOriginView", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ParentView names the session that dispatched this one, and whether that -/// lineage still holds. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ParentView { - /// Field 1: `parent_session_id` - #[serde( - rename = "parentSessionId", - alias = "parent_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub parent_session_id: ::buffa::alloc::string::String, - /// The parent ended and this session observed it. - /// - /// Field 2: `parent_terminated` - #[serde( - rename = "parentTerminated", - alias = "parent_terminated", - with = "::buffa::json_helpers::proto_bool" - )] - pub parent_terminated: bool, - /// The parent rewound past the dispatch: the inherited context no longer - /// exists, so this session's history is no longer grounded in the parent's. - /// - /// Field 3: `history_invalidated` - #[serde( - rename = "historyInvalidated", - alias = "history_invalidated", - with = "::buffa::json_helpers::proto_bool" - )] - pub history_invalidated: bool, - /// The lineage was explicitly released. - /// - /// Field 4: `detached` - #[serde(rename = "detached", with = "::buffa::json_helpers::proto_bool")] - pub detached: bool, -} -impl ::core::fmt::Debug for ParentView { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ParentView") - .field("parent_session_id", &self.parent_session_id) - .field("parent_terminated", &self.parent_terminated) - .field("history_invalidated", &self.history_invalidated) - .field("detached", &self.detached) - .finish() - } -} -impl ParentView { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ParentView"; -} -::buffa::impl_default_instance!(ParentView); -impl ::buffa::MessageName for ParentView { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "ParentView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.ParentView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ParentView"; -} -impl ::buffa::Message for ParentView { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.parent_session_id, buf); - ::buffa::types::put_bool_field(2u32, self.parent_terminated, buf); - ::buffa::types::put_bool_field(3u32, self.history_invalidated, buf); - ::buffa::types::put_bool_field(4u32, self.detached, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.parent_session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.parent_terminated = ::buffa::types::decode_bool(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.history_invalidated = ::buffa::types::decode_bool(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.detached = ::buffa::types::decode_bool(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.parent_session_id.clear(); - self.parent_terminated = false; - self.history_invalidated = false; - self.detached = false; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ParentView { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PARENT_VIEW_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.ParentView", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// DelegationView is one dispatched child or external delegate. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DelegationView { - /// Field 1: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// Field 2: `kind` - #[serde(rename = "kind", with = "::buffa::json_helpers::proto_enum")] - pub kind: ::buffa::EnumValue, - /// Set for DELEGATION_KIND_VIEW_CHILD_SESSION. - /// - /// Field 3: `child_session_id` - #[serde( - rename = "childSessionId", - alias = "child_session_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub child_session_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Set for DELEGATION_KIND_VIEW_EXTERNAL. - /// - /// Field 4: `delegate_reference` - #[serde( - rename = "delegateReference", - alias = "delegate_reference", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub delegate_reference: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 5: `detached` - #[serde(rename = "detached", with = "::buffa::json_helpers::proto_bool")] - pub detached: bool, -} -impl ::core::fmt::Debug for DelegationView { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DelegationView") - .field("operation_id", &self.operation_id) - .field("kind", &self.kind) - .field("child_session_id", &self.child_session_id) - .field("delegate_reference", &self.delegate_reference) - .field("detached", &self.detached) - .finish() - } -} -impl DelegationView { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.DelegationView"; -} -impl DelegationView { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::child_session_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_child_session_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.child_session_id = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::delegate_reference`] to `Some(value)`, consuming and returning `self`. - pub fn with_delegate_reference( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.delegate_reference = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(DelegationView); -impl ::buffa::MessageName for DelegationView { - const PACKAGE: &'static str = "trogonai.session.sessions.queries.v1alpha1"; - const NAME: &'static str = "DelegationView"; - const FULL_NAME: &'static str = "trogonai.session.sessions.queries.v1alpha1.DelegationView"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.DelegationView"; -} -impl ::buffa::Message for DelegationView { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.child_session_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.delegate_reference { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.operation_id, buf); - ::buffa::types::put_int32_field(2u32, self.kind.to_i32(), buf); - if let Some(ref v) = self.child_session_id { - ::buffa::types::put_string_field(3u32, v, buf); - } - if let Some(ref v) = self.delegate_reference { - ::buffa::types::put_string_field(4u32, v, buf); - } - ::buffa::types::put_bool_field(5u32, self.detached, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.kind = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .child_session_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .delegate_reference - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.detached = ::buffa::types::decode_bool(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.operation_id.clear(); - self.kind = ::buffa::EnumValue::from(0); - self.child_session_id = ::core::option::Option::None; - self.delegate_reference = ::core::option::Option::None; - self.detached = false; - } -} -impl ::buffa::json_helpers::ProtoElemJson for DelegationView { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DELEGATION_VIEW_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.queries.v1alpha1.DelegationView", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.frame.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.frame.__view.rs deleted file mode 100644 index 0f1556277..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.frame.__view.rs +++ /dev/null @@ -1,426 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/replay/v1alpha1/frame.proto - -/// The byte layout of a command-output replay artifact, format version 1. -/// -/// An artifact is two regions. The frame region runs from offset 0 and holds -/// frames back to back, each one a little-endian uint32 byte length followed by -/// that many bytes of a serialized ReplayFrame. The index region is a trailer -/// holding a serialized ReplayIndex; its offset and length are recorded on the -/// log, in CommandOutputReplayRef. -/// -/// These types are defined here rather than on the write side because they -/// describe bytes a reader parses, not a field an event carries. The write side -/// records where the capture is and what it is worth; this is what is inside it, -/// and the two change for different reasons (ADR#0035 facet 3). -/// -/// ReplayFrame is one contiguous run of output the capturer read in one go. -/// -/// A frame boundary is a fact about the capturer's read loop and nothing else. -/// It is not a line, not a write() by the process, and not a flush. A renderer -/// that treats frames as lines will split a line that arrived in two reads, and -/// it will do it differently on a fast machine than a slow one. -#[derive(Clone, Debug, Default)] -pub struct ReplayFrameView<'a> { - /// The capturer's own count, starting at 0, never compacted. - /// - /// When frames are dropped the surviving ones keep the numbers they were - /// given, so a gap in this sequence is a gap in the output. Renumbering to - /// stay contiguous would erase the only evidence inside the artifact that - /// anything is missing. - /// - /// Field 1: `sequence` - pub sequence: u64, - /// Field 2: `stream` - pub stream: ::buffa::EnumValue, - /// Raw bytes as captured. Not decoded, not normalized, and specifically not - /// stripped of control sequences: a terminal replay that removes them is - /// replaying something the terminal never showed. Decoding is the renderer's - /// job and is a decision it gets to make at render time, more than once. - /// - /// Field 3: `payload` - pub payload: ::core::option::Option<&'a [u8]>, - /// Elapsed time from the start of capture to when the capturer observed this - /// frame. Present only when CommandOutputReplayRef.timing is - /// TIMING_FIDELITY_CAPTURE_ELAPSED, and unset on every frame otherwise. - /// - /// Field 4: `elapsed` - pub elapsed: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReplayFrameView<'a> { - /**Whether required field `sequence` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_sequence(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `stream` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_stream(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ReplayFrameView<'a> { - type Owned = super::super::ReplayFrame; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.sequence = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.stream = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.payload = Some(::buffa::types::borrow_bytes(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.elapsed.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.elapsed = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReplayFrame { - sequence: self.sequence, - stream: self.stream, - payload: self.payload.map(|b| (b).to_vec()), - elapsed: match self.elapsed.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReplayFrameView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.sequence) as u64; - { - let val = self.stream.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.payload { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - if self.elapsed.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.elapsed.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.sequence, buf); - ::buffa::types::put_int32_field(2u32, self.stream.to_i32(), buf); - if let Some(ref v) = self.payload { - ::buffa::types::put_shared_bytes_field(3u32, v, buf); - } - if self.elapsed.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.elapsed.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReplayFrameView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "sequence", - &::buffa::json_helpers::ProtoJson(&self.sequence), - )?; - } - { - __map.serialize_entry("stream", &self.stream)?; - } - if let ::core::option::Option::Some(__v) = self.payload { - __map.serialize_entry("payload", &::buffa::json_helpers::BytesJson(__v))?; - } - { - if let ::core::option::Option::Some(__v) = self.elapsed.as_option() { - __map.serialize_entry("elapsed", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReplayFrameView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.replay.v1alpha1"; - const NAME: &'static str = "ReplayFrame"; - const FULL_NAME: &'static str = "trogonai.session.sessions.replay.v1alpha1.ReplayFrame"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.replay.v1alpha1.ReplayFrame"; -} -::buffa::impl_default_view_instance!(ReplayFrameView); -::buffa::impl_view_reborrow!(ReplayFrameView); -/** Self-contained, `'static` owned view of a `ReplayFrame` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReplayFrameView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReplayFrameView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReplayFrameOwnedView(::buffa::OwnedView>); -impl ReplayFrameOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReplayFrameOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReplayFrameOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReplayFrame, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReplayFrameOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReplayFrameView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReplayFrameView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReplayFrame { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The capturer's own count, starting at 0, never compacted. - /// - /// When frames are dropped the surviving ones keep the numbers they were - /// given, so a gap in this sequence is a gap in the output. Renumbering to - /// stay contiguous would erase the only evidence inside the artifact that - /// anything is missing. - /// - /// Field 1: `sequence` - #[must_use] - pub fn sequence(&self) -> u64 { - self.0.reborrow().sequence - } - /// Field 2: `stream` - #[must_use] - pub fn stream(&self) -> ::buffa::EnumValue { - self.0.reborrow().stream - } - /// Raw bytes as captured. Not decoded, not normalized, and specifically not - /// stripped of control sequences: a terminal replay that removes them is - /// replaying something the terminal never showed. Decoding is the renderer's - /// job and is a decision it gets to make at render time, more than once. - /// - /// Field 3: `payload` - #[must_use] - pub fn payload(&self) -> ::core::option::Option<&'_ [u8]> { - self.0.reborrow().payload - } - /// Elapsed time from the start of capture to when the capturer observed this - /// frame. Present only when CommandOutputReplayRef.timing is - /// TIMING_FIDELITY_CAPTURE_ELAPSED, and unset on every frame otherwise. - /// - /// Field 4: `elapsed` - #[must_use] - pub fn elapsed( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().elapsed - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReplayFrameOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReplayFrameOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReplayFrameOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReplayFrameOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReplayFrame { - type View<'a> = ReplayFrameView<'a>; - type ViewHandle = ReplayFrameOwnedView; -} -impl ::serde::Serialize for ReplayFrameOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.frame.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.frame.rs deleted file mode 100644 index 2764144eb..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.frame.rs +++ /dev/null @@ -1,400 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/replay/v1alpha1/frame.proto - -/// ReplayStream is which stream a frame came from. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ReplayStream { - REPLAY_STREAM_UNSPECIFIED = 0i32, - REPLAY_STREAM_STDOUT = 1i32, - REPLAY_STREAM_STDERR = 2i32, - /// Captured through one terminal or one pipe, where the two streams were - /// already indistinguishable before the capturer saw them. Every frame of a - /// CAPTURE_MODE_MERGED_TERMINAL artifact carries this. It means attribution is - /// unavailable, not that it is pending, and a renderer must not infer stderr - /// from content to fill it in. - REPLAY_STREAM_MERGED = 3i32, -} -impl ReplayStream { - ///Idiomatic alias for [`Self::REPLAY_STREAM_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::REPLAY_STREAM_UNSPECIFIED; - ///Idiomatic alias for [`Self::REPLAY_STREAM_STDOUT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Stdout: Self = Self::REPLAY_STREAM_STDOUT; - ///Idiomatic alias for [`Self::REPLAY_STREAM_STDERR`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Stderr: Self = Self::REPLAY_STREAM_STDERR; - ///Idiomatic alias for [`Self::REPLAY_STREAM_MERGED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Merged: Self = Self::REPLAY_STREAM_MERGED; -} -impl ::core::default::Default for ReplayStream { - fn default() -> Self { - Self::REPLAY_STREAM_UNSPECIFIED - } -} -impl ::serde::Serialize for ReplayStream { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ReplayStream { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ReplayStream; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(ReplayStream)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReplayStream { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ReplayStream { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::REPLAY_STREAM_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::REPLAY_STREAM_STDOUT), - 2i32 => ::core::option::Option::Some(Self::REPLAY_STREAM_STDERR), - 3i32 => ::core::option::Option::Some(Self::REPLAY_STREAM_MERGED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::REPLAY_STREAM_UNSPECIFIED => "REPLAY_STREAM_UNSPECIFIED", - Self::REPLAY_STREAM_STDOUT => "REPLAY_STREAM_STDOUT", - Self::REPLAY_STREAM_STDERR => "REPLAY_STREAM_STDERR", - Self::REPLAY_STREAM_MERGED => "REPLAY_STREAM_MERGED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "REPLAY_STREAM_UNSPECIFIED" => { - ::core::option::Option::Some(Self::REPLAY_STREAM_UNSPECIFIED) - } - "REPLAY_STREAM_STDOUT" => { - ::core::option::Option::Some(Self::REPLAY_STREAM_STDOUT) - } - "REPLAY_STREAM_STDERR" => { - ::core::option::Option::Some(Self::REPLAY_STREAM_STDERR) - } - "REPLAY_STREAM_MERGED" => { - ::core::option::Option::Some(Self::REPLAY_STREAM_MERGED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::REPLAY_STREAM_UNSPECIFIED, - Self::REPLAY_STREAM_STDOUT, - Self::REPLAY_STREAM_STDERR, - Self::REPLAY_STREAM_MERGED, - ] - } -} -/// The byte layout of a command-output replay artifact, format version 1. -/// -/// An artifact is two regions. The frame region runs from offset 0 and holds -/// frames back to back, each one a little-endian uint32 byte length followed by -/// that many bytes of a serialized ReplayFrame. The index region is a trailer -/// holding a serialized ReplayIndex; its offset and length are recorded on the -/// log, in CommandOutputReplayRef. -/// -/// These types are defined here rather than on the write side because they -/// describe bytes a reader parses, not a field an event carries. The write side -/// records where the capture is and what it is worth; this is what is inside it, -/// and the two change for different reasons (ADR#0035 facet 3). -/// -/// ReplayFrame is one contiguous run of output the capturer read in one go. -/// -/// A frame boundary is a fact about the capturer's read loop and nothing else. -/// It is not a line, not a write() by the process, and not a flush. A renderer -/// that treats frames as lines will split a line that arrived in two reads, and -/// it will do it differently on a fast machine than a slow one. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReplayFrame { - /// The capturer's own count, starting at 0, never compacted. - /// - /// When frames are dropped the surviving ones keep the numbers they were - /// given, so a gap in this sequence is a gap in the output. Renumbering to - /// stay contiguous would erase the only evidence inside the artifact that - /// anything is missing. - /// - /// Field 1: `sequence` - #[serde(rename = "sequence", with = "::buffa::json_helpers::uint64")] - pub sequence: u64, - /// Field 2: `stream` - #[serde(rename = "stream", with = "::buffa::json_helpers::proto_enum")] - pub stream: ::buffa::EnumValue, - /// Raw bytes as captured. Not decoded, not normalized, and specifically not - /// stripped of control sequences: a terminal replay that removes them is - /// replaying something the terminal never showed. Decoding is the renderer's - /// job and is a decision it gets to make at render time, more than once. - /// - /// Field 3: `payload` - #[serde( - rename = "payload", - with = "::buffa::json_helpers::opt_bytes", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub payload: ::core::option::Option<::buffa::alloc::vec::Vec>, - /// Elapsed time from the start of capture to when the capturer observed this - /// frame. Present only when CommandOutputReplayRef.timing is - /// TIMING_FIDELITY_CAPTURE_ELAPSED, and unset on every frame otherwise. - /// - /// Field 4: `elapsed` - #[serde( - rename = "elapsed", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub elapsed: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, -} -impl ::core::fmt::Debug for ReplayFrame { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReplayFrame") - .field("sequence", &self.sequence) - .field("stream", &self.stream) - .field("payload", &self.payload) - .field("elapsed", &self.elapsed) - .finish() - } -} -impl ReplayFrame { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.replay.v1alpha1.ReplayFrame"; -} -impl ReplayFrame { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::payload`] to `Some(value)`, consuming and returning `self`. - pub fn with_payload( - mut self, - value: impl Into<::buffa::alloc::vec::Vec>, - ) -> Self { - self.payload = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ReplayFrame); -impl ::buffa::MessageName for ReplayFrame { - const PACKAGE: &'static str = "trogonai.session.sessions.replay.v1alpha1"; - const NAME: &'static str = "ReplayFrame"; - const FULL_NAME: &'static str = "trogonai.session.sessions.replay.v1alpha1.ReplayFrame"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.replay.v1alpha1.ReplayFrame"; -} -impl ::buffa::Message for ReplayFrame { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.sequence) as u64; - { - let val = self.stream.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.payload { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - if self.elapsed.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.elapsed.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.sequence, buf); - ::buffa::types::put_int32_field(2u32, self.stream.to_i32(), buf); - if let Some(ref v) = self.payload { - ::buffa::types::put_shared_bytes_field(3u32, v, buf); - } - if self.elapsed.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.elapsed.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.sequence = ::buffa::types::decode_uint64(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.stream = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes( - self.payload.get_or_insert_with(::buffa::alloc::vec::Vec::new), - buf, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.elapsed.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.sequence = 0u64; - self.stream = ::buffa::EnumValue::from(0); - self.payload = ::core::option::Option::None; - self.elapsed = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReplayFrame { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REPLAY_FRAME_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.replay.v1alpha1.ReplayFrame", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.index.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.index.__view.rs deleted file mode 100644 index 31569df8f..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.index.__view.rs +++ /dev/null @@ -1,805 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/replay/v1alpha1/index.proto - -/// ReplayIndex is the trailer that makes a bounded range read of a replay -/// artifact useful. -/// -/// Range reads are byte-granular and frames are variable-length, so a read into -/// the middle of the frame region lands mid-frame, with no way to tell from the -/// bytes where the next boundary is. Without an index the only correct way to -/// reach frame one million is to parse the previous 999,999, which is exactly -/// the cost that keeping the output out of the log was supposed to avoid. -/// -/// The index is sparse. It marks frame boundaries at intervals rather than every -/// frame, because an entry per frame is an index whose size grows with the -/// output it indexes, which is the problem again with more steps. A reader seeks -/// to the nearest preceding entry and scans forward a bounded distance. -#[derive(Clone, Debug, Default)] -pub struct ReplayIndexView<'a> { - /// Total frames in the capture, and total payload bytes across them. - /// - /// Both are also on the log, in CommandOutputReplayRef. The repetition is the - /// point: a reader that has fetched only this trailer can check it against the - /// event before trusting a single offset in it, and the event is the copy the - /// artifact store did not supply. An index that disagrees with the log is not - /// a stale index, it is the wrong artifact or a damaged one. - /// - /// Field 1: `frame_count` - pub frame_count: u64, - /// Field 2: `output_byte_count` - pub output_byte_count: u64, - /// Seek points in artifact order, always including a first entry at frame 0. - /// - /// The stride is the capturer's choice and is not recorded, because a reader - /// has no use for it: it binary-searches on whichever coordinate it is seeking - /// by, and a fixed stride would be a promise a capturer that stops early - /// cannot keep. - /// - /// Field 3: `entries` - pub entries: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::ReplayIndexEntryView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReplayIndexView<'a> { - /**Whether required field `frame_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_frame_count(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `output_byte_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_output_byte_count(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ReplayIndexView<'a> { - type Owned = super::super::ReplayIndex; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.frame_count = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.output_byte_count = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::ReplayIndexEntryView, - >(), - )?; - view.entries - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReplayIndex { - frame_count: self.frame_count, - output_byte_count: self.output_byte_count, - entries: self - .entries - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReplayIndexView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.frame_count) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.output_byte_count) as u64; - for v in &self.entries { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.frame_count, buf); - ::buffa::types::put_uint64_field(2u32, self.output_byte_count, buf); - for v in &self.entries { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReplayIndexView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "frameCount", - &::buffa::json_helpers::ProtoJson(&self.frame_count), - )?; - } - { - __map - .serialize_entry( - "outputByteCount", - &::buffa::json_helpers::ProtoJson(&self.output_byte_count), - )?; - } - if !self.entries.is_empty() { - __map.serialize_entry("entries", &*self.entries)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReplayIndexView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.replay.v1alpha1"; - const NAME: &'static str = "ReplayIndex"; - const FULL_NAME: &'static str = "trogonai.session.sessions.replay.v1alpha1.ReplayIndex"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.replay.v1alpha1.ReplayIndex"; -} -::buffa::impl_default_view_instance!(ReplayIndexView); -::buffa::impl_view_reborrow!(ReplayIndexView); -/** Self-contained, `'static` owned view of a `ReplayIndex` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReplayIndexView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReplayIndexView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReplayIndexOwnedView(::buffa::OwnedView>); -impl ReplayIndexOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReplayIndexOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReplayIndexOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReplayIndex, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReplayIndexOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReplayIndexView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReplayIndexView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReplayIndex { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Total frames in the capture, and total payload bytes across them. - /// - /// Both are also on the log, in CommandOutputReplayRef. The repetition is the - /// point: a reader that has fetched only this trailer can check it against the - /// event before trusting a single offset in it, and the event is the copy the - /// artifact store did not supply. An index that disagrees with the log is not - /// a stale index, it is the wrong artifact or a damaged one. - /// - /// Field 1: `frame_count` - #[must_use] - pub fn frame_count(&self) -> u64 { - self.0.reborrow().frame_count - } - /// Field 2: `output_byte_count` - #[must_use] - pub fn output_byte_count(&self) -> u64 { - self.0.reborrow().output_byte_count - } - /// Seek points in artifact order, always including a first entry at frame 0. - /// - /// The stride is the capturer's choice and is not recorded, because a reader - /// has no use for it: it binary-searches on whichever coordinate it is seeking - /// by, and a fixed stride would be a promise a capturer that stops early - /// cannot keep. - /// - /// Field 3: `entries` - #[must_use] - pub fn entries( - &self, - ) -> &::buffa::RepeatedView< - '_, - super::super::__buffa::view::ReplayIndexEntryView<'_>, - > { - &self.0.reborrow().entries - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReplayIndexOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReplayIndexOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReplayIndexOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReplayIndexOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReplayIndex { - type View<'a> = ReplayIndexView<'a>; - type ViewHandle = ReplayIndexOwnedView; -} -impl ::serde::Serialize for ReplayIndexOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ReplayIndexEntry is one seek point, expressed in every coordinate a reader -/// might be seeking by. -/// -/// The three offsets are not redundant. They answer different questions, and a -/// reader converting between them would have to parse the frames to do it, which -/// is what it came here to avoid. -#[derive(Clone, Debug, Default)] -pub struct ReplayIndexEntryView<'a> { - /// Byte offset of a frame boundary, from the start of the artifact. This is - /// the value a range read takes. - /// - /// Field 1: `byte_offset` - pub byte_offset: u64, - /// Sequence of the frame at that boundary. Not the entry's position times a - /// stride: dropped frames leave gaps in the sequence, so this has to be - /// recorded. - /// - /// Field 2: `frame_sequence` - pub frame_sequence: u64, - /// Payload bytes emitted before that frame. This is what a UI scrolls and - /// measures in, since a user positions themselves in output, not in framing - /// overhead. - /// - /// Field 3: `output_byte_offset` - pub output_byte_offset: u64, - /// Elapsed time at that frame. Present only when the capture recorded timing, - /// and it is what makes seeking by time possible without reading anything. - /// - /// Field 4: `elapsed` - pub elapsed: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReplayIndexEntryView<'a> { - /**Whether required field `byte_offset` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_byte_offset(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `frame_sequence` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_frame_sequence(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `output_byte_offset` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_output_byte_offset(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ReplayIndexEntryView<'a> { - type Owned = super::super::ReplayIndexEntry; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.byte_offset = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.frame_sequence = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.output_byte_offset = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.elapsed.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.elapsed = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReplayIndexEntry { - byte_offset: self.byte_offset, - frame_sequence: self.frame_sequence, - output_byte_offset: self.output_byte_offset, - elapsed: match self.elapsed.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReplayIndexEntryView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.byte_offset) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.frame_sequence) as u64; - size - += 1u64 + ::buffa::types::uint64_encoded_len(self.output_byte_offset) as u64; - if self.elapsed.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.elapsed.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.byte_offset, buf); - ::buffa::types::put_uint64_field(2u32, self.frame_sequence, buf); - ::buffa::types::put_uint64_field(3u32, self.output_byte_offset, buf); - if self.elapsed.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.elapsed.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReplayIndexEntryView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "byteOffset", - &::buffa::json_helpers::ProtoJson(&self.byte_offset), - )?; - } - { - __map - .serialize_entry( - "frameSequence", - &::buffa::json_helpers::ProtoJson(&self.frame_sequence), - )?; - } - { - __map - .serialize_entry( - "outputByteOffset", - &::buffa::json_helpers::ProtoJson(&self.output_byte_offset), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.elapsed.as_option() { - __map.serialize_entry("elapsed", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReplayIndexEntryView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.replay.v1alpha1"; - const NAME: &'static str = "ReplayIndexEntry"; - const FULL_NAME: &'static str = "trogonai.session.sessions.replay.v1alpha1.ReplayIndexEntry"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.replay.v1alpha1.ReplayIndexEntry"; -} -::buffa::impl_default_view_instance!(ReplayIndexEntryView); -::buffa::impl_view_reborrow!(ReplayIndexEntryView); -/** Self-contained, `'static` owned view of a `ReplayIndexEntry` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReplayIndexEntryView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReplayIndexEntryView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReplayIndexEntryOwnedView(::buffa::OwnedView>); -impl ReplayIndexEntryOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReplayIndexEntryOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReplayIndexEntryOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReplayIndexEntry, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReplayIndexEntryOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReplayIndexEntryView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReplayIndexEntryView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReplayIndexEntry { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Byte offset of a frame boundary, from the start of the artifact. This is - /// the value a range read takes. - /// - /// Field 1: `byte_offset` - #[must_use] - pub fn byte_offset(&self) -> u64 { - self.0.reborrow().byte_offset - } - /// Sequence of the frame at that boundary. Not the entry's position times a - /// stride: dropped frames leave gaps in the sequence, so this has to be - /// recorded. - /// - /// Field 2: `frame_sequence` - #[must_use] - pub fn frame_sequence(&self) -> u64 { - self.0.reborrow().frame_sequence - } - /// Payload bytes emitted before that frame. This is what a UI scrolls and - /// measures in, since a user positions themselves in output, not in framing - /// overhead. - /// - /// Field 3: `output_byte_offset` - #[must_use] - pub fn output_byte_offset(&self) -> u64 { - self.0.reborrow().output_byte_offset - } - /// Elapsed time at that frame. Present only when the capture recorded timing, - /// and it is what makes seeking by time possible without reading anything. - /// - /// Field 4: `elapsed` - #[must_use] - pub fn elapsed( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().elapsed - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReplayIndexEntryOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReplayIndexEntryOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReplayIndexEntryOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReplayIndexEntryOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReplayIndexEntry { - type View<'a> = ReplayIndexEntryView<'a>; - type ViewHandle = ReplayIndexEntryOwnedView; -} -impl ::serde::Serialize for ReplayIndexEntryOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.index.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.index.rs deleted file mode 100644 index bf22af7d4..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.index.rs +++ /dev/null @@ -1,393 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/replay/v1alpha1/index.proto - -/// ReplayIndex is the trailer that makes a bounded range read of a replay -/// artifact useful. -/// -/// Range reads are byte-granular and frames are variable-length, so a read into -/// the middle of the frame region lands mid-frame, with no way to tell from the -/// bytes where the next boundary is. Without an index the only correct way to -/// reach frame one million is to parse the previous 999,999, which is exactly -/// the cost that keeping the output out of the log was supposed to avoid. -/// -/// The index is sparse. It marks frame boundaries at intervals rather than every -/// frame, because an entry per frame is an index whose size grows with the -/// output it indexes, which is the problem again with more steps. A reader seeks -/// to the nearest preceding entry and scans forward a bounded distance. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReplayIndex { - /// Total frames in the capture, and total payload bytes across them. - /// - /// Both are also on the log, in CommandOutputReplayRef. The repetition is the - /// point: a reader that has fetched only this trailer can check it against the - /// event before trusting a single offset in it, and the event is the copy the - /// artifact store did not supply. An index that disagrees with the log is not - /// a stale index, it is the wrong artifact or a damaged one. - /// - /// Field 1: `frame_count` - #[serde( - rename = "frameCount", - alias = "frame_count", - with = "::buffa::json_helpers::uint64" - )] - pub frame_count: u64, - /// Field 2: `output_byte_count` - #[serde( - rename = "outputByteCount", - alias = "output_byte_count", - with = "::buffa::json_helpers::uint64" - )] - pub output_byte_count: u64, - /// Seek points in artifact order, always including a first entry at frame 0. - /// - /// The stride is the capturer's choice and is not recorded, because a reader - /// has no use for it: it binary-searches on whichever coordinate it is seeking - /// by, and a fixed stride would be a promise a capturer that stops early - /// cannot keep. - /// - /// Field 3: `entries` - #[serde( - rename = "entries", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub entries: ::buffa::alloc::vec::Vec, -} -impl ::core::fmt::Debug for ReplayIndex { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReplayIndex") - .field("frame_count", &self.frame_count) - .field("output_byte_count", &self.output_byte_count) - .field("entries", &self.entries) - .finish() - } -} -impl ReplayIndex { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.replay.v1alpha1.ReplayIndex"; -} -::buffa::impl_default_instance!(ReplayIndex); -impl ::buffa::MessageName for ReplayIndex { - const PACKAGE: &'static str = "trogonai.session.sessions.replay.v1alpha1"; - const NAME: &'static str = "ReplayIndex"; - const FULL_NAME: &'static str = "trogonai.session.sessions.replay.v1alpha1.ReplayIndex"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.replay.v1alpha1.ReplayIndex"; -} -impl ::buffa::Message for ReplayIndex { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.frame_count) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.output_byte_count) as u64; - for v in &self.entries { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.frame_count, buf); - ::buffa::types::put_uint64_field(2u32, self.output_byte_count, buf); - for v in &self.entries { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.frame_count = ::buffa::types::decode_uint64(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.output_byte_count = ::buffa::types::decode_uint64(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.entries.push(elem); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.frame_count = 0u64; - self.output_byte_count = 0u64; - self.entries.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReplayIndex { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REPLAY_INDEX_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.replay.v1alpha1.ReplayIndex", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ReplayIndexEntry is one seek point, expressed in every coordinate a reader -/// might be seeking by. -/// -/// The three offsets are not redundant. They answer different questions, and a -/// reader converting between them would have to parse the frames to do it, which -/// is what it came here to avoid. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReplayIndexEntry { - /// Byte offset of a frame boundary, from the start of the artifact. This is - /// the value a range read takes. - /// - /// Field 1: `byte_offset` - #[serde( - rename = "byteOffset", - alias = "byte_offset", - with = "::buffa::json_helpers::uint64" - )] - pub byte_offset: u64, - /// Sequence of the frame at that boundary. Not the entry's position times a - /// stride: dropped frames leave gaps in the sequence, so this has to be - /// recorded. - /// - /// Field 2: `frame_sequence` - #[serde( - rename = "frameSequence", - alias = "frame_sequence", - with = "::buffa::json_helpers::uint64" - )] - pub frame_sequence: u64, - /// Payload bytes emitted before that frame. This is what a UI scrolls and - /// measures in, since a user positions themselves in output, not in framing - /// overhead. - /// - /// Field 3: `output_byte_offset` - #[serde( - rename = "outputByteOffset", - alias = "output_byte_offset", - with = "::buffa::json_helpers::uint64" - )] - pub output_byte_offset: u64, - /// Elapsed time at that frame. Present only when the capture recorded timing, - /// and it is what makes seeking by time possible without reading anything. - /// - /// Field 4: `elapsed` - #[serde( - rename = "elapsed", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub elapsed: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, -} -impl ::core::fmt::Debug for ReplayIndexEntry { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReplayIndexEntry") - .field("byte_offset", &self.byte_offset) - .field("frame_sequence", &self.frame_sequence) - .field("output_byte_offset", &self.output_byte_offset) - .field("elapsed", &self.elapsed) - .finish() - } -} -impl ReplayIndexEntry { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.replay.v1alpha1.ReplayIndexEntry"; -} -::buffa::impl_default_instance!(ReplayIndexEntry); -impl ::buffa::MessageName for ReplayIndexEntry { - const PACKAGE: &'static str = "trogonai.session.sessions.replay.v1alpha1"; - const NAME: &'static str = "ReplayIndexEntry"; - const FULL_NAME: &'static str = "trogonai.session.sessions.replay.v1alpha1.ReplayIndexEntry"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.replay.v1alpha1.ReplayIndexEntry"; -} -impl ::buffa::Message for ReplayIndexEntry { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.byte_offset) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.frame_sequence) as u64; - size - += 1u64 + ::buffa::types::uint64_encoded_len(self.output_byte_offset) as u64; - if self.elapsed.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.elapsed.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.byte_offset, buf); - ::buffa::types::put_uint64_field(2u32, self.frame_sequence, buf); - ::buffa::types::put_uint64_field(3u32, self.output_byte_offset, buf); - if self.elapsed.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.elapsed.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.byte_offset = ::buffa::types::decode_uint64(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.frame_sequence = ::buffa::types::decode_uint64(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.output_byte_offset = ::buffa::types::decode_uint64(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.elapsed.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.byte_offset = 0u64; - self.frame_sequence = 0u64; - self.output_byte_offset = 0u64; - self.elapsed = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReplayIndexEntry { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REPLAY_INDEX_ENTRY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.replay.v1alpha1.ReplayIndexEntry", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.mod.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.mod.rs deleted file mode 100644 index 8770c2c34..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.replay.v1alpha1.mod.rs +++ /dev/null @@ -1,45 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. - -include!("trogonai.session.sessions.replay.v1alpha1.frame.rs"); -include!("trogonai.session.sessions.replay.v1alpha1.index.rs"); -#[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception -)] -pub mod __buffa { - #[allow(unused_imports)] - use super::*; - pub mod view { - #[allow(unused_imports)] - use super::*; - include!("trogonai.session.sessions.replay.v1alpha1.frame.__view.rs"); - include!("trogonai.session.sessions.replay.v1alpha1.index.__view.rs"); - } - /// Register this package's `Any` type entries and extension entries. - pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) { - reg.register_json_any(super::__REPLAY_FRAME_JSON_ANY); - reg.register_json_any(super::__REPLAY_INDEX_JSON_ANY); - reg.register_json_any(super::__REPLAY_INDEX_ENTRY_JSON_ANY); - } -} -#[doc(inline)] -pub use self::__buffa::view::ReplayFrameView; -#[doc(inline)] -pub use self::__buffa::view::ReplayFrameOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReplayIndexView; -#[doc(inline)] -pub use self::__buffa::view::ReplayIndexOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReplayIndexEntryView; -#[doc(inline)] -pub use self::__buffa::view::ReplayIndexEntryOwnedView; -#[doc(inline)] -pub use self::__buffa::register_types; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.state.v1alpha1.mod.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.state.v1alpha1.mod.rs deleted file mode 100644 index b657451a6..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.state.v1alpha1.mod.rs +++ /dev/null @@ -1,78 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. - -include!("trogonai.session.sessions.state.v1alpha1.state.rs"); -#[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception -)] -pub mod __buffa { - #[allow(unused_imports)] - use super::*; - pub mod view { - #[allow(unused_imports)] - use super::*; - include!("trogonai.session.sessions.state.v1alpha1.state.__view.rs"); - } - /// Register this package's `Any` type entries and extension entries. - pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) { - reg.register_json_any(super::__STATE_JSON_ANY); - reg.register_json_any(super::__FORK_ORIGIN_JSON_ANY); - reg.register_json_any(super::__RECOVERY_ORIGIN_JSON_ANY); - reg.register_json_any(super::__PARENT_LINK_JSON_ANY); - reg.register_json_any(super::__DELEGATION_JSON_ANY); - reg.register_json_any(super::__EXECUTION_ATTEMPT_JSON_ANY); - reg.register_json_any(super::__COMPACTION_MARKER_JSON_ANY); - reg.register_json_any(super::__TOOL_CALL_JSON_ANY); - reg.register_json_any(super::__OPERATION_JSON_ANY); - reg.register_json_any(super::__CHECKPOINT_EVIDENCE_JSON_ANY); - } -} -#[doc(inline)] -pub use self::__buffa::view::StateView; -#[doc(inline)] -pub use self::__buffa::view::StateOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ForkOriginView; -#[doc(inline)] -pub use self::__buffa::view::ForkOriginOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RecoveryOriginView; -#[doc(inline)] -pub use self::__buffa::view::RecoveryOriginOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ParentLinkView; -#[doc(inline)] -pub use self::__buffa::view::ParentLinkOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DelegationView; -#[doc(inline)] -pub use self::__buffa::view::DelegationOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ExecutionAttemptView; -#[doc(inline)] -pub use self::__buffa::view::ExecutionAttemptOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CompactionMarkerView; -#[doc(inline)] -pub use self::__buffa::view::CompactionMarkerOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallOwnedView; -#[doc(inline)] -pub use self::__buffa::view::OperationView; -#[doc(inline)] -pub use self::__buffa::view::OperationOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CheckpointEvidenceView; -#[doc(inline)] -pub use self::__buffa::view::CheckpointEvidenceOwnedView; -#[doc(inline)] -pub use self::__buffa::register_types; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.state.v1alpha1.state.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.state.v1alpha1.state.__view.rs deleted file mode 100644 index 38a04b936..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.state.v1alpha1.state.__view.rs +++ /dev/null @@ -1,5623 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/state/v1alpha1/state.proto - -/// State is the Session aggregate's write-side fold: exactly the facts the -/// session commands read to enforce their invariants, and nothing a read model -/// owns (ADR#0035, ADR#0045). It is never a projection and never a transcript; -/// message bodies, todo items, artifacts, and display metadata are deliberately -/// absent because no command reads them. -/// -/// A crash between a started tool call and its outcome is the load-bearing case: -/// replaying a session leaves that call in TOOL_CALL_STATUS_STARTED with no -/// settled_at, and its reserved operation in OPERATION_STATUS_RESERVED, so -/// reconciliation can see the missing terminal outcome and finish or reject the -/// interrupted call rather than silently dropping it. -#[derive(Clone, Debug, Default)] -pub struct StateView<'a> { - /// Field 1: `state` - pub state: ::buffa::EnumValue, - /// Field 2: `session_id` - pub session_id: &'a str, - /// Count of events folded so far: this session's own fold-derived ordinal of - /// the last applied event, never a JetStream sequence (ADR#0013). - /// - /// Field 3: `position` - pub position: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - /// Digest of the immutable StoredSessionExecutionPlan recorded at start; every - /// attempt, checkpoint, and compaction is bound to it. - /// - /// Field 4: `execution_plan_digest` - pub execution_plan_digest: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::DigestView<'a>, - >, - /// Which marker sealed the session. The first terminal marker wins; a later one - /// is audit-only. - /// - /// Field 5: `terminal_marker` - pub terminal_marker: ::buffa::EnumValue, - /// Context root when this session was forked from another one; unset for a - /// session that started its own context. - /// - /// Field 6: `fork_origin` - pub fork_origin: ::buffa::MessageFieldView< - super::super::__buffa::view::ForkOriginView<'a>, - >, - /// Provenance of a salvaged session; unset for a session that was not - /// recovered from a damaged source. Folded because it is a precondition the - /// commands must be able to read: a session that is a partial copy cannot - /// honor a rewind or a compaction against source positions it never received. - /// - /// Field 19: `recovery_origin` - pub recovery_origin: ::buffa::MessageFieldView< - super::super::__buffa::view::RecoveryOriginView<'a>, - >, - /// Recorded parent lineage of a delegated child session. - /// - /// Field 7: `parent` - pub parent: ::buffa::MessageFieldView< - super::super::__buffa::view::ParentLinkView<'a>, - >, - /// Newest rewind boundary. Rewind masks effective history for readers and - /// future turns; it never un-applies folded facts, because a tool call that - /// really ran still has to be reconcilable. - /// - /// Field 8: `keep_through` - pub keep_through: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - /// Newest compaction marker, the prior usable boundary a further compaction - /// and an attempt restore both resolve against. - /// - /// Field 9: `compaction` - pub compaction: ::buffa::MessageFieldView< - super::super::__buffa::view::CompactionMarkerView<'a>, - >, - /// Attempt currently holding the session; unset when no attempt is running. - /// - /// Field 10: `active_attempt` - pub active_attempt: ::buffa::MessageFieldView< - super::super::__buffa::view::ExecutionAttemptView<'a>, - >, - /// Most recently started attempt, still active or already ended, so a new - /// attempt can be checked for monotonic numbering and exact predecessor. - /// - /// Field 11: `last_attempt_id` - pub last_attempt_id: ::core::option::Option<&'a str>, - /// Field 12: `last_attempt_number` - pub last_attempt_number: ::core::option::Option, - /// Tool calls keyed by tool_call_id, in first-observed fold order. - /// - /// Field 13: `tool_calls` - pub tool_calls: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::ToolCallView<'a>, - >, - /// Operation ledger entries keyed by operation_id, in reservation fold order. - /// - /// Field 14: `operations` - pub operations: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::OperationView<'a>, - >, - /// Dispatched delegations keyed by operation_id, parent side. - /// - /// Field 15: `delegations` - pub delegations: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::DelegationView<'a>, - >, - /// First admitted evidence per checkpoint_id; a later event reusing an id is - /// retained on the log but never replaces the admitted evidence. - /// - /// Field 16: `checkpoints` - pub checkpoints: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::CheckpointEvidenceView<'a>, - >, - /// Privacy dependencies an attempt restore and a compaction must respect. - /// - /// Field 17: `redacted_event_ids` - pub redacted_event_ids: ::buffa::RepeatedView<'a, &'a str>, - /// Field 18: `erased_artifact_ids` - pub erased_artifact_ids: ::buffa::RepeatedView<'a, &'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> StateView<'a> { - /**Whether required field `state` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_state(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `position` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_position(&self) -> bool { - self.position.is_set() - } - /**Whether required field `terminal_marker` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_terminal_marker(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for StateView<'a> { - type Owned = super::super::State; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.state = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.position.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.position = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.execution_plan_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.execution_plan_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.terminal_marker = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.fork_origin.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.fork_origin = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 19u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.recovery_origin.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.recovery_origin = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.parent.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.parent = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.keep_through.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.keep_through = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.compaction.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.compaction = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.active_attempt.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.active_attempt = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.last_attempt_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.last_attempt_number = Some( - ::buffa::types::decode_uint64(&mut cur)?, - ); - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::(), - )?; - view.tool_calls - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - 14u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::(), - )?; - view.operations - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - 15u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::(), - )?; - view.delegations - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - 16u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::CheckpointEvidenceView, - >(), - )?; - view.checkpoints - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - 17u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::borrow_str(&mut cur)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - view.redacted_event_ids.push(__elem); - } - 18u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::borrow_str(&mut cur)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - view.erased_artifact_ids.push(__elem); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::State { - state: self.state, - session_id: self.session_id.to_string(), - position: match self.position.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - execution_plan_digest: match self.execution_plan_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - terminal_marker: self.terminal_marker, - fork_origin: match self.fork_origin.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ForkOrigin, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - recovery_origin: match self.recovery_origin.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::RecoveryOrigin, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - parent: match self.parent.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ParentLink, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - keep_through: match self.keep_through.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - compaction: match self.compaction.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CompactionMarker, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - active_attempt: match self.active_attempt.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ExecutionAttempt, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - last_attempt_id: self.last_attempt_id.map(|s| s.to_string()), - last_attempt_number: self.last_attempt_number, - tool_calls: self - .tool_calls - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - operations: self - .operations - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - delegations: self - .delegations - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - checkpoints: self - .checkpoints - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - redacted_event_ids: self - .redacted_event_ids - .iter() - .map(|s| s.to_string()) - .collect(), - erased_artifact_ids: self - .erased_artifact_ids - .iter() - .map(|s| s.to_string()) - .collect(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for StateView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.state.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.position.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.position.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.execution_plan_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.execution_plan_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.terminal_marker.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.fork_origin.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.fork_origin.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.parent.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.keep_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.keep_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.compaction.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.compaction.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.active_attempt.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.active_attempt.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.last_attempt_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(v) = self.last_attempt_number { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - for v in &self.tool_calls { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.operations { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.delegations { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.checkpoints { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 2u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.redacted_event_ids { - size += 2u64 + ::buffa::types::string_encoded_len(v) as u64; - } - for v in &self.erased_artifact_ids { - size += 2u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.recovery_origin.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.recovery_origin.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 2u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.state.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.session_id, buf); - if self.position.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.position.write_to(__cache, buf); - } - if self.execution_plan_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.execution_plan_digest.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(5u32, self.terminal_marker.to_i32(), buf); - if self.fork_origin.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.fork_origin.write_to(__cache, buf); - } - if self.parent.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent.write_to(__cache, buf); - } - if self.keep_through.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.keep_through.write_to(__cache, buf); - } - if self.compaction.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.compaction.write_to(__cache, buf); - } - if self.active_attempt.is_set() { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - self.active_attempt.write_to(__cache, buf); - } - if let Some(ref v) = self.last_attempt_id { - ::buffa::types::put_string_field(11u32, v, buf); - } - if let Some(v) = self.last_attempt_number { - ::buffa::types::put_uint64_field(12u32, v, buf); - } - for v in &self.tool_calls { - ::buffa::types::put_len_delimited_header( - 13u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.operations { - ::buffa::types::put_len_delimited_header( - 14u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.delegations { - ::buffa::types::put_len_delimited_header( - 15u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.checkpoints { - ::buffa::types::put_len_delimited_header( - 16u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.redacted_event_ids { - ::buffa::types::put_string_field(17u32, v, buf); - } - for v in &self.erased_artifact_ids { - ::buffa::types::put_string_field(18u32, v, buf); - } - if self.recovery_origin.is_set() { - ::buffa::types::put_len_delimited_header( - 19u32, - u64::from(__cache.consume_next()), - buf, - ); - self.recovery_origin.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for StateView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("state", &self.state)?; - } - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.position.as_option() { - __map.serialize_entry("position", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self - .execution_plan_digest - .as_option() - { - __map.serialize_entry("executionPlanDigest", __v)?; - } - } - { - __map.serialize_entry("terminalMarker", &self.terminal_marker)?; - } - { - if let ::core::option::Option::Some(__v) = self.fork_origin.as_option() { - __map.serialize_entry("forkOrigin", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.recovery_origin.as_option() { - __map.serialize_entry("recoveryOrigin", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.parent.as_option() { - __map.serialize_entry("parent", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.keep_through.as_option() { - __map.serialize_entry("keepThrough", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.compaction.as_option() { - __map.serialize_entry("compaction", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.active_attempt.as_option() { - __map.serialize_entry("activeAttempt", __v)?; - } - } - if let ::core::option::Option::Some(__v) = self.last_attempt_id { - __map.serialize_entry("lastAttemptId", __v)?; - } - if let ::core::option::Option::Some(__v) = self.last_attempt_number { - __map - .serialize_entry( - "lastAttemptNumber", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if !self.tool_calls.is_empty() { - __map.serialize_entry("toolCalls", &*self.tool_calls)?; - } - if !self.operations.is_empty() { - __map.serialize_entry("operations", &*self.operations)?; - } - if !self.delegations.is_empty() { - __map.serialize_entry("delegations", &*self.delegations)?; - } - if !self.checkpoints.is_empty() { - __map.serialize_entry("checkpoints", &*self.checkpoints)?; - } - if !self.redacted_event_ids.is_empty() { - __map.serialize_entry("redactedEventIds", &*self.redacted_event_ids)?; - } - if !self.erased_artifact_ids.is_empty() { - __map.serialize_entry("erasedArtifactIds", &*self.erased_artifact_ids)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for StateView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "State"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.State"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.State"; -} -::buffa::impl_default_view_instance!(StateView); -::buffa::impl_view_reborrow!(StateView); -/** Self-contained, `'static` owned view of a `State` message. - - Wraps [`::buffa::OwnedView`]`<`[`StateView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`StateView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct StateOwnedView(::buffa::OwnedView>); -impl StateOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok(StateOwnedView(::buffa::OwnedView::decode(bytes)?)) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StateOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::State, - ) -> ::core::result::Result { - ::core::result::Result::Ok(StateOwnedView(::buffa::OwnedView::from_owned(msg)?)) - } - /// Borrow the full [`StateView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &StateView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::State { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `state` - #[must_use] - pub fn state(&self) -> ::buffa::EnumValue { - self.0.reborrow().state - } - /// Field 2: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Count of events folded so far: this session's own fold-derived ordinal of - /// the last applied event, never a JetStream sequence (ADR#0013). - /// - /// Field 3: `position` - #[must_use] - pub fn position( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().position - } - /// Digest of the immutable StoredSessionExecutionPlan recorded at start; every - /// attempt, checkpoint, and compaction is bound to it. - /// - /// Field 4: `execution_plan_digest` - #[must_use] - pub fn execution_plan_digest( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::DigestView<'_>, - > { - &self.0.reborrow().execution_plan_digest - } - /// Which marker sealed the session. The first terminal marker wins; a later one - /// is audit-only. - /// - /// Field 5: `terminal_marker` - #[must_use] - pub fn terminal_marker(&self) -> ::buffa::EnumValue { - self.0.reborrow().terminal_marker - } - /// Context root when this session was forked from another one; unset for a - /// session that started its own context. - /// - /// Field 6: `fork_origin` - #[must_use] - pub fn fork_origin( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().fork_origin - } - /// Provenance of a salvaged session; unset for a session that was not - /// recovered from a damaged source. Folded because it is a precondition the - /// commands must be able to read: a session that is a partial copy cannot - /// honor a rewind or a compaction against source positions it never received. - /// - /// Field 19: `recovery_origin` - #[must_use] - pub fn recovery_origin( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::RecoveryOriginView<'_>, - > { - &self.0.reborrow().recovery_origin - } - /// Recorded parent lineage of a delegated child session. - /// - /// Field 7: `parent` - #[must_use] - pub fn parent( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().parent - } - /// Newest rewind boundary. Rewind masks effective history for readers and - /// future turns; it never un-applies folded facts, because a tool call that - /// really ran still has to be reconcilable. - /// - /// Field 8: `keep_through` - #[must_use] - pub fn keep_through( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().keep_through - } - /// Newest compaction marker, the prior usable boundary a further compaction - /// and an attempt restore both resolve against. - /// - /// Field 9: `compaction` - #[must_use] - pub fn compaction( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CompactionMarkerView<'_>, - > { - &self.0.reborrow().compaction - } - /// Attempt currently holding the session; unset when no attempt is running. - /// - /// Field 10: `active_attempt` - #[must_use] - pub fn active_attempt( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ExecutionAttemptView<'_>, - > { - &self.0.reborrow().active_attempt - } - /// Most recently started attempt, still active or already ended, so a new - /// attempt can be checked for monotonic numbering and exact predecessor. - /// - /// Field 11: `last_attempt_id` - #[must_use] - pub fn last_attempt_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().last_attempt_id - } - /// Field 12: `last_attempt_number` - #[must_use] - pub fn last_attempt_number(&self) -> ::core::option::Option { - self.0.reborrow().last_attempt_number - } - /// Tool calls keyed by tool_call_id, in first-observed fold order. - /// - /// Field 13: `tool_calls` - #[must_use] - pub fn tool_calls( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::ToolCallView<'_>> { - &self.0.reborrow().tool_calls - } - /// Operation ledger entries keyed by operation_id, in reservation fold order. - /// - /// Field 14: `operations` - #[must_use] - pub fn operations( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::OperationView<'_>> { - &self.0.reborrow().operations - } - /// Dispatched delegations keyed by operation_id, parent side. - /// - /// Field 15: `delegations` - #[must_use] - pub fn delegations( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::DelegationView<'_>> { - &self.0.reborrow().delegations - } - /// First admitted evidence per checkpoint_id; a later event reusing an id is - /// retained on the log but never replaces the admitted evidence. - /// - /// Field 16: `checkpoints` - #[must_use] - pub fn checkpoints( - &self, - ) -> &::buffa::RepeatedView< - '_, - super::super::__buffa::view::CheckpointEvidenceView<'_>, - > { - &self.0.reborrow().checkpoints - } - /// Privacy dependencies an attempt restore and a compaction must respect. - /// - /// Field 17: `redacted_event_ids` - #[must_use] - pub fn redacted_event_ids(&self) -> &::buffa::RepeatedView<'_, &'_ str> { - &self.0.reborrow().redacted_event_ids - } - /// Field 18: `erased_artifact_ids` - #[must_use] - pub fn erased_artifact_ids(&self) -> &::buffa::RepeatedView<'_, &'_ str> { - &self.0.reborrow().erased_artifact_ids - } -} -impl ::core::convert::From<::buffa::OwnedView>> for StateOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - StateOwnedView(inner) - } -} -impl ::core::convert::From for ::buffa::OwnedView> { - fn from(wrapper: StateOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> for StateOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::State { - type View<'a> = StateView<'a>; - type ViewHandle = StateOwnedView; -} -impl ::serde::Serialize for StateOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -#[derive(Clone, Debug, Default)] -pub struct ForkOriginView<'a> { - /// Field 1: `source_session_id` - pub source_session_id: &'a str, - /// Field 2: `context_prefix_boundary` - pub context_prefix_boundary: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ForkOriginView<'a> { - /**Whether required field `source_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `context_prefix_boundary` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_context_prefix_boundary(&self) -> bool { - self.context_prefix_boundary.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ForkOriginView<'a> { - type Owned = super::super::ForkOrigin; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.context_prefix_boundary.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.context_prefix_boundary = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ForkOrigin { - source_session_id: self.source_session_id.to_string(), - context_prefix_boundary: match self.context_prefix_boundary.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ForkOriginView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.context_prefix_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.context_prefix_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - if self.context_prefix_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.context_prefix_boundary.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ForkOriginView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sourceSessionId", self.source_session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self - .context_prefix_boundary - .as_option() - { - __map.serialize_entry("contextPrefixBoundary", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ForkOriginView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "ForkOrigin"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.ForkOrigin"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ForkOrigin"; -} -::buffa::impl_default_view_instance!(ForkOriginView); -::buffa::impl_view_reborrow!(ForkOriginView); -/** Self-contained, `'static` owned view of a `ForkOrigin` message. - - Wraps [`::buffa::OwnedView`]`<`[`ForkOriginView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ForkOriginView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ForkOriginOwnedView(::buffa::OwnedView>); -impl ForkOriginOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ForkOriginOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ForkOriginOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ForkOrigin, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ForkOriginOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ForkOriginView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ForkOriginView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ForkOrigin { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `source_session_id` - #[must_use] - pub fn source_session_id(&self) -> &'_ str { - self.0.reborrow().source_session_id - } - /// Field 2: `context_prefix_boundary` - #[must_use] - pub fn context_prefix_boundary( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().context_prefix_boundary - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ForkOriginOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ForkOriginOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ForkOriginOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ForkOriginOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ForkOrigin { - type View<'a> = ForkOriginView<'a>; - type ViewHandle = ForkOriginOwnedView; -} -impl ::serde::Serialize for ForkOriginOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// RecoveryOrigin is the damaged source a salvaged session was copied from. -/// -/// source_boundary is a position on the source's stream, not on this one. This -/// session's ordinals count its own events and start at 1 regardless of where the -/// source's cut ended. -#[derive(Clone, Debug, Default)] -pub struct RecoveryOriginView<'a> { - /// Field 1: `source_session_id` - pub source_session_id: &'a str, - /// Field 2: `source_boundary` - pub source_boundary: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 3: `source_digest` - pub source_digest: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::DigestView<'a>, - >, - /// Field 4: `salvage_key` - pub salvage_key: &'a str, - /// Field 5: `completeness` - pub completeness: ::buffa::EnumValue< - super::super::super::super::v1alpha1::RecoveryCompleteness, - >, - /// Field 6: `omitted_count` - pub omitted_count: u32, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RecoveryOriginView<'a> { - /**Whether required field `source_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `source_boundary` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_boundary(&self) -> bool { - self.source_boundary.is_set() - } - /**Whether required field `source_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_digest(&self) -> bool { - self.source_digest.is_set() - } - /**Whether required field `salvage_key` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_salvage_key(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `completeness` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_completeness(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `omitted_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_omitted_count(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RecoveryOriginView<'a> { - type Owned = super::super::RecoveryOrigin; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.source_boundary.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.source_boundary = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.source_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.source_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.salvage_key = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.completeness = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.omitted_count = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RecoveryOrigin { - source_session_id: self.source_session_id.to_string(), - source_boundary: match self.source_boundary.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - source_digest: match self.source_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - salvage_key: self.salvage_key.to_string(), - completeness: self.completeness, - omitted_count: self.omitted_count, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RecoveryOriginView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.source_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.source_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.salvage_key) as u64; - { - let val = self.completeness.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.omitted_count) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - if self.source_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_boundary.write_to(__cache, buf); - } - if self.source_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.salvage_key, buf); - ::buffa::types::put_int32_field(5u32, self.completeness.to_i32(), buf); - ::buffa::types::put_uint32_field(6u32, self.omitted_count, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RecoveryOriginView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sourceSessionId", self.source_session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.source_boundary.as_option() { - __map.serialize_entry("sourceBoundary", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.source_digest.as_option() { - __map.serialize_entry("sourceDigest", __v)?; - } - } - { - __map.serialize_entry("salvageKey", self.salvage_key)?; - } - { - __map.serialize_entry("completeness", &self.completeness)?; - } - { - __map - .serialize_entry( - "omittedCount", - &::buffa::json_helpers::ProtoJson(&self.omitted_count), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RecoveryOriginView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "RecoveryOrigin"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.RecoveryOrigin"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.RecoveryOrigin"; -} -::buffa::impl_default_view_instance!(RecoveryOriginView); -::buffa::impl_view_reborrow!(RecoveryOriginView); -/** Self-contained, `'static` owned view of a `RecoveryOrigin` message. - - Wraps [`::buffa::OwnedView`]`<`[`RecoveryOriginView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RecoveryOriginView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RecoveryOriginOwnedView(::buffa::OwnedView>); -impl RecoveryOriginOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecoveryOriginOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecoveryOriginOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RecoveryOrigin, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecoveryOriginOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RecoveryOriginView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RecoveryOriginView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RecoveryOrigin { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `source_session_id` - #[must_use] - pub fn source_session_id(&self) -> &'_ str { - self.0.reborrow().source_session_id - } - /// Field 2: `source_boundary` - #[must_use] - pub fn source_boundary( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().source_boundary - } - /// Field 3: `source_digest` - #[must_use] - pub fn source_digest( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::DigestView<'_>, - > { - &self.0.reborrow().source_digest - } - /// Field 4: `salvage_key` - #[must_use] - pub fn salvage_key(&self) -> &'_ str { - self.0.reborrow().salvage_key - } - /// Field 5: `completeness` - #[must_use] - pub fn completeness( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().completeness - } - /// Field 6: `omitted_count` - #[must_use] - pub fn omitted_count(&self) -> u32 { - self.0.reborrow().omitted_count - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RecoveryOriginOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RecoveryOriginOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RecoveryOriginOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RecoveryOriginOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RecoveryOrigin { - type View<'a> = RecoveryOriginView<'a>; - type ViewHandle = RecoveryOriginOwnedView; -} -impl ::serde::Serialize for RecoveryOriginOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -#[derive(Clone, Debug, Default)] -pub struct ParentLinkView<'a> { - /// Field 1: `parent_session_id` - pub parent_session_id: &'a str, - /// The parent's own ordinal of the dispatch that created this session. - /// - /// Field 2: `parent_dispatched_at` - pub parent_dispatched_at: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 3: `cascade_policy` - pub cascade_policy: ::buffa::EnumValue< - super::super::super::super::v1alpha1::CascadePolicy, - >, - /// The parent-side operation this session was dispatched under. - /// - /// Field 4: `operation_id` - pub operation_id: &'a str, - /// The parent reached a terminal state and this session observed it. - /// - /// Field 5: `parent_terminated` - pub parent_terminated: bool, - /// The parent rewound past the dispatch: the inherited prefix no longer holds. - /// - /// Field 6: `history_invalidated` - pub history_invalidated: bool, - /// Set once the lineage is detached, making the detach idempotent per id. - /// - /// Field 7: `detach_operation_id` - pub detach_operation_id: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ParentLinkView<'a> { - /**Whether required field `parent_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `parent_dispatched_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_dispatched_at(&self) -> bool { - self.parent_dispatched_at.is_set() - } - /**Whether required field `cascade_policy` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_cascade_policy(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `parent_terminated` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_terminated(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `history_invalidated` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_history_invalidated(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ParentLinkView<'a> { - type Owned = super::super::ParentLink; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.parent_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.parent_dispatched_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.parent_dispatched_at = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.cascade_policy = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.parent_terminated = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.history_invalidated = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detach_operation_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ParentLink { - parent_session_id: self.parent_session_id.to_string(), - parent_dispatched_at: match self.parent_dispatched_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - cascade_policy: self.cascade_policy, - operation_id: self.operation_id.to_string(), - parent_terminated: self.parent_terminated, - history_invalidated: self.history_invalidated, - detach_operation_id: self.detach_operation_id.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ParentLinkView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - if self.parent_dispatched_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent_dispatched_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.cascade_policy.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - if let Some(ref v) = self.detach_operation_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.parent_session_id, buf); - if self.parent_dispatched_at.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent_dispatched_at.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.cascade_policy.to_i32(), buf); - ::buffa::types::put_string_field(4u32, &self.operation_id, buf); - ::buffa::types::put_bool_field(5u32, self.parent_terminated, buf); - ::buffa::types::put_bool_field(6u32, self.history_invalidated, buf); - if let Some(ref v) = self.detach_operation_id { - ::buffa::types::put_string_field(7u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ParentLinkView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("parentSessionId", self.parent_session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self - .parent_dispatched_at - .as_option() - { - __map.serialize_entry("parentDispatchedAt", __v)?; - } - } - { - __map.serialize_entry("cascadePolicy", &self.cascade_policy)?; - } - { - __map.serialize_entry("operationId", self.operation_id)?; - } - { - __map.serialize_entry("parentTerminated", &self.parent_terminated)?; - } - { - __map.serialize_entry("historyInvalidated", &self.history_invalidated)?; - } - if let ::core::option::Option::Some(__v) = self.detach_operation_id { - __map.serialize_entry("detachOperationId", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ParentLinkView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "ParentLink"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.ParentLink"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ParentLink"; -} -::buffa::impl_default_view_instance!(ParentLinkView); -::buffa::impl_view_reborrow!(ParentLinkView); -/** Self-contained, `'static` owned view of a `ParentLink` message. - - Wraps [`::buffa::OwnedView`]`<`[`ParentLinkView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ParentLinkView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ParentLinkOwnedView(::buffa::OwnedView>); -impl ParentLinkOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentLinkOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentLinkOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ParentLink, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentLinkOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ParentLinkView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ParentLinkView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ParentLink { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `parent_session_id` - #[must_use] - pub fn parent_session_id(&self) -> &'_ str { - self.0.reborrow().parent_session_id - } - /// The parent's own ordinal of the dispatch that created this session. - /// - /// Field 2: `parent_dispatched_at` - #[must_use] - pub fn parent_dispatched_at( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().parent_dispatched_at - } - /// Field 3: `cascade_policy` - #[must_use] - pub fn cascade_policy( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().cascade_policy - } - /// The parent-side operation this session was dispatched under. - /// - /// Field 4: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// The parent reached a terminal state and this session observed it. - /// - /// Field 5: `parent_terminated` - #[must_use] - pub fn parent_terminated(&self) -> bool { - self.0.reborrow().parent_terminated - } - /// The parent rewound past the dispatch: the inherited prefix no longer holds. - /// - /// Field 6: `history_invalidated` - #[must_use] - pub fn history_invalidated(&self) -> bool { - self.0.reborrow().history_invalidated - } - /// Set once the lineage is detached, making the detach idempotent per id. - /// - /// Field 7: `detach_operation_id` - #[must_use] - pub fn detach_operation_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detach_operation_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ParentLinkOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ParentLinkOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ParentLinkOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ParentLinkOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ParentLink { - type View<'a> = ParentLinkView<'a>; - type ViewHandle = ParentLinkOwnedView; -} -impl ::serde::Serialize for ParentLinkOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -#[derive(Clone, Debug, Default)] -pub struct DelegationView<'a> { - /// Field 1: `operation_id` - pub operation_id: &'a str, - /// Field 2: `kind` - pub kind: ::buffa::EnumValue, - /// Set for DELEGATION_KIND_CHILD_SESSION. - /// - /// Field 3: `child_session_id` - pub child_session_id: ::core::option::Option<&'a str>, - /// Field 4: `cascade_policy` - pub cascade_policy: ::core::option::Option< - ::buffa::EnumValue, - >, - /// Set for DELEGATION_KIND_EXTERNAL. - /// - /// Field 5: `delegate_reference` - pub delegate_reference: ::core::option::Option<&'a str>, - /// Field 6: `dispatched_at` - pub dispatched_at: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - /// Set once the child is detached, making the detach idempotent per id. - /// - /// Field 7: `detach_operation_id` - pub detach_operation_id: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DelegationView<'a> { - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_kind(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `dispatched_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_dispatched_at(&self) -> bool { - self.dispatched_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for DelegationView<'a> { - type Owned = super::super::Delegation; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.child_session_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.cascade_policy = Some( - ::buffa::EnumValue::from(::buffa::types::decode_int32(&mut cur)?), - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.delegate_reference = Some(::buffa::types::borrow_str(&mut cur)?); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.dispatched_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.dispatched_at = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detach_operation_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::Delegation { - operation_id: self.operation_id.to_string(), - kind: self.kind, - child_session_id: self.child_session_id.map(|s| s.to_string()), - cascade_policy: self.cascade_policy, - delegate_reference: self.delegate_reference.map(|s| s.to_string()), - dispatched_at: match self.dispatched_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - detach_operation_id: self.detach_operation_id.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DelegationView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.child_session_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.cascade_policy { - size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; - } - if let Some(ref v) = self.delegate_reference { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.dispatched_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.dispatched_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.detach_operation_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.operation_id, buf); - ::buffa::types::put_int32_field(2u32, self.kind.to_i32(), buf); - if let Some(ref v) = self.child_session_id { - ::buffa::types::put_string_field(3u32, v, buf); - } - if let Some(ref v) = self.cascade_policy { - ::buffa::types::put_int32_field(4u32, v.to_i32(), buf); - } - if let Some(ref v) = self.delegate_reference { - ::buffa::types::put_string_field(5u32, v, buf); - } - if self.dispatched_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.dispatched_at.write_to(__cache, buf); - } - if let Some(ref v) = self.detach_operation_id { - ::buffa::types::put_string_field(7u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DelegationView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("operationId", self.operation_id)?; - } - { - __map.serialize_entry("kind", &self.kind)?; - } - if let ::core::option::Option::Some(__v) = self.child_session_id { - __map.serialize_entry("childSessionId", __v)?; - } - if let ::core::option::Option::Some(ref __v) = self.cascade_policy { - __map.serialize_entry("cascadePolicy", __v)?; - } - if let ::core::option::Option::Some(__v) = self.delegate_reference { - __map.serialize_entry("delegateReference", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.dispatched_at.as_option() { - __map.serialize_entry("dispatchedAt", __v)?; - } - } - if let ::core::option::Option::Some(__v) = self.detach_operation_id { - __map.serialize_entry("detachOperationId", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DelegationView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "Delegation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.Delegation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.Delegation"; -} -::buffa::impl_default_view_instance!(DelegationView); -::buffa::impl_view_reborrow!(DelegationView); -/** Self-contained, `'static` owned view of a `Delegation` message. - - Wraps [`::buffa::OwnedView`]`<`[`DelegationView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DelegationView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DelegationOwnedView(::buffa::OwnedView>); -impl DelegationOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DelegationOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DelegationOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::Delegation, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DelegationOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DelegationView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DelegationView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::Delegation { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Field 2: `kind` - #[must_use] - pub fn kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().kind - } - /// Set for DELEGATION_KIND_CHILD_SESSION. - /// - /// Field 3: `child_session_id` - #[must_use] - pub fn child_session_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().child_session_id - } - /// Field 4: `cascade_policy` - #[must_use] - pub fn cascade_policy( - &self, - ) -> ::core::option::Option< - ::buffa::EnumValue, - > { - self.0.reborrow().cascade_policy - } - /// Set for DELEGATION_KIND_EXTERNAL. - /// - /// Field 5: `delegate_reference` - #[must_use] - pub fn delegate_reference(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().delegate_reference - } - /// Field 6: `dispatched_at` - #[must_use] - pub fn dispatched_at( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().dispatched_at - } - /// Set once the child is detached, making the detach idempotent per id. - /// - /// Field 7: `detach_operation_id` - #[must_use] - pub fn detach_operation_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detach_operation_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DelegationOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DelegationOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DelegationOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DelegationOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::Delegation { - type View<'a> = DelegationView<'a>; - type ViewHandle = DelegationOwnedView; -} -impl ::serde::Serialize for DelegationOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -#[derive(Clone, Debug, Default)] -pub struct ExecutionAttemptView<'a> { - /// Field 1: `execution_attempt_id` - pub execution_attempt_id: &'a str, - /// Field 2: `attempt_number` - pub attempt_number: u64, - /// The attempt published its ready attestation; until then it holds the - /// session but must not be treated as serving. - /// - /// Field 3: `ready` - pub ready: bool, - /// Checkpoint the attempt restored from, empty when it started from scratch. - /// - /// Field 4: `restored_checkpoint_id` - pub restored_checkpoint_id: ::core::option::Option<&'a str>, - /// Ordinal of the ExecutionAttemptStarted event itself: the head the attempt - /// selected, and the point its tail replay resumes from. - /// - /// Field 5: `started_at` - pub started_at: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ExecutionAttemptView<'a> { - /**Whether required field `execution_attempt_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_execution_attempt_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `attempt_number` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_attempt_number(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `ready` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ready(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `started_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_started_at(&self) -> bool { - self.started_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ExecutionAttemptView<'a> { - type Owned = super::super::ExecutionAttempt; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.execution_attempt_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.attempt_number = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.ready = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.restored_checkpoint_id = Some( - ::buffa::types::borrow_str(&mut cur)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.started_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.started_at = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ExecutionAttempt { - execution_attempt_id: self.execution_attempt_id.to_string(), - attempt_number: self.attempt_number, - ready: self.ready, - restored_checkpoint_id: self.restored_checkpoint_id.map(|s| s.to_string()), - started_at: match self.started_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ExecutionAttemptView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.attempt_number) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - if let Some(ref v) = self.restored_checkpoint_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.started_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.started_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.execution_attempt_id, buf); - ::buffa::types::put_uint64_field(2u32, self.attempt_number, buf); - ::buffa::types::put_bool_field(3u32, self.ready, buf); - if let Some(ref v) = self.restored_checkpoint_id { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.started_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.started_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ExecutionAttemptView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("executionAttemptId", self.execution_attempt_id)?; - } - { - __map - .serialize_entry( - "attemptNumber", - &::buffa::json_helpers::ProtoJson(&self.attempt_number), - )?; - } - { - __map.serialize_entry("ready", &self.ready)?; - } - if let ::core::option::Option::Some(__v) = self.restored_checkpoint_id { - __map.serialize_entry("restoredCheckpointId", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.started_at.as_option() { - __map.serialize_entry("startedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ExecutionAttemptView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "ExecutionAttempt"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.ExecutionAttempt"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ExecutionAttempt"; -} -::buffa::impl_default_view_instance!(ExecutionAttemptView); -::buffa::impl_view_reborrow!(ExecutionAttemptView); -/** Self-contained, `'static` owned view of a `ExecutionAttempt` message. - - Wraps [`::buffa::OwnedView`]`<`[`ExecutionAttemptView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ExecutionAttemptView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ExecutionAttemptOwnedView(::buffa::OwnedView>); -impl ExecutionAttemptOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExecutionAttemptOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExecutionAttemptOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ExecutionAttempt, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExecutionAttemptOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ExecutionAttemptView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ExecutionAttemptView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ExecutionAttempt { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `execution_attempt_id` - #[must_use] - pub fn execution_attempt_id(&self) -> &'_ str { - self.0.reborrow().execution_attempt_id - } - /// Field 2: `attempt_number` - #[must_use] - pub fn attempt_number(&self) -> u64 { - self.0.reborrow().attempt_number - } - /// The attempt published its ready attestation; until then it holds the - /// session but must not be treated as serving. - /// - /// Field 3: `ready` - #[must_use] - pub fn ready(&self) -> bool { - self.0.reborrow().ready - } - /// Checkpoint the attempt restored from, empty when it started from scratch. - /// - /// Field 4: `restored_checkpoint_id` - #[must_use] - pub fn restored_checkpoint_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().restored_checkpoint_id - } - /// Ordinal of the ExecutionAttemptStarted event itself: the head the attempt - /// selected, and the point its tail replay resumes from. - /// - /// Field 5: `started_at` - #[must_use] - pub fn started_at( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().started_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ExecutionAttemptOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ExecutionAttemptOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ExecutionAttemptOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ExecutionAttemptOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ExecutionAttempt { - type View<'a> = ExecutionAttemptView<'a>; - type ViewHandle = ExecutionAttemptOwnedView; -} -impl ::serde::Serialize for ExecutionAttemptOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -#[derive(Clone, Debug, Default)] -pub struct CompactionMarkerView<'a> { - /// Field 1: `summary_id` - pub summary_id: &'a str, - /// Ordinal of the Compacted event itself. - /// - /// Field 2: `marker_ordinal` - pub marker_ordinal: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 3: `covers_from` - pub covers_from: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 4: `covers_through` - pub covers_through: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 5: `covered_input_digest` - pub covered_input_digest: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::DigestView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CompactionMarkerView<'a> { - /**Whether required field `summary_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_summary_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `marker_ordinal` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_marker_ordinal(&self) -> bool { - self.marker_ordinal.is_set() - } - /**Whether required field `covers_from` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_covers_from(&self) -> bool { - self.covers_from.is_set() - } - /**Whether required field `covers_through` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_covers_through(&self) -> bool { - self.covers_through.is_set() - } - /**Whether required field `covered_input_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_covered_input_digest(&self) -> bool { - self.covered_input_digest.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for CompactionMarkerView<'a> { - type Owned = super::super::CompactionMarker; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.summary_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.marker_ordinal.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.marker_ordinal = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.covers_from.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.covers_from = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.covers_through.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.covers_through = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.covered_input_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.covered_input_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CompactionMarker { - summary_id: self.summary_id.to_string(), - marker_ordinal: match self.marker_ordinal.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - covers_from: match self.covers_from.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - covers_through: match self.covers_through.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - covered_input_digest: match self.covered_input_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CompactionMarkerView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary_id) as u64; - if self.marker_ordinal.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.marker_ordinal.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covers_from.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_from.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covers_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covered_input_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covered_input_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.summary_id, buf); - if self.marker_ordinal.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.marker_ordinal.write_to(__cache, buf); - } - if self.covers_from.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_from.write_to(__cache, buf); - } - if self.covers_through.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_through.write_to(__cache, buf); - } - if self.covered_input_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covered_input_digest.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CompactionMarkerView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("summaryId", self.summary_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.marker_ordinal.as_option() { - __map.serialize_entry("markerOrdinal", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.covers_from.as_option() { - __map.serialize_entry("coversFrom", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.covers_through.as_option() { - __map.serialize_entry("coversThrough", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self - .covered_input_digest - .as_option() - { - __map.serialize_entry("coveredInputDigest", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CompactionMarkerView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "CompactionMarker"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.CompactionMarker"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.CompactionMarker"; -} -::buffa::impl_default_view_instance!(CompactionMarkerView); -::buffa::impl_view_reborrow!(CompactionMarkerView); -/** Self-contained, `'static` owned view of a `CompactionMarker` message. - - Wraps [`::buffa::OwnedView`]`<`[`CompactionMarkerView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CompactionMarkerView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CompactionMarkerOwnedView(::buffa::OwnedView>); -impl CompactionMarkerOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionMarkerOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionMarkerOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CompactionMarker, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionMarkerOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CompactionMarkerView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CompactionMarkerView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CompactionMarker { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `summary_id` - #[must_use] - pub fn summary_id(&self) -> &'_ str { - self.0.reborrow().summary_id - } - /// Ordinal of the Compacted event itself. - /// - /// Field 2: `marker_ordinal` - #[must_use] - pub fn marker_ordinal( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().marker_ordinal - } - /// Field 3: `covers_from` - #[must_use] - pub fn covers_from( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().covers_from - } - /// Field 4: `covers_through` - #[must_use] - pub fn covers_through( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().covers_through - } - /// Field 5: `covered_input_digest` - #[must_use] - pub fn covered_input_digest( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::DigestView<'_>, - > { - &self.0.reborrow().covered_input_digest - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CompactionMarkerOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CompactionMarkerOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CompactionMarkerOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CompactionMarkerOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CompactionMarker { - type View<'a> = CompactionMarkerView<'a>; - type ViewHandle = CompactionMarkerOwnedView; -} -impl ::serde::Serialize for CompactionMarkerOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -#[derive(Clone, Debug, Default)] -pub struct ToolCallView<'a> { - /// Field 1: `tool_call_id` - pub tool_call_id: &'a str, - /// Retry identity of the call, and the key its terminal outcome joins on. - /// - /// Field 2: `tool_execution_id` - pub tool_execution_id: &'a str, - /// Field 3: `tool_name` - pub tool_name: &'a str, - /// Field 4: `turn_id` - pub turn_id: &'a str, - /// The operation ledger entry guarding this call's side effect, when it - /// reserves one. - /// - /// Field 5: `operation_id` - pub operation_id: ::core::option::Option<&'a str>, - /// Field 6: `status` - pub status: ::buffa::EnumValue, - /// Field 7: `requested_at` - pub requested_at: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - /// Set when the call started executing. A call with started_at set and - /// settled_at unset is exactly an interrupted call awaiting reconciliation. - /// - /// Field 8: `started_at` - pub started_at: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - /// Set by the first terminal outcome; a later conflicting one is audit-only. - /// - /// Field 9: `settled_at` - pub settled_at: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ToolCallView<'a> { - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_execution_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_execution_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_name` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_name(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `status` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_status(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } - /**Whether required field `requested_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_requested_at(&self) -> bool { - self.requested_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ToolCallView<'a> { - type Owned = super::super::ToolCall; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_execution_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_name = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.status = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 16u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.requested_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.requested_at = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.started_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.started_at = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.settled_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.settled_at = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ToolCall { - tool_call_id: self.tool_call_id.to_string(), - tool_execution_id: self.tool_execution_id.to_string(), - tool_name: self.tool_name.to_string(), - turn_id: self.turn_id.to_string(), - operation_id: self.operation_id.map(|s| s.to_string()), - status: self.status, - requested_at: match self.requested_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - started_at: match self.started_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - settled_at: match self.settled_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ToolCallView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_name) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if let Some(ref v) = self.operation_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - { - let val = self.status.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.requested_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.requested_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.started_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.started_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.settled_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.settled_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_name, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - if let Some(ref v) = self.operation_id { - ::buffa::types::put_string_field(5u32, v, buf); - } - ::buffa::types::put_int32_field(6u32, self.status.to_i32(), buf); - if self.requested_at.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.requested_at.write_to(__cache, buf); - } - if self.started_at.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.started_at.write_to(__cache, buf); - } - if self.settled_at.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.settled_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ToolCallView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolExecutionId", self.tool_execution_id)?; - } - { - __map.serialize_entry("toolName", self.tool_name)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - if let ::core::option::Option::Some(__v) = self.operation_id { - __map.serialize_entry("operationId", __v)?; - } - { - __map.serialize_entry("status", &self.status)?; - } - { - if let ::core::option::Option::Some(__v) = self.requested_at.as_option() { - __map.serialize_entry("requestedAt", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.started_at.as_option() { - __map.serialize_entry("startedAt", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.settled_at.as_option() { - __map.serialize_entry("settledAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ToolCallView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "ToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.ToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ToolCall"; -} -::buffa::impl_default_view_instance!(ToolCallView); -::buffa::impl_view_reborrow!(ToolCallView); -/** Self-contained, `'static` owned view of a `ToolCall` message. - - Wraps [`::buffa::OwnedView`]`<`[`ToolCallView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ToolCallView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ToolCallOwnedView(::buffa::OwnedView>); -impl ToolCallOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok(ToolCallOwnedView(::buffa::OwnedView::decode(bytes)?)) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ToolCall, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ToolCallView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ToolCallView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ToolCall { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Retry identity of the call, and the key its terminal outcome joins on. - /// - /// Field 2: `tool_execution_id` - #[must_use] - pub fn tool_execution_id(&self) -> &'_ str { - self.0.reborrow().tool_execution_id - } - /// Field 3: `tool_name` - #[must_use] - pub fn tool_name(&self) -> &'_ str { - self.0.reborrow().tool_name - } - /// Field 4: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } - /// The operation ledger entry guarding this call's side effect, when it - /// reserves one. - /// - /// Field 5: `operation_id` - #[must_use] - pub fn operation_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().operation_id - } - /// Field 6: `status` - #[must_use] - pub fn status(&self) -> ::buffa::EnumValue { - self.0.reborrow().status - } - /// Field 7: `requested_at` - #[must_use] - pub fn requested_at( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().requested_at - } - /// Set when the call started executing. A call with started_at set and - /// settled_at unset is exactly an interrupted call awaiting reconciliation. - /// - /// Field 8: `started_at` - #[must_use] - pub fn started_at( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().started_at - } - /// Set by the first terminal outcome; a later conflicting one is audit-only. - /// - /// Field 9: `settled_at` - #[must_use] - pub fn settled_at( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().settled_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ToolCallOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ToolCallOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ToolCallOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ToolCallOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ToolCall { - type View<'a> = ToolCallView<'a>; - type ViewHandle = ToolCallOwnedView; -} -impl ::serde::Serialize for ToolCallOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -#[derive(Clone, Debug, Default)] -pub struct OperationView<'a> { - /// Field 1: `operation_id` - pub operation_id: &'a str, - /// Field 2: `operation_kind` - pub operation_kind: ::buffa::EnumValue< - super::super::super::super::v1alpha1::OperationKind, - >, - /// Digest of the reserved request, so a retry carrying different bytes under - /// the same id is refused instead of executed twice. - /// - /// Field 3: `request_digest` - pub request_digest: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::DigestView<'a>, - >, - /// Field 4: `status` - pub status: ::buffa::EnumValue, - /// Cancellation was asked for; it does not settle the operation, which still - /// needs a recorded outcome. - /// - /// Field 5: `cancellation_requested` - pub cancellation_requested: bool, - /// Field 6: `reserved_at` - pub reserved_at: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - /// Set by the determinate outcome that settled the operation. - /// - /// Field 7: `settled_at` - pub settled_at: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> OperationView<'a> { - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `operation_kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_kind(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `request_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_request_digest(&self) -> bool { - self.request_digest.is_set() - } - /**Whether required field `status` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_status(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `cancellation_requested` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_cancellation_requested(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `reserved_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reserved_at(&self) -> bool { - self.reserved_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for OperationView<'a> { - type Owned = super::super::Operation; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.operation_kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.request_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.request_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.status = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.cancellation_requested = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.reserved_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.reserved_at = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.settled_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.settled_at = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::Operation { - operation_id: self.operation_id.to_string(), - operation_kind: self.operation_kind, - request_digest: match self.request_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - status: self.status, - cancellation_requested: self.cancellation_requested, - reserved_at: match self.reserved_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - settled_at: match self.settled_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for OperationView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - { - let val = self.operation_kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.request_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.request_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.status.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - if self.reserved_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.reserved_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.settled_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.settled_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.operation_id, buf); - ::buffa::types::put_int32_field(2u32, self.operation_kind.to_i32(), buf); - if self.request_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.request_digest.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(4u32, self.status.to_i32(), buf); - ::buffa::types::put_bool_field(5u32, self.cancellation_requested, buf); - if self.reserved_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.reserved_at.write_to(__cache, buf); - } - if self.settled_at.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.settled_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for OperationView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("operationId", self.operation_id)?; - } - { - __map.serialize_entry("operationKind", &self.operation_kind)?; - } - { - if let ::core::option::Option::Some(__v) = self.request_digest.as_option() { - __map.serialize_entry("requestDigest", __v)?; - } - } - { - __map.serialize_entry("status", &self.status)?; - } - { - __map - .serialize_entry("cancellationRequested", &self.cancellation_requested)?; - } - { - if let ::core::option::Option::Some(__v) = self.reserved_at.as_option() { - __map.serialize_entry("reservedAt", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.settled_at.as_option() { - __map.serialize_entry("settledAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for OperationView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "Operation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.Operation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.Operation"; -} -::buffa::impl_default_view_instance!(OperationView); -::buffa::impl_view_reborrow!(OperationView); -/** Self-contained, `'static` owned view of a `Operation` message. - - Wraps [`::buffa::OwnedView`]`<`[`OperationView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`OperationView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct OperationOwnedView(::buffa::OwnedView>); -impl OperationOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::Operation, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`OperationView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &OperationView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::Operation { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Field 2: `operation_kind` - #[must_use] - pub fn operation_kind( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().operation_kind - } - /// Digest of the reserved request, so a retry carrying different bytes under - /// the same id is refused instead of executed twice. - /// - /// Field 3: `request_digest` - #[must_use] - pub fn request_digest( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::DigestView<'_>, - > { - &self.0.reborrow().request_digest - } - /// Field 4: `status` - #[must_use] - pub fn status(&self) -> ::buffa::EnumValue { - self.0.reborrow().status - } - /// Cancellation was asked for; it does not settle the operation, which still - /// needs a recorded outcome. - /// - /// Field 5: `cancellation_requested` - #[must_use] - pub fn cancellation_requested(&self) -> bool { - self.0.reborrow().cancellation_requested - } - /// Field 6: `reserved_at` - #[must_use] - pub fn reserved_at( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().reserved_at - } - /// Set by the determinate outcome that settled the operation. - /// - /// Field 7: `settled_at` - #[must_use] - pub fn settled_at( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().settled_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for OperationOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - OperationOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: OperationOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for OperationOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::Operation { - type View<'a> = OperationView<'a>; - type ViewHandle = OperationOwnedView; -} -impl ::serde::Serialize for OperationOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -#[derive(Clone, Debug, Default)] -pub struct CheckpointEvidenceView<'a> { - /// Field 1: `checkpoint_id` - pub checkpoint_id: &'a str, - /// Field 2: `checkpoint` - pub checkpoint: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::CheckpointView<'a>, - >, - /// Ordinal of the CheckpointProduced event that admitted this evidence. - /// - /// Field 3: `produced_at` - pub produced_at: ::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CheckpointEvidenceView<'a> { - /**Whether required field `checkpoint_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_checkpoint_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `checkpoint` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_checkpoint(&self) -> bool { - self.checkpoint.is_set() - } - /**Whether required field `produced_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_produced_at(&self) -> bool { - self.produced_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for CheckpointEvidenceView<'a> { - type Owned = super::super::CheckpointEvidence; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.checkpoint_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.checkpoint.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.checkpoint = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.produced_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.produced_at = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CheckpointEvidence { - checkpoint_id: self.checkpoint_id.to_string(), - checkpoint: match self.checkpoint.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::Checkpoint, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - produced_at: match self.produced_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline< - super::super::super::super::v1alpha1::SessionOrdinal, - >, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CheckpointEvidenceView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.checkpoint_id) as u64; - if self.checkpoint.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.checkpoint.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.produced_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.produced_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.checkpoint_id, buf); - if self.checkpoint.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.checkpoint.write_to(__cache, buf); - } - if self.produced_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.produced_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CheckpointEvidenceView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("checkpointId", self.checkpoint_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.checkpoint.as_option() { - __map.serialize_entry("checkpoint", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.produced_at.as_option() { - __map.serialize_entry("producedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CheckpointEvidenceView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "CheckpointEvidence"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.CheckpointEvidence"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.CheckpointEvidence"; -} -::buffa::impl_default_view_instance!(CheckpointEvidenceView); -::buffa::impl_view_reborrow!(CheckpointEvidenceView); -/** Self-contained, `'static` owned view of a `CheckpointEvidence` message. - - Wraps [`::buffa::OwnedView`]`<`[`CheckpointEvidenceView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CheckpointEvidenceView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CheckpointEvidenceOwnedView( - ::buffa::OwnedView>, -); -impl CheckpointEvidenceOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckpointEvidenceOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckpointEvidenceOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CheckpointEvidence, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckpointEvidenceOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CheckpointEvidenceView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CheckpointEvidenceView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CheckpointEvidence { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `checkpoint_id` - #[must_use] - pub fn checkpoint_id(&self) -> &'_ str { - self.0.reborrow().checkpoint_id - } - /// Field 2: `checkpoint` - #[must_use] - pub fn checkpoint( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::CheckpointView<'_>, - > { - &self.0.reborrow().checkpoint - } - /// Ordinal of the CheckpointProduced event that admitted this evidence. - /// - /// Field 3: `produced_at` - #[must_use] - pub fn produced_at( - &self, - ) -> &::buffa::MessageFieldView< - super::super::super::super::v1alpha1::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().produced_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CheckpointEvidenceOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CheckpointEvidenceOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CheckpointEvidenceOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CheckpointEvidenceOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CheckpointEvidence { - type View<'a> = CheckpointEvidenceView<'a>; - type ViewHandle = CheckpointEvidenceOwnedView; -} -impl ::serde::Serialize for CheckpointEvidenceOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.state.v1alpha1.state.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.state.v1alpha1.state.rs deleted file mode 100644 index 00efc1c63..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.state.v1alpha1.state.rs +++ /dev/null @@ -1,3878 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/state/v1alpha1/state.proto - -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum StateValue { - STATE_VALUE_UNSPECIFIED = 0i32, - /// No SessionStarted folded: the stream does not exist yet. - STATE_VALUE_MISSING = 1i32, - STATE_VALUE_ACTIVE = 2i32, - /// Sealed by a terminal marker: no further invariant-bearing transition is - /// admitted, though guarded ledger and lineage facts still fold so an - /// in-flight side effect stays reconcilable. - STATE_VALUE_TERMINAL = 3i32, -} -impl StateValue { - ///Idiomatic alias for [`Self::STATE_VALUE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::STATE_VALUE_UNSPECIFIED; - ///Idiomatic alias for [`Self::STATE_VALUE_MISSING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Missing: Self = Self::STATE_VALUE_MISSING; - ///Idiomatic alias for [`Self::STATE_VALUE_ACTIVE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Active: Self = Self::STATE_VALUE_ACTIVE; - ///Idiomatic alias for [`Self::STATE_VALUE_TERMINAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Terminal: Self = Self::STATE_VALUE_TERMINAL; -} -impl ::core::default::Default for StateValue { - fn default() -> Self { - Self::STATE_VALUE_UNSPECIFIED - } -} -impl ::serde::Serialize for StateValue { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for StateValue { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = StateValue; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(StateValue)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for StateValue { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for StateValue { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::STATE_VALUE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::STATE_VALUE_MISSING), - 2i32 => ::core::option::Option::Some(Self::STATE_VALUE_ACTIVE), - 3i32 => ::core::option::Option::Some(Self::STATE_VALUE_TERMINAL), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::STATE_VALUE_UNSPECIFIED => "STATE_VALUE_UNSPECIFIED", - Self::STATE_VALUE_MISSING => "STATE_VALUE_MISSING", - Self::STATE_VALUE_ACTIVE => "STATE_VALUE_ACTIVE", - Self::STATE_VALUE_TERMINAL => "STATE_VALUE_TERMINAL", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "STATE_VALUE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::STATE_VALUE_UNSPECIFIED) - } - "STATE_VALUE_MISSING" => { - ::core::option::Option::Some(Self::STATE_VALUE_MISSING) - } - "STATE_VALUE_ACTIVE" => { - ::core::option::Option::Some(Self::STATE_VALUE_ACTIVE) - } - "STATE_VALUE_TERMINAL" => { - ::core::option::Option::Some(Self::STATE_VALUE_TERMINAL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::STATE_VALUE_UNSPECIFIED, - Self::STATE_VALUE_MISSING, - Self::STATE_VALUE_ACTIVE, - Self::STATE_VALUE_TERMINAL, - ] - } -} -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum TerminalMarker { - TERMINAL_MARKER_UNSPECIFIED = 0i32, - TERMINAL_MARKER_CLOSED = 1i32, - TERMINAL_MARKER_CANCELLED = 2i32, - TERMINAL_MARKER_FAILED = 3i32, - TERMINAL_MARKER_HIDDEN = 4i32, -} -impl TerminalMarker { - ///Idiomatic alias for [`Self::TERMINAL_MARKER_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::TERMINAL_MARKER_UNSPECIFIED; - ///Idiomatic alias for [`Self::TERMINAL_MARKER_CLOSED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Closed: Self = Self::TERMINAL_MARKER_CLOSED; - ///Idiomatic alias for [`Self::TERMINAL_MARKER_CANCELLED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Cancelled: Self = Self::TERMINAL_MARKER_CANCELLED; - ///Idiomatic alias for [`Self::TERMINAL_MARKER_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Failed: Self = Self::TERMINAL_MARKER_FAILED; - ///Idiomatic alias for [`Self::TERMINAL_MARKER_HIDDEN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Hidden: Self = Self::TERMINAL_MARKER_HIDDEN; -} -impl ::core::default::Default for TerminalMarker { - fn default() -> Self { - Self::TERMINAL_MARKER_UNSPECIFIED - } -} -impl ::serde::Serialize for TerminalMarker { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for TerminalMarker { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = TerminalMarker; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(TerminalMarker) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for TerminalMarker { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for TerminalMarker { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::TERMINAL_MARKER_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::TERMINAL_MARKER_CLOSED), - 2i32 => ::core::option::Option::Some(Self::TERMINAL_MARKER_CANCELLED), - 3i32 => ::core::option::Option::Some(Self::TERMINAL_MARKER_FAILED), - 4i32 => ::core::option::Option::Some(Self::TERMINAL_MARKER_HIDDEN), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::TERMINAL_MARKER_UNSPECIFIED => "TERMINAL_MARKER_UNSPECIFIED", - Self::TERMINAL_MARKER_CLOSED => "TERMINAL_MARKER_CLOSED", - Self::TERMINAL_MARKER_CANCELLED => "TERMINAL_MARKER_CANCELLED", - Self::TERMINAL_MARKER_FAILED => "TERMINAL_MARKER_FAILED", - Self::TERMINAL_MARKER_HIDDEN => "TERMINAL_MARKER_HIDDEN", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "TERMINAL_MARKER_UNSPECIFIED" => { - ::core::option::Option::Some(Self::TERMINAL_MARKER_UNSPECIFIED) - } - "TERMINAL_MARKER_CLOSED" => { - ::core::option::Option::Some(Self::TERMINAL_MARKER_CLOSED) - } - "TERMINAL_MARKER_CANCELLED" => { - ::core::option::Option::Some(Self::TERMINAL_MARKER_CANCELLED) - } - "TERMINAL_MARKER_FAILED" => { - ::core::option::Option::Some(Self::TERMINAL_MARKER_FAILED) - } - "TERMINAL_MARKER_HIDDEN" => { - ::core::option::Option::Some(Self::TERMINAL_MARKER_HIDDEN) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::TERMINAL_MARKER_UNSPECIFIED, - Self::TERMINAL_MARKER_CLOSED, - Self::TERMINAL_MARKER_CANCELLED, - Self::TERMINAL_MARKER_FAILED, - Self::TERMINAL_MARKER_HIDDEN, - ] - } -} -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum DelegationKind { - DELEGATION_KIND_UNSPECIFIED = 0i32, - DELEGATION_KIND_CHILD_SESSION = 1i32, - DELEGATION_KIND_EXTERNAL = 2i32, -} -impl DelegationKind { - ///Idiomatic alias for [`Self::DELEGATION_KIND_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::DELEGATION_KIND_UNSPECIFIED; - ///Idiomatic alias for [`Self::DELEGATION_KIND_CHILD_SESSION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ChildSession: Self = Self::DELEGATION_KIND_CHILD_SESSION; - ///Idiomatic alias for [`Self::DELEGATION_KIND_EXTERNAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const External: Self = Self::DELEGATION_KIND_EXTERNAL; -} -impl ::core::default::Default for DelegationKind { - fn default() -> Self { - Self::DELEGATION_KIND_UNSPECIFIED - } -} -impl ::serde::Serialize for DelegationKind { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for DelegationKind { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = DelegationKind; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(DelegationKind) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for DelegationKind { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for DelegationKind { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::DELEGATION_KIND_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::DELEGATION_KIND_CHILD_SESSION), - 2i32 => ::core::option::Option::Some(Self::DELEGATION_KIND_EXTERNAL), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::DELEGATION_KIND_UNSPECIFIED => "DELEGATION_KIND_UNSPECIFIED", - Self::DELEGATION_KIND_CHILD_SESSION => "DELEGATION_KIND_CHILD_SESSION", - Self::DELEGATION_KIND_EXTERNAL => "DELEGATION_KIND_EXTERNAL", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "DELEGATION_KIND_UNSPECIFIED" => { - ::core::option::Option::Some(Self::DELEGATION_KIND_UNSPECIFIED) - } - "DELEGATION_KIND_CHILD_SESSION" => { - ::core::option::Option::Some(Self::DELEGATION_KIND_CHILD_SESSION) - } - "DELEGATION_KIND_EXTERNAL" => { - ::core::option::Option::Some(Self::DELEGATION_KIND_EXTERNAL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::DELEGATION_KIND_UNSPECIFIED, - Self::DELEGATION_KIND_CHILD_SESSION, - Self::DELEGATION_KIND_EXTERNAL, - ] - } -} -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ToolCallStatus { - TOOL_CALL_STATUS_UNSPECIFIED = 0i32, - TOOL_CALL_STATUS_REQUESTED = 1i32, - TOOL_CALL_STATUS_APPROVED = 2i32, - /// Terminal: the call was refused and never ran. - TOOL_CALL_STATUS_DENIED = 3i32, - TOOL_CALL_STATUS_STARTED = 4i32, - TOOL_CALL_STATUS_COMPLETED = 5i32, - TOOL_CALL_STATUS_FAILED = 6i32, -} -impl ToolCallStatus { - ///Idiomatic alias for [`Self::TOOL_CALL_STATUS_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::TOOL_CALL_STATUS_UNSPECIFIED; - ///Idiomatic alias for [`Self::TOOL_CALL_STATUS_REQUESTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Requested: Self = Self::TOOL_CALL_STATUS_REQUESTED; - ///Idiomatic alias for [`Self::TOOL_CALL_STATUS_APPROVED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Approved: Self = Self::TOOL_CALL_STATUS_APPROVED; - ///Idiomatic alias for [`Self::TOOL_CALL_STATUS_DENIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Denied: Self = Self::TOOL_CALL_STATUS_DENIED; - ///Idiomatic alias for [`Self::TOOL_CALL_STATUS_STARTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Started: Self = Self::TOOL_CALL_STATUS_STARTED; - ///Idiomatic alias for [`Self::TOOL_CALL_STATUS_COMPLETED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Completed: Self = Self::TOOL_CALL_STATUS_COMPLETED; - ///Idiomatic alias for [`Self::TOOL_CALL_STATUS_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Failed: Self = Self::TOOL_CALL_STATUS_FAILED; -} -impl ::core::default::Default for ToolCallStatus { - fn default() -> Self { - Self::TOOL_CALL_STATUS_UNSPECIFIED - } -} -impl ::serde::Serialize for ToolCallStatus { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ToolCallStatus { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ToolCallStatus; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(ToolCallStatus) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolCallStatus { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ToolCallStatus { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::TOOL_CALL_STATUS_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::TOOL_CALL_STATUS_REQUESTED), - 2i32 => ::core::option::Option::Some(Self::TOOL_CALL_STATUS_APPROVED), - 3i32 => ::core::option::Option::Some(Self::TOOL_CALL_STATUS_DENIED), - 4i32 => ::core::option::Option::Some(Self::TOOL_CALL_STATUS_STARTED), - 5i32 => ::core::option::Option::Some(Self::TOOL_CALL_STATUS_COMPLETED), - 6i32 => ::core::option::Option::Some(Self::TOOL_CALL_STATUS_FAILED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::TOOL_CALL_STATUS_UNSPECIFIED => "TOOL_CALL_STATUS_UNSPECIFIED", - Self::TOOL_CALL_STATUS_REQUESTED => "TOOL_CALL_STATUS_REQUESTED", - Self::TOOL_CALL_STATUS_APPROVED => "TOOL_CALL_STATUS_APPROVED", - Self::TOOL_CALL_STATUS_DENIED => "TOOL_CALL_STATUS_DENIED", - Self::TOOL_CALL_STATUS_STARTED => "TOOL_CALL_STATUS_STARTED", - Self::TOOL_CALL_STATUS_COMPLETED => "TOOL_CALL_STATUS_COMPLETED", - Self::TOOL_CALL_STATUS_FAILED => "TOOL_CALL_STATUS_FAILED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "TOOL_CALL_STATUS_UNSPECIFIED" => { - ::core::option::Option::Some(Self::TOOL_CALL_STATUS_UNSPECIFIED) - } - "TOOL_CALL_STATUS_REQUESTED" => { - ::core::option::Option::Some(Self::TOOL_CALL_STATUS_REQUESTED) - } - "TOOL_CALL_STATUS_APPROVED" => { - ::core::option::Option::Some(Self::TOOL_CALL_STATUS_APPROVED) - } - "TOOL_CALL_STATUS_DENIED" => { - ::core::option::Option::Some(Self::TOOL_CALL_STATUS_DENIED) - } - "TOOL_CALL_STATUS_STARTED" => { - ::core::option::Option::Some(Self::TOOL_CALL_STATUS_STARTED) - } - "TOOL_CALL_STATUS_COMPLETED" => { - ::core::option::Option::Some(Self::TOOL_CALL_STATUS_COMPLETED) - } - "TOOL_CALL_STATUS_FAILED" => { - ::core::option::Option::Some(Self::TOOL_CALL_STATUS_FAILED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::TOOL_CALL_STATUS_UNSPECIFIED, - Self::TOOL_CALL_STATUS_REQUESTED, - Self::TOOL_CALL_STATUS_APPROVED, - Self::TOOL_CALL_STATUS_DENIED, - Self::TOOL_CALL_STATUS_STARTED, - Self::TOOL_CALL_STATUS_COMPLETED, - Self::TOOL_CALL_STATUS_FAILED, - ] - } -} -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum OperationStatus { - OPERATION_STATUS_UNSPECIFIED = 0i32, - /// Reserved, no outcome recorded: the side effect may or may not have run. - OPERATION_STATUS_RESERVED = 1i32, - /// Recorded as indeterminate. Non-terminal, and supersedable exactly once by - /// a determinate outcome. - OPERATION_STATUS_UNKNOWN = 2i32, - OPERATION_STATUS_SUCCEEDED = 3i32, - OPERATION_STATUS_FAILED = 4i32, - OPERATION_STATUS_CANCELLED = 5i32, -} -impl OperationStatus { - ///Idiomatic alias for [`Self::OPERATION_STATUS_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::OPERATION_STATUS_UNSPECIFIED; - ///Idiomatic alias for [`Self::OPERATION_STATUS_RESERVED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Reserved: Self = Self::OPERATION_STATUS_RESERVED; - ///Idiomatic alias for [`Self::OPERATION_STATUS_UNKNOWN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unknown: Self = Self::OPERATION_STATUS_UNKNOWN; - ///Idiomatic alias for [`Self::OPERATION_STATUS_SUCCEEDED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Succeeded: Self = Self::OPERATION_STATUS_SUCCEEDED; - ///Idiomatic alias for [`Self::OPERATION_STATUS_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Failed: Self = Self::OPERATION_STATUS_FAILED; - ///Idiomatic alias for [`Self::OPERATION_STATUS_CANCELLED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Cancelled: Self = Self::OPERATION_STATUS_CANCELLED; -} -impl ::core::default::Default for OperationStatus { - fn default() -> Self { - Self::OPERATION_STATUS_UNSPECIFIED - } -} -impl ::serde::Serialize for OperationStatus { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for OperationStatus { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = OperationStatus; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(OperationStatus) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for OperationStatus { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for OperationStatus { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::OPERATION_STATUS_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::OPERATION_STATUS_RESERVED), - 2i32 => ::core::option::Option::Some(Self::OPERATION_STATUS_UNKNOWN), - 3i32 => ::core::option::Option::Some(Self::OPERATION_STATUS_SUCCEEDED), - 4i32 => ::core::option::Option::Some(Self::OPERATION_STATUS_FAILED), - 5i32 => ::core::option::Option::Some(Self::OPERATION_STATUS_CANCELLED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::OPERATION_STATUS_UNSPECIFIED => "OPERATION_STATUS_UNSPECIFIED", - Self::OPERATION_STATUS_RESERVED => "OPERATION_STATUS_RESERVED", - Self::OPERATION_STATUS_UNKNOWN => "OPERATION_STATUS_UNKNOWN", - Self::OPERATION_STATUS_SUCCEEDED => "OPERATION_STATUS_SUCCEEDED", - Self::OPERATION_STATUS_FAILED => "OPERATION_STATUS_FAILED", - Self::OPERATION_STATUS_CANCELLED => "OPERATION_STATUS_CANCELLED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "OPERATION_STATUS_UNSPECIFIED" => { - ::core::option::Option::Some(Self::OPERATION_STATUS_UNSPECIFIED) - } - "OPERATION_STATUS_RESERVED" => { - ::core::option::Option::Some(Self::OPERATION_STATUS_RESERVED) - } - "OPERATION_STATUS_UNKNOWN" => { - ::core::option::Option::Some(Self::OPERATION_STATUS_UNKNOWN) - } - "OPERATION_STATUS_SUCCEEDED" => { - ::core::option::Option::Some(Self::OPERATION_STATUS_SUCCEEDED) - } - "OPERATION_STATUS_FAILED" => { - ::core::option::Option::Some(Self::OPERATION_STATUS_FAILED) - } - "OPERATION_STATUS_CANCELLED" => { - ::core::option::Option::Some(Self::OPERATION_STATUS_CANCELLED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::OPERATION_STATUS_UNSPECIFIED, - Self::OPERATION_STATUS_RESERVED, - Self::OPERATION_STATUS_UNKNOWN, - Self::OPERATION_STATUS_SUCCEEDED, - Self::OPERATION_STATUS_FAILED, - Self::OPERATION_STATUS_CANCELLED, - ] - } -} -/// State is the Session aggregate's write-side fold: exactly the facts the -/// session commands read to enforce their invariants, and nothing a read model -/// owns (ADR#0035, ADR#0045). It is never a projection and never a transcript; -/// message bodies, todo items, artifacts, and display metadata are deliberately -/// absent because no command reads them. -/// -/// A crash between a started tool call and its outcome is the load-bearing case: -/// replaying a session leaves that call in TOOL_CALL_STATUS_STARTED with no -/// settled_at, and its reserved operation in OPERATION_STATUS_RESERVED, so -/// reconciliation can see the missing terminal outcome and finish or reject the -/// interrupted call rather than silently dropping it. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct State { - /// Field 1: `state` - #[serde(rename = "state", with = "::buffa::json_helpers::proto_enum")] - pub state: ::buffa::EnumValue, - /// Field 2: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Count of events folded so far: this session's own fold-derived ordinal of - /// the last applied event, never a JetStream sequence (ADR#0013). - /// - /// Field 3: `position` - #[serde(rename = "position")] - pub position: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, - /// Digest of the immutable StoredSessionExecutionPlan recorded at start; every - /// attempt, checkpoint, and compaction is bound to it. - /// - /// Field 4: `execution_plan_digest` - #[serde( - rename = "executionPlanDigest", - alias = "execution_plan_digest", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub execution_plan_digest: ::buffa::MessageField< - super::super::v1alpha1::Digest, - ::buffa::Inline, - >, - /// Which marker sealed the session. The first terminal marker wins; a later one - /// is audit-only. - /// - /// Field 5: `terminal_marker` - #[serde( - rename = "terminalMarker", - alias = "terminal_marker", - with = "::buffa::json_helpers::proto_enum" - )] - pub terminal_marker: ::buffa::EnumValue, - /// Context root when this session was forked from another one; unset for a - /// session that started its own context. - /// - /// Field 6: `fork_origin` - #[serde( - rename = "forkOrigin", - alias = "fork_origin", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub fork_origin: ::buffa::MessageField>, - /// Provenance of a salvaged session; unset for a session that was not - /// recovered from a damaged source. Folded because it is a precondition the - /// commands must be able to read: a session that is a partial copy cannot - /// honor a rewind or a compaction against source positions it never received. - /// - /// Field 19: `recovery_origin` - #[serde( - rename = "recoveryOrigin", - alias = "recovery_origin", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub recovery_origin: ::buffa::MessageField< - RecoveryOrigin, - ::buffa::Inline, - >, - /// Recorded parent lineage of a delegated child session. - /// - /// Field 7: `parent` - #[serde( - rename = "parent", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub parent: ::buffa::MessageField>, - /// Newest rewind boundary. Rewind masks effective history for readers and - /// future turns; it never un-applies folded facts, because a tool call that - /// really ran still has to be reconcilable. - /// - /// Field 8: `keep_through` - #[serde( - rename = "keepThrough", - alias = "keep_through", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub keep_through: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, - /// Newest compaction marker, the prior usable boundary a further compaction - /// and an attempt restore both resolve against. - /// - /// Field 9: `compaction` - #[serde( - rename = "compaction", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub compaction: ::buffa::MessageField< - CompactionMarker, - ::buffa::Inline, - >, - /// Attempt currently holding the session; unset when no attempt is running. - /// - /// Field 10: `active_attempt` - #[serde( - rename = "activeAttempt", - alias = "active_attempt", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub active_attempt: ::buffa::MessageField< - ExecutionAttempt, - ::buffa::Inline, - >, - /// Most recently started attempt, still active or already ended, so a new - /// attempt can be checked for monotonic numbering and exact predecessor. - /// - /// Field 11: `last_attempt_id` - #[serde( - rename = "lastAttemptId", - alias = "last_attempt_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub last_attempt_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 12: `last_attempt_number` - #[serde( - rename = "lastAttemptNumber", - alias = "last_attempt_number", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub last_attempt_number: ::core::option::Option, - /// Tool calls keyed by tool_call_id, in first-observed fold order. - /// - /// Field 13: `tool_calls` - #[serde( - rename = "toolCalls", - alias = "tool_calls", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub tool_calls: ::buffa::alloc::vec::Vec, - /// Operation ledger entries keyed by operation_id, in reservation fold order. - /// - /// Field 14: `operations` - #[serde( - rename = "operations", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub operations: ::buffa::alloc::vec::Vec, - /// Dispatched delegations keyed by operation_id, parent side. - /// - /// Field 15: `delegations` - #[serde( - rename = "delegations", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub delegations: ::buffa::alloc::vec::Vec, - /// First admitted evidence per checkpoint_id; a later event reusing an id is - /// retained on the log but never replaces the admitted evidence. - /// - /// Field 16: `checkpoints` - #[serde( - rename = "checkpoints", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub checkpoints: ::buffa::alloc::vec::Vec, - /// Privacy dependencies an attempt restore and a compaction must respect. - /// - /// Field 17: `redacted_event_ids` - #[serde( - rename = "redactedEventIds", - alias = "redacted_event_ids", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub redacted_event_ids: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, - /// Field 18: `erased_artifact_ids` - #[serde( - rename = "erasedArtifactIds", - alias = "erased_artifact_ids", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub erased_artifact_ids: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for State { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("State") - .field("state", &self.state) - .field("session_id", &self.session_id) - .field("position", &self.position) - .field("execution_plan_digest", &self.execution_plan_digest) - .field("terminal_marker", &self.terminal_marker) - .field("fork_origin", &self.fork_origin) - .field("recovery_origin", &self.recovery_origin) - .field("parent", &self.parent) - .field("keep_through", &self.keep_through) - .field("compaction", &self.compaction) - .field("active_attempt", &self.active_attempt) - .field("last_attempt_id", &self.last_attempt_id) - .field("last_attempt_number", &self.last_attempt_number) - .field("tool_calls", &self.tool_calls) - .field("operations", &self.operations) - .field("delegations", &self.delegations) - .field("checkpoints", &self.checkpoints) - .field("redacted_event_ids", &self.redacted_event_ids) - .field("erased_artifact_ids", &self.erased_artifact_ids) - .finish() - } -} -impl State { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.State"; -} -impl State { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::last_attempt_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_last_attempt_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.last_attempt_id = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::last_attempt_number`] to `Some(value)`, consuming and returning `self`. - pub fn with_last_attempt_number(mut self, value: u64) -> Self { - self.last_attempt_number = Some(value); - self - } -} -::buffa::impl_default_instance!(State); -impl ::buffa::MessageName for State { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "State"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.State"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.State"; -} -impl ::buffa::Message for State { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.state.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.position.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.position.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.execution_plan_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.execution_plan_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.terminal_marker.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.fork_origin.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.fork_origin.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.parent.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.keep_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.keep_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.compaction.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.compaction.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.active_attempt.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.active_attempt.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.last_attempt_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(v) = self.last_attempt_number { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - for v in &self.tool_calls { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.operations { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.delegations { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.checkpoints { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 2u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.redacted_event_ids { - size += 2u64 + ::buffa::types::string_encoded_len(v) as u64; - } - for v in &self.erased_artifact_ids { - size += 2u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.recovery_origin.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.recovery_origin.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 2u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.state.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.session_id, buf); - if self.position.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.position.write_to(__cache, buf); - } - if self.execution_plan_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.execution_plan_digest.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(5u32, self.terminal_marker.to_i32(), buf); - if self.fork_origin.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.fork_origin.write_to(__cache, buf); - } - if self.parent.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent.write_to(__cache, buf); - } - if self.keep_through.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.keep_through.write_to(__cache, buf); - } - if self.compaction.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.compaction.write_to(__cache, buf); - } - if self.active_attempt.is_set() { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - self.active_attempt.write_to(__cache, buf); - } - if let Some(ref v) = self.last_attempt_id { - ::buffa::types::put_string_field(11u32, v, buf); - } - if let Some(v) = self.last_attempt_number { - ::buffa::types::put_uint64_field(12u32, v, buf); - } - for v in &self.tool_calls { - ::buffa::types::put_len_delimited_header( - 13u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.operations { - ::buffa::types::put_len_delimited_header( - 14u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.delegations { - ::buffa::types::put_len_delimited_header( - 15u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.checkpoints { - ::buffa::types::put_len_delimited_header( - 16u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.redacted_event_ids { - ::buffa::types::put_string_field(17u32, v, buf); - } - for v in &self.erased_artifact_ids { - ::buffa::types::put_string_field(18u32, v, buf); - } - if self.recovery_origin.is_set() { - ::buffa::types::put_len_delimited_header( - 19u32, - u64::from(__cache.consume_next()), - buf, - ); - self.recovery_origin.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.state = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.position.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.execution_plan_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.terminal_marker = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.fork_origin.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.parent.get_or_insert_default(), - buf, - ctx, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.keep_through.get_or_insert_default(), - buf, - ctx, - )?; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.compaction.get_or_insert_default(), - buf, - ctx, - )?; - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.active_attempt.get_or_insert_default(), - buf, - ctx, - )?; - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .last_attempt_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.last_attempt_number = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.tool_calls.push(elem); - } - 14u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.operations.push(elem); - } - 15u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.delegations.push(elem); - } - 16u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.checkpoints.push(elem); - } - 17u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::decode_string(buf)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - self.redacted_event_ids.push(__elem); - } - 18u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::decode_string(buf)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - self.erased_artifact_ids.push(__elem); - } - 19u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.recovery_origin.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.state = ::buffa::EnumValue::from(0); - self.session_id.clear(); - self.position = ::buffa::MessageField::none(); - self.execution_plan_digest = ::buffa::MessageField::none(); - self.terminal_marker = ::buffa::EnumValue::from(0); - self.fork_origin = ::buffa::MessageField::none(); - self.parent = ::buffa::MessageField::none(); - self.keep_through = ::buffa::MessageField::none(); - self.compaction = ::buffa::MessageField::none(); - self.active_attempt = ::buffa::MessageField::none(); - self.last_attempt_id = ::core::option::Option::None; - self.last_attempt_number = ::core::option::Option::None; - self.tool_calls.clear(); - self.operations.clear(); - self.delegations.clear(); - self.checkpoints.clear(); - self.redacted_event_ids.clear(); - self.erased_artifact_ids.clear(); - self.recovery_origin = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for State { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __STATE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.State", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ForkOrigin { - /// Field 1: `source_session_id` - #[serde( - rename = "sourceSessionId", - alias = "source_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub source_session_id: ::buffa::alloc::string::String, - /// Field 2: `context_prefix_boundary` - #[serde(rename = "contextPrefixBoundary", alias = "context_prefix_boundary")] - pub context_prefix_boundary: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for ForkOrigin { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ForkOrigin") - .field("source_session_id", &self.source_session_id) - .field("context_prefix_boundary", &self.context_prefix_boundary) - .finish() - } -} -impl ForkOrigin { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ForkOrigin"; -} -::buffa::impl_default_instance!(ForkOrigin); -impl ::buffa::MessageName for ForkOrigin { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "ForkOrigin"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.ForkOrigin"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ForkOrigin"; -} -impl ::buffa::Message for ForkOrigin { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.context_prefix_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.context_prefix_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - if self.context_prefix_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.context_prefix_boundary.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.source_session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.context_prefix_boundary.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.source_session_id.clear(); - self.context_prefix_boundary = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ForkOrigin { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __FORK_ORIGIN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ForkOrigin", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// RecoveryOrigin is the damaged source a salvaged session was copied from. -/// -/// source_boundary is a position on the source's stream, not on this one. This -/// session's ordinals count its own events and start at 1 regardless of where the -/// source's cut ended. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RecoveryOrigin { - /// Field 1: `source_session_id` - #[serde( - rename = "sourceSessionId", - alias = "source_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub source_session_id: ::buffa::alloc::string::String, - /// Field 2: `source_boundary` - #[serde(rename = "sourceBoundary", alias = "source_boundary")] - pub source_boundary: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, - /// Field 3: `source_digest` - #[serde(rename = "sourceDigest", alias = "source_digest")] - pub source_digest: ::buffa::MessageField< - super::super::v1alpha1::Digest, - ::buffa::Inline, - >, - /// Field 4: `salvage_key` - #[serde( - rename = "salvageKey", - alias = "salvage_key", - with = "::buffa::json_helpers::proto_string" - )] - pub salvage_key: ::buffa::alloc::string::String, - /// Field 5: `completeness` - #[serde(rename = "completeness", with = "::buffa::json_helpers::proto_enum")] - pub completeness: ::buffa::EnumValue, - /// Field 6: `omitted_count` - #[serde( - rename = "omittedCount", - alias = "omitted_count", - with = "::buffa::json_helpers::uint32" - )] - pub omitted_count: u32, -} -impl ::core::fmt::Debug for RecoveryOrigin { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RecoveryOrigin") - .field("source_session_id", &self.source_session_id) - .field("source_boundary", &self.source_boundary) - .field("source_digest", &self.source_digest) - .field("salvage_key", &self.salvage_key) - .field("completeness", &self.completeness) - .field("omitted_count", &self.omitted_count) - .finish() - } -} -impl RecoveryOrigin { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.RecoveryOrigin"; -} -::buffa::impl_default_instance!(RecoveryOrigin); -impl ::buffa::MessageName for RecoveryOrigin { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "RecoveryOrigin"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.RecoveryOrigin"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.RecoveryOrigin"; -} -impl ::buffa::Message for RecoveryOrigin { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.source_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.source_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.salvage_key) as u64; - { - let val = self.completeness.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.omitted_count) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - if self.source_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_boundary.write_to(__cache, buf); - } - if self.source_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.salvage_key, buf); - ::buffa::types::put_int32_field(5u32, self.completeness.to_i32(), buf); - ::buffa::types::put_uint32_field(6u32, self.omitted_count, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.source_session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.source_boundary.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.source_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.salvage_key, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.completeness = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.omitted_count = ::buffa::types::decode_uint32(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.source_session_id.clear(); - self.source_boundary = ::buffa::MessageField::none(); - self.source_digest = ::buffa::MessageField::none(); - self.salvage_key.clear(); - self.completeness = ::buffa::EnumValue::from(0); - self.omitted_count = 0u32; - } -} -impl ::buffa::json_helpers::ProtoElemJson for RecoveryOrigin { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECOVERY_ORIGIN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.RecoveryOrigin", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ParentLink { - /// Field 1: `parent_session_id` - #[serde( - rename = "parentSessionId", - alias = "parent_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub parent_session_id: ::buffa::alloc::string::String, - /// The parent's own ordinal of the dispatch that created this session. - /// - /// Field 2: `parent_dispatched_at` - #[serde(rename = "parentDispatchedAt", alias = "parent_dispatched_at")] - pub parent_dispatched_at: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, - /// Field 3: `cascade_policy` - #[serde( - rename = "cascadePolicy", - alias = "cascade_policy", - with = "::buffa::json_helpers::proto_enum" - )] - pub cascade_policy: ::buffa::EnumValue, - /// The parent-side operation this session was dispatched under. - /// - /// Field 4: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// The parent reached a terminal state and this session observed it. - /// - /// Field 5: `parent_terminated` - #[serde( - rename = "parentTerminated", - alias = "parent_terminated", - with = "::buffa::json_helpers::proto_bool" - )] - pub parent_terminated: bool, - /// The parent rewound past the dispatch: the inherited prefix no longer holds. - /// - /// Field 6: `history_invalidated` - #[serde( - rename = "historyInvalidated", - alias = "history_invalidated", - with = "::buffa::json_helpers::proto_bool" - )] - pub history_invalidated: bool, - /// Set once the lineage is detached, making the detach idempotent per id. - /// - /// Field 7: `detach_operation_id` - #[serde( - rename = "detachOperationId", - alias = "detach_operation_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub detach_operation_id: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for ParentLink { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ParentLink") - .field("parent_session_id", &self.parent_session_id) - .field("parent_dispatched_at", &self.parent_dispatched_at) - .field("cascade_policy", &self.cascade_policy) - .field("operation_id", &self.operation_id) - .field("parent_terminated", &self.parent_terminated) - .field("history_invalidated", &self.history_invalidated) - .field("detach_operation_id", &self.detach_operation_id) - .finish() - } -} -impl ParentLink { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ParentLink"; -} -impl ParentLink { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detach_operation_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_detach_operation_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detach_operation_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ParentLink); -impl ::buffa::MessageName for ParentLink { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "ParentLink"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.ParentLink"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ParentLink"; -} -impl ::buffa::Message for ParentLink { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - if self.parent_dispatched_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent_dispatched_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.cascade_policy.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - if let Some(ref v) = self.detach_operation_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.parent_session_id, buf); - if self.parent_dispatched_at.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent_dispatched_at.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.cascade_policy.to_i32(), buf); - ::buffa::types::put_string_field(4u32, &self.operation_id, buf); - ::buffa::types::put_bool_field(5u32, self.parent_terminated, buf); - ::buffa::types::put_bool_field(6u32, self.history_invalidated, buf); - if let Some(ref v) = self.detach_operation_id { - ::buffa::types::put_string_field(7u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.parent_session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.parent_dispatched_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.cascade_policy = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.parent_terminated = ::buffa::types::decode_bool(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.history_invalidated = ::buffa::types::decode_bool(buf)?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .detach_operation_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.parent_session_id.clear(); - self.parent_dispatched_at = ::buffa::MessageField::none(); - self.cascade_policy = ::buffa::EnumValue::from(0); - self.operation_id.clear(); - self.parent_terminated = false; - self.history_invalidated = false; - self.detach_operation_id = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ParentLink { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PARENT_LINK_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ParentLink", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct Delegation { - /// Field 1: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// Field 2: `kind` - #[serde(rename = "kind", with = "::buffa::json_helpers::proto_enum")] - pub kind: ::buffa::EnumValue, - /// Set for DELEGATION_KIND_CHILD_SESSION. - /// - /// Field 3: `child_session_id` - #[serde( - rename = "childSessionId", - alias = "child_session_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub child_session_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 4: `cascade_policy` - #[serde( - rename = "cascadePolicy", - alias = "cascade_policy", - with = "::buffa::json_helpers::opt_enum", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub cascade_policy: ::core::option::Option< - ::buffa::EnumValue, - >, - /// Set for DELEGATION_KIND_EXTERNAL. - /// - /// Field 5: `delegate_reference` - #[serde( - rename = "delegateReference", - alias = "delegate_reference", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub delegate_reference: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 6: `dispatched_at` - #[serde(rename = "dispatchedAt", alias = "dispatched_at")] - pub dispatched_at: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, - /// Set once the child is detached, making the detach idempotent per id. - /// - /// Field 7: `detach_operation_id` - #[serde( - rename = "detachOperationId", - alias = "detach_operation_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub detach_operation_id: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for Delegation { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Delegation") - .field("operation_id", &self.operation_id) - .field("kind", &self.kind) - .field("child_session_id", &self.child_session_id) - .field("cascade_policy", &self.cascade_policy) - .field("delegate_reference", &self.delegate_reference) - .field("dispatched_at", &self.dispatched_at) - .field("detach_operation_id", &self.detach_operation_id) - .finish() - } -} -impl Delegation { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.Delegation"; -} -impl Delegation { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::child_session_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_child_session_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.child_session_id = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::cascade_policy`] to `Some(value)`, consuming and returning `self`. - pub fn with_cascade_policy( - mut self, - value: impl Into<::buffa::EnumValue>, - ) -> Self { - self.cascade_policy = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::delegate_reference`] to `Some(value)`, consuming and returning `self`. - pub fn with_delegate_reference( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.delegate_reference = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detach_operation_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_detach_operation_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detach_operation_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(Delegation); -impl ::buffa::MessageName for Delegation { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "Delegation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.Delegation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.Delegation"; -} -impl ::buffa::Message for Delegation { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.child_session_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.cascade_policy { - size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; - } - if let Some(ref v) = self.delegate_reference { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.dispatched_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.dispatched_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.detach_operation_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.operation_id, buf); - ::buffa::types::put_int32_field(2u32, self.kind.to_i32(), buf); - if let Some(ref v) = self.child_session_id { - ::buffa::types::put_string_field(3u32, v, buf); - } - if let Some(ref v) = self.cascade_policy { - ::buffa::types::put_int32_field(4u32, v.to_i32(), buf); - } - if let Some(ref v) = self.delegate_reference { - ::buffa::types::put_string_field(5u32, v, buf); - } - if self.dispatched_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.dispatched_at.write_to(__cache, buf); - } - if let Some(ref v) = self.detach_operation_id { - ::buffa::types::put_string_field(7u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.kind = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .child_session_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.cascade_policy = ::core::option::Option::Some( - ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?), - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .delegate_reference - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.dispatched_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .detach_operation_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.operation_id.clear(); - self.kind = ::buffa::EnumValue::from(0); - self.child_session_id = ::core::option::Option::None; - self.cascade_policy = ::core::option::Option::None; - self.delegate_reference = ::core::option::Option::None; - self.dispatched_at = ::buffa::MessageField::none(); - self.detach_operation_id = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for Delegation { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DELEGATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.Delegation", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ExecutionAttempt { - /// Field 1: `execution_attempt_id` - #[serde( - rename = "executionAttemptId", - alias = "execution_attempt_id", - with = "::buffa::json_helpers::proto_string" - )] - pub execution_attempt_id: ::buffa::alloc::string::String, - /// Field 2: `attempt_number` - #[serde( - rename = "attemptNumber", - alias = "attempt_number", - with = "::buffa::json_helpers::uint64" - )] - pub attempt_number: u64, - /// The attempt published its ready attestation; until then it holds the - /// session but must not be treated as serving. - /// - /// Field 3: `ready` - #[serde(rename = "ready", with = "::buffa::json_helpers::proto_bool")] - pub ready: bool, - /// Checkpoint the attempt restored from, empty when it started from scratch. - /// - /// Field 4: `restored_checkpoint_id` - #[serde( - rename = "restoredCheckpointId", - alias = "restored_checkpoint_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub restored_checkpoint_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Ordinal of the ExecutionAttemptStarted event itself: the head the attempt - /// selected, and the point its tail replay resumes from. - /// - /// Field 5: `started_at` - #[serde(rename = "startedAt", alias = "started_at")] - pub started_at: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for ExecutionAttempt { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ExecutionAttempt") - .field("execution_attempt_id", &self.execution_attempt_id) - .field("attempt_number", &self.attempt_number) - .field("ready", &self.ready) - .field("restored_checkpoint_id", &self.restored_checkpoint_id) - .field("started_at", &self.started_at) - .finish() - } -} -impl ExecutionAttempt { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ExecutionAttempt"; -} -impl ExecutionAttempt { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::restored_checkpoint_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_restored_checkpoint_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.restored_checkpoint_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ExecutionAttempt); -impl ::buffa::MessageName for ExecutionAttempt { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "ExecutionAttempt"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.ExecutionAttempt"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ExecutionAttempt"; -} -impl ::buffa::Message for ExecutionAttempt { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.attempt_number) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - if let Some(ref v) = self.restored_checkpoint_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.started_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.started_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.execution_attempt_id, buf); - ::buffa::types::put_uint64_field(2u32, self.attempt_number, buf); - ::buffa::types::put_bool_field(3u32, self.ready, buf); - if let Some(ref v) = self.restored_checkpoint_id { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.started_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.started_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.execution_attempt_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.attempt_number = ::buffa::types::decode_uint64(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.ready = ::buffa::types::decode_bool(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .restored_checkpoint_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.started_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.execution_attempt_id.clear(); - self.attempt_number = 0u64; - self.ready = false; - self.restored_checkpoint_id = ::core::option::Option::None; - self.started_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ExecutionAttempt { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __EXECUTION_ATTEMPT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ExecutionAttempt", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CompactionMarker { - /// Field 1: `summary_id` - #[serde( - rename = "summaryId", - alias = "summary_id", - with = "::buffa::json_helpers::proto_string" - )] - pub summary_id: ::buffa::alloc::string::String, - /// Ordinal of the Compacted event itself. - /// - /// Field 2: `marker_ordinal` - #[serde(rename = "markerOrdinal", alias = "marker_ordinal")] - pub marker_ordinal: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, - /// Field 3: `covers_from` - #[serde(rename = "coversFrom", alias = "covers_from")] - pub covers_from: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, - /// Field 4: `covers_through` - #[serde(rename = "coversThrough", alias = "covers_through")] - pub covers_through: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, - /// Field 5: `covered_input_digest` - #[serde(rename = "coveredInputDigest", alias = "covered_input_digest")] - pub covered_input_digest: ::buffa::MessageField< - super::super::v1alpha1::Digest, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for CompactionMarker { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CompactionMarker") - .field("summary_id", &self.summary_id) - .field("marker_ordinal", &self.marker_ordinal) - .field("covers_from", &self.covers_from) - .field("covers_through", &self.covers_through) - .field("covered_input_digest", &self.covered_input_digest) - .finish() - } -} -impl CompactionMarker { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.CompactionMarker"; -} -::buffa::impl_default_instance!(CompactionMarker); -impl ::buffa::MessageName for CompactionMarker { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "CompactionMarker"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.CompactionMarker"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.CompactionMarker"; -} -impl ::buffa::Message for CompactionMarker { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary_id) as u64; - if self.marker_ordinal.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.marker_ordinal.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covers_from.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_from.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covers_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covered_input_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covered_input_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.summary_id, buf); - if self.marker_ordinal.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.marker_ordinal.write_to(__cache, buf); - } - if self.covers_from.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_from.write_to(__cache, buf); - } - if self.covers_through.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_through.write_to(__cache, buf); - } - if self.covered_input_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covered_input_digest.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.summary_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.marker_ordinal.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.covers_from.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.covers_through.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.covered_input_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.summary_id.clear(); - self.marker_ordinal = ::buffa::MessageField::none(); - self.covers_from = ::buffa::MessageField::none(); - self.covers_through = ::buffa::MessageField::none(); - self.covered_input_digest = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CompactionMarker { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COMPACTION_MARKER_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.CompactionMarker", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ToolCall { - /// Field 1: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Retry identity of the call, and the key its terminal outcome joins on. - /// - /// Field 2: `tool_execution_id` - #[serde( - rename = "toolExecutionId", - alias = "tool_execution_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_execution_id: ::buffa::alloc::string::String, - /// Field 3: `tool_name` - #[serde( - rename = "toolName", - alias = "tool_name", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_name: ::buffa::alloc::string::String, - /// Field 4: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, - /// The operation ledger entry guarding this call's side effect, when it - /// reserves one. - /// - /// Field 5: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub operation_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 6: `status` - #[serde(rename = "status", with = "::buffa::json_helpers::proto_enum")] - pub status: ::buffa::EnumValue, - /// Field 7: `requested_at` - #[serde(rename = "requestedAt", alias = "requested_at")] - pub requested_at: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, - /// Set when the call started executing. A call with started_at set and - /// settled_at unset is exactly an interrupted call awaiting reconciliation. - /// - /// Field 8: `started_at` - #[serde( - rename = "startedAt", - alias = "started_at", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub started_at: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, - /// Set by the first terminal outcome; a later conflicting one is audit-only. - /// - /// Field 9: `settled_at` - #[serde( - rename = "settledAt", - alias = "settled_at", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub settled_at: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for ToolCall { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ToolCall") - .field("tool_call_id", &self.tool_call_id) - .field("tool_execution_id", &self.tool_execution_id) - .field("tool_name", &self.tool_name) - .field("turn_id", &self.turn_id) - .field("operation_id", &self.operation_id) - .field("status", &self.status) - .field("requested_at", &self.requested_at) - .field("started_at", &self.started_at) - .field("settled_at", &self.settled_at) - .finish() - } -} -impl ToolCall { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ToolCall"; -} -impl ToolCall { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::operation_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_operation_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.operation_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ToolCall); -impl ::buffa::MessageName for ToolCall { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "ToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.ToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ToolCall"; -} -impl ::buffa::Message for ToolCall { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_name) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if let Some(ref v) = self.operation_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - { - let val = self.status.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.requested_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.requested_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.started_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.started_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.settled_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.settled_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_name, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - if let Some(ref v) = self.operation_id { - ::buffa::types::put_string_field(5u32, v, buf); - } - ::buffa::types::put_int32_field(6u32, self.status.to_i32(), buf); - if self.requested_at.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.requested_at.write_to(__cache, buf); - } - if self.started_at.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.started_at.write_to(__cache, buf); - } - if self.settled_at.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.settled_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_execution_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_name, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .operation_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.status = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.requested_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.started_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.settled_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.tool_call_id.clear(); - self.tool_execution_id.clear(); - self.tool_name.clear(); - self.turn_id.clear(); - self.operation_id = ::core::option::Option::None; - self.status = ::buffa::EnumValue::from(0); - self.requested_at = ::buffa::MessageField::none(); - self.started_at = ::buffa::MessageField::none(); - self.settled_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolCall { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TOOL_CALL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.ToolCall", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct Operation { - /// Field 1: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// Field 2: `operation_kind` - #[serde( - rename = "operationKind", - alias = "operation_kind", - with = "::buffa::json_helpers::proto_enum" - )] - pub operation_kind: ::buffa::EnumValue, - /// Digest of the reserved request, so a retry carrying different bytes under - /// the same id is refused instead of executed twice. - /// - /// Field 3: `request_digest` - #[serde(rename = "requestDigest", alias = "request_digest")] - pub request_digest: ::buffa::MessageField< - super::super::v1alpha1::Digest, - ::buffa::Inline, - >, - /// Field 4: `status` - #[serde(rename = "status", with = "::buffa::json_helpers::proto_enum")] - pub status: ::buffa::EnumValue, - /// Cancellation was asked for; it does not settle the operation, which still - /// needs a recorded outcome. - /// - /// Field 5: `cancellation_requested` - #[serde( - rename = "cancellationRequested", - alias = "cancellation_requested", - with = "::buffa::json_helpers::proto_bool" - )] - pub cancellation_requested: bool, - /// Field 6: `reserved_at` - #[serde(rename = "reservedAt", alias = "reserved_at")] - pub reserved_at: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, - /// Set by the determinate outcome that settled the operation. - /// - /// Field 7: `settled_at` - #[serde( - rename = "settledAt", - alias = "settled_at", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub settled_at: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for Operation { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Operation") - .field("operation_id", &self.operation_id) - .field("operation_kind", &self.operation_kind) - .field("request_digest", &self.request_digest) - .field("status", &self.status) - .field("cancellation_requested", &self.cancellation_requested) - .field("reserved_at", &self.reserved_at) - .field("settled_at", &self.settled_at) - .finish() - } -} -impl Operation { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.Operation"; -} -::buffa::impl_default_instance!(Operation); -impl ::buffa::MessageName for Operation { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "Operation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.Operation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.Operation"; -} -impl ::buffa::Message for Operation { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - { - let val = self.operation_kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.request_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.request_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.status.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - if self.reserved_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.reserved_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.settled_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.settled_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.operation_id, buf); - ::buffa::types::put_int32_field(2u32, self.operation_kind.to_i32(), buf); - if self.request_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.request_digest.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(4u32, self.status.to_i32(), buf); - ::buffa::types::put_bool_field(5u32, self.cancellation_requested, buf); - if self.reserved_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.reserved_at.write_to(__cache, buf); - } - if self.settled_at.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.settled_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.operation_kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.request_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.status = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.cancellation_requested = ::buffa::types::decode_bool(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.reserved_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.settled_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.operation_id.clear(); - self.operation_kind = ::buffa::EnumValue::from(0); - self.request_digest = ::buffa::MessageField::none(); - self.status = ::buffa::EnumValue::from(0); - self.cancellation_requested = false; - self.reserved_at = ::buffa::MessageField::none(); - self.settled_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for Operation { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __OPERATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.Operation", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CheckpointEvidence { - /// Field 1: `checkpoint_id` - #[serde( - rename = "checkpointId", - alias = "checkpoint_id", - with = "::buffa::json_helpers::proto_string" - )] - pub checkpoint_id: ::buffa::alloc::string::String, - /// Field 2: `checkpoint` - #[serde(rename = "checkpoint")] - pub checkpoint: ::buffa::MessageField< - super::super::v1alpha1::Checkpoint, - ::buffa::Inline, - >, - /// Ordinal of the CheckpointProduced event that admitted this evidence. - /// - /// Field 3: `produced_at` - #[serde(rename = "producedAt", alias = "produced_at")] - pub produced_at: ::buffa::MessageField< - super::super::v1alpha1::SessionOrdinal, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for CheckpointEvidence { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CheckpointEvidence") - .field("checkpoint_id", &self.checkpoint_id) - .field("checkpoint", &self.checkpoint) - .field("produced_at", &self.produced_at) - .finish() - } -} -impl CheckpointEvidence { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.CheckpointEvidence"; -} -::buffa::impl_default_instance!(CheckpointEvidence); -impl ::buffa::MessageName for CheckpointEvidence { - const PACKAGE: &'static str = "trogonai.session.sessions.state.v1alpha1"; - const NAME: &'static str = "CheckpointEvidence"; - const FULL_NAME: &'static str = "trogonai.session.sessions.state.v1alpha1.CheckpointEvidence"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.CheckpointEvidence"; -} -impl ::buffa::Message for CheckpointEvidence { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.checkpoint_id) as u64; - if self.checkpoint.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.checkpoint.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.produced_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.produced_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.checkpoint_id, buf); - if self.checkpoint.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.checkpoint.write_to(__cache, buf); - } - if self.produced_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.produced_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.checkpoint_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.checkpoint.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.produced_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.checkpoint_id.clear(); - self.checkpoint = ::buffa::MessageField::none(); - self.produced_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CheckpointEvidence { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CHECKPOINT_EVIDENCE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.state.v1alpha1.CheckpointEvidence", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.apply_redaction.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.apply_redaction.__view.rs deleted file mode 100644 index d0e7ba9db..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.apply_redaction.__view.rs +++ /dev/null @@ -1,315 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/apply_redaction.proto - -/// ApplyRedaction marks recorded events as redacted, recording -/// \[RedactionApplied\]. Redaction is a recorded fact about history, not a -/// rewrite of it (ADR#0035 facet 5). -/// -/// Write precondition At. The invariant that the targeted ids exist in this -/// session cannot be checked from folded state today: no event carries its own -/// envelope id into evolve, which ADR#0035 lists as an unmet substrate -/// obligation. -#[derive(Clone, Debug, Default)] -pub struct ApplyRedactionView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `redacted_event_ids` - pub redacted_event_ids: ::buffa::RepeatedView<'a, &'a str>, - /// Field 3: `reason` - pub reason: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ApplyRedactionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ApplyRedactionView<'a> { - type Owned = super::super::ApplyRedaction; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = Some(::buffa::types::borrow_str(&mut cur)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::borrow_str(&mut cur)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - view.redacted_event_ids.push(__elem); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ApplyRedaction { - session_id: self.session_id.to_string(), - redacted_event_ids: self - .redacted_event_ids - .iter() - .map(|s| s.to_string()) - .collect(), - reason: self.reason.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ApplyRedactionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - for v in &self.redacted_event_ids { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - for v in &self.redacted_event_ids { - ::buffa::types::put_string_field(2u32, v, buf); - } - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ApplyRedactionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - if !self.redacted_event_ids.is_empty() { - __map.serialize_entry("redactedEventIds", &*self.redacted_event_ids)?; - } - if let ::core::option::Option::Some(__v) = self.reason { - __map.serialize_entry("reason", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ApplyRedactionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ApplyRedaction"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ApplyRedaction"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ApplyRedaction"; -} -::buffa::impl_default_view_instance!(ApplyRedactionView); -::buffa::impl_view_reborrow!(ApplyRedactionView); -/** Self-contained, `'static` owned view of a `ApplyRedaction` message. - - Wraps [`::buffa::OwnedView`]`<`[`ApplyRedactionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ApplyRedactionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ApplyRedactionOwnedView(::buffa::OwnedView>); -impl ApplyRedactionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ApplyRedactionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ApplyRedactionOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ApplyRedaction, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ApplyRedactionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ApplyRedactionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ApplyRedactionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ApplyRedaction { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `redacted_event_ids` - #[must_use] - pub fn redacted_event_ids(&self) -> &::buffa::RepeatedView<'_, &'_ str> { - &self.0.reborrow().redacted_event_ids - } - /// Field 3: `reason` - #[must_use] - pub fn reason(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ApplyRedactionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ApplyRedactionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ApplyRedactionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ApplyRedactionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ApplyRedaction { - type View<'a> = ApplyRedactionView<'a>; - type ViewHandle = ApplyRedactionOwnedView; -} -impl ::serde::Serialize for ApplyRedactionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.apply_redaction.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.apply_redaction.rs deleted file mode 100644 index 36d597d70..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.apply_redaction.rs +++ /dev/null @@ -1,177 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/apply_redaction.proto - -/// ApplyRedaction marks recorded events as redacted, recording -/// \[RedactionApplied\]. Redaction is a recorded fact about history, not a -/// rewrite of it (ADR#0035 facet 5). -/// -/// Write precondition At. The invariant that the targeted ids exist in this -/// session cannot be checked from folded state today: no event carries its own -/// envelope id into evolve, which ADR#0035 lists as an unmet substrate -/// obligation. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ApplyRedaction { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `redacted_event_ids` - #[serde( - rename = "redactedEventIds", - alias = "redacted_event_ids", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub redacted_event_ids: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, - /// Field 3: `reason` - #[serde(rename = "reason", skip_serializing_if = "::core::option::Option::is_none")] - pub reason: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for ApplyRedaction { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ApplyRedaction") - .field("session_id", &self.session_id) - .field("redacted_event_ids", &self.redacted_event_ids) - .field("reason", &self.reason) - .finish() - } -} -impl ApplyRedaction { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ApplyRedaction"; -} -impl ApplyRedaction { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::reason`] to `Some(value)`, consuming and returning `self`. - pub fn with_reason( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.reason = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ApplyRedaction); -impl ::buffa::MessageName for ApplyRedaction { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ApplyRedaction"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ApplyRedaction"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ApplyRedaction"; -} -impl ::buffa::Message for ApplyRedaction { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - for v in &self.redacted_event_ids { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - for v in &self.redacted_event_ids { - ::buffa::types::put_string_field(2u32, v, buf); - } - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::decode_string(buf)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - self.redacted_event_ids.push(__elem); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.reason.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.redacted_event_ids.clear(); - self.reason = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ApplyRedaction { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __APPLY_REDACTION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ApplyRedaction", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.approve_tool_call.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.approve_tool_call.__view.rs deleted file mode 100644 index 978d8ce0b..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.approve_tool_call.__view.rs +++ /dev/null @@ -1,369 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/approve_tool_call.proto - -/// ApproveToolCall records a human decision to allow a call, recording -/// \[ToolCallApproved\]. -/// -/// Write precondition At: approve and deny are mutually exclusive, so a decision -/// taken against a stale head must be rejected rather than appended beside its -/// opposite. -#[derive(Clone, Debug, Default)] -pub struct ApproveToolCallView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Field 3: `tool_execution_id` - pub tool_execution_id: &'a str, - /// Field 4: `approved_by` - pub approved_by: &'a str, - /// Field 5: `turn_id` - pub turn_id: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ApproveToolCallView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_execution_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_execution_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `approved_by` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_approved_by(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ApproveToolCallView<'a> { - type Owned = super::super::ApproveToolCall; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_execution_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.approved_by = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ApproveToolCall { - session_id: self.session_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - tool_execution_id: self.tool_execution_id.to_string(), - approved_by: self.approved_by.to_string(), - turn_id: self.turn_id.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ApproveToolCallView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.approved_by) as u64; - if let Some(ref v) = self.turn_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.approved_by, buf); - if let Some(ref v) = self.turn_id { - ::buffa::types::put_string_field(5u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ApproveToolCallView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolExecutionId", self.tool_execution_id)?; - } - { - __map.serialize_entry("approvedBy", self.approved_by)?; - } - if let ::core::option::Option::Some(__v) = self.turn_id { - __map.serialize_entry("turnId", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ApproveToolCallView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ApproveToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ApproveToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ApproveToolCall"; -} -::buffa::impl_default_view_instance!(ApproveToolCallView); -::buffa::impl_view_reborrow!(ApproveToolCallView); -/** Self-contained, `'static` owned view of a `ApproveToolCall` message. - - Wraps [`::buffa::OwnedView`]`<`[`ApproveToolCallView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ApproveToolCallView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ApproveToolCallOwnedView(::buffa::OwnedView>); -impl ApproveToolCallOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ApproveToolCallOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ApproveToolCallOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ApproveToolCall, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ApproveToolCallOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ApproveToolCallView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ApproveToolCallView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ApproveToolCall { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Field 3: `tool_execution_id` - #[must_use] - pub fn tool_execution_id(&self) -> &'_ str { - self.0.reborrow().tool_execution_id - } - /// Field 4: `approved_by` - #[must_use] - pub fn approved_by(&self) -> &'_ str { - self.0.reborrow().approved_by - } - /// Field 5: `turn_id` - #[must_use] - pub fn turn_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ApproveToolCallOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ApproveToolCallOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ApproveToolCallOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ApproveToolCallOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ApproveToolCall { - type View<'a> = ApproveToolCallView<'a>; - type ViewHandle = ApproveToolCallOwnedView; -} -impl ::serde::Serialize for ApproveToolCallOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.approve_tool_call.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.approve_tool_call.rs deleted file mode 100644 index aabb679f1..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.approve_tool_call.rs +++ /dev/null @@ -1,207 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/approve_tool_call.proto - -/// ApproveToolCall records a human decision to allow a call, recording -/// \[ToolCallApproved\]. -/// -/// Write precondition At: approve and deny are mutually exclusive, so a decision -/// taken against a stale head must be rejected rather than appended beside its -/// opposite. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ApproveToolCall { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Field 3: `tool_execution_id` - #[serde( - rename = "toolExecutionId", - alias = "tool_execution_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_execution_id: ::buffa::alloc::string::String, - /// Field 4: `approved_by` - #[serde( - rename = "approvedBy", - alias = "approved_by", - with = "::buffa::json_helpers::proto_string" - )] - pub approved_by: ::buffa::alloc::string::String, - /// Field 5: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub turn_id: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for ApproveToolCall { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ApproveToolCall") - .field("session_id", &self.session_id) - .field("tool_call_id", &self.tool_call_id) - .field("tool_execution_id", &self.tool_execution_id) - .field("approved_by", &self.approved_by) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl ApproveToolCall { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ApproveToolCall"; -} -impl ApproveToolCall { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::turn_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_turn_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.turn_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ApproveToolCall); -impl ::buffa::MessageName for ApproveToolCall { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ApproveToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ApproveToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ApproveToolCall"; -} -impl ::buffa::Message for ApproveToolCall { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.approved_by) as u64; - if let Some(ref v) = self.turn_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.approved_by, buf); - if let Some(ref v) = self.turn_id { - ::buffa::types::put_string_field(5u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_execution_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.approved_by, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.turn_id.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.tool_call_id.clear(); - self.tool_execution_id.clear(); - self.approved_by.clear(); - self.turn_id = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ApproveToolCall { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __APPROVE_TOOL_CALL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ApproveToolCall", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.archive_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.archive_session.__view.rs deleted file mode 100644 index 9abff0a27..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.archive_session.__view.rs +++ /dev/null @@ -1,256 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/archive_session.proto - -/// ArchiveSession moves a session out of the default listing view, recording -/// \[SessionArchived\]. Reversible organization state, unlike the terminal -/// HideSession. -/// -/// Write precondition Any. -#[derive(Clone, Debug, Default)] -pub struct ArchiveSessionView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ArchiveSessionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ArchiveSessionView<'a> { - type Owned = super::super::ArchiveSession; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ArchiveSession { - session_id: self.session_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ArchiveSessionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ArchiveSessionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ArchiveSessionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ArchiveSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ArchiveSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArchiveSession"; -} -::buffa::impl_default_view_instance!(ArchiveSessionView); -::buffa::impl_view_reborrow!(ArchiveSessionView); -/** Self-contained, `'static` owned view of a `ArchiveSession` message. - - Wraps [`::buffa::OwnedView`]`<`[`ArchiveSessionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ArchiveSessionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ArchiveSessionOwnedView(::buffa::OwnedView>); -impl ArchiveSessionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArchiveSessionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArchiveSessionOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ArchiveSession, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArchiveSessionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ArchiveSessionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ArchiveSessionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ArchiveSession { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ArchiveSessionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ArchiveSessionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ArchiveSessionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ArchiveSessionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ArchiveSession { - type View<'a> = ArchiveSessionView<'a>; - type ViewHandle = ArchiveSessionOwnedView; -} -impl ::serde::Serialize for ArchiveSessionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.archive_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.archive_session.rs deleted file mode 100644 index 095d914ec..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.archive_session.rs +++ /dev/null @@ -1,112 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/archive_session.proto - -/// ArchiveSession moves a session out of the default listing view, recording -/// \[SessionArchived\]. Reversible organization state, unlike the terminal -/// HideSession. -/// -/// Write precondition Any. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ArchiveSession { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for ArchiveSession { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ArchiveSession").field("session_id", &self.session_id).finish() - } -} -impl ArchiveSession { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArchiveSession"; -} -::buffa::impl_default_instance!(ArchiveSession); -impl ::buffa::MessageName for ArchiveSession { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ArchiveSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ArchiveSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArchiveSession"; -} -impl ::buffa::Message for ArchiveSession { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ArchiveSession { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ARCHIVE_SESSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArchiveSession", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact.__oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact.__oneof.rs deleted file mode 100644 index f78e6c66e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact.__oneof.rs +++ /dev/null @@ -1,51 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/artifact.proto - -pub mod artifact_metadata { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, PartialEq, Debug)] - pub enum Source { - Stored(::buffa::alloc::boxed::Box), - External(::buffa::alloc::boxed::Box), - } - impl ::buffa::Oneof for Source {} - impl From for Source { - fn from(v: super::super::super::StoredArtifact) -> Self { - Self::Stored(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::StoredArtifact) -> Self { - Self::Some(Source::from(v)) - } - } - impl From for Source { - fn from(v: super::super::super::ExternalArtifact) -> Self { - Self::External(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ExternalArtifact) -> Self { - Self::Some(Source::from(v)) - } - } - impl serde::Serialize for Source { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::Stored(v) => { - map.serialize_entry("stored", v)?; - } - Self::External(v) => { - map.serialize_entry("external", v)?; - } - } - map.end() - } - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact.__view.rs deleted file mode 100644 index 9cc1099ab..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact.__view.rs +++ /dev/null @@ -1,1980 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/artifact.proto - -/// ArtifactRef is an inline claim-check to an artifact stored out of line: the -/// stream carries the content digest and a preview, never the bytes. It appears -/// inside messages and tool results that reference an artifact. It references -/// durably stored bytes only -- mime is always required here because it is -/// StoredArtifact.mime carried forward, never a degraded external's -/// declared_mime (D11). -#[derive(Clone, Debug, Default)] -pub struct ArtifactRefView<'a> { - /// Stable artifact id within the session. - /// - /// Field 1: `artifact_id` - pub artifact_id: &'a str, - /// Content digest over the artifact bytes; the claim-check key (ADR#0035 facet 3). - /// Uses the shared Digest type for consistency with every other digest in the - /// package (algorithm is typically "sha256"). - /// - /// Field 2: `digest` - pub digest: ::buffa::MessageFieldView>, - /// Size of the referenced bytes. - /// - /// Field 3: `size_bytes` - pub size_bytes: u64, - /// IANA media type of the referenced bytes. - /// - /// Field 4: `mime` - pub mime: &'a str, - /// Short human-readable preview; empty when none was produced. - /// - /// Field 5: `preview` - pub preview: ::core::option::Option<&'a str>, - /// True when preview is a truncation of the full content. - /// - /// Field 6: `truncated` - pub truncated: ::core::option::Option, - /// Size of the content before truncation, when the referenced bytes are - /// themselves a truncation of a larger original that was never stored. Unset - /// when size_bytes already is the full size. Recorded so a reader can tell - /// "1 KB of output" from "1 KB of a 40 MB output" without fetching anything. - /// - /// Field 7: `untruncated_size_bytes` - pub untruncated_size_bytes: ::core::option::Option, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ArtifactRefView<'a> { - /**Whether required field `artifact_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_digest(&self) -> bool { - self.digest.is_set() - } - /**Whether required field `size_bytes` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_size_bytes(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `mime` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_mime(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ArtifactRefView<'a> { - type Owned = super::super::ArtifactRef; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.artifact_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.size_bytes = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.mime = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.preview = Some(::buffa::types::borrow_str(&mut cur)?); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.truncated = Some(::buffa::types::decode_bool(&mut cur)?); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.untruncated_size_bytes = Some( - ::buffa::types::decode_uint64(&mut cur)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ArtifactRef { - artifact_id: self.artifact_id.to_string(), - digest: match self.digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - size_bytes: self.size_bytes, - mime: self.mime.to_string(), - preview: self.preview.map(|s| s.to_string()), - truncated: self.truncated, - untruncated_size_bytes: self.untruncated_size_bytes, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ArtifactRefView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - if self.digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.size_bytes) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.mime) as u64; - if let Some(ref v) = self.preview { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.truncated.is_some() { - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - } - if let Some(v) = self.untruncated_size_bytes { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.artifact_id, buf); - if self.digest.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.digest.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(3u32, self.size_bytes, buf); - ::buffa::types::put_string_field(4u32, &self.mime, buf); - if let Some(ref v) = self.preview { - ::buffa::types::put_string_field(5u32, v, buf); - } - if let Some(v) = self.truncated { - ::buffa::types::put_bool_field(6u32, v, buf); - } - if let Some(v) = self.untruncated_size_bytes { - ::buffa::types::put_uint64_field(7u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ArtifactRefView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("artifactId", self.artifact_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.digest.as_option() { - __map.serialize_entry("digest", __v)?; - } - } - { - __map - .serialize_entry( - "sizeBytes", - &::buffa::json_helpers::ProtoJson(&self.size_bytes), - )?; - } - { - __map.serialize_entry("mime", self.mime)?; - } - if let ::core::option::Option::Some(__v) = self.preview { - __map.serialize_entry("preview", __v)?; - } - if let ::core::option::Option::Some(__v) = self.truncated { - __map.serialize_entry("truncated", &__v)?; - } - if let ::core::option::Option::Some(__v) = self.untruncated_size_bytes { - __map - .serialize_entry( - "untruncatedSizeBytes", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ArtifactRefView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ArtifactRef"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ArtifactRef"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactRef"; -} -::buffa::impl_default_view_instance!(ArtifactRefView); -::buffa::impl_view_reborrow!(ArtifactRefView); -/** Self-contained, `'static` owned view of a `ArtifactRef` message. - - Wraps [`::buffa::OwnedView`]`<`[`ArtifactRefView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ArtifactRefView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ArtifactRefOwnedView(::buffa::OwnedView>); -impl ArtifactRefOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactRefOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactRefOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ArtifactRef, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactRefOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ArtifactRefView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ArtifactRefView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ArtifactRef { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Stable artifact id within the session. - /// - /// Field 1: `artifact_id` - #[must_use] - pub fn artifact_id(&self) -> &'_ str { - self.0.reborrow().artifact_id - } - /// Content digest over the artifact bytes; the claim-check key (ADR#0035 facet 3). - /// Uses the shared Digest type for consistency with every other digest in the - /// package (algorithm is typically "sha256"). - /// - /// Field 2: `digest` - #[must_use] - pub fn digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().digest - } - /// Size of the referenced bytes. - /// - /// Field 3: `size_bytes` - #[must_use] - pub fn size_bytes(&self) -> u64 { - self.0.reborrow().size_bytes - } - /// IANA media type of the referenced bytes. - /// - /// Field 4: `mime` - #[must_use] - pub fn mime(&self) -> &'_ str { - self.0.reborrow().mime - } - /// Short human-readable preview; empty when none was produced. - /// - /// Field 5: `preview` - #[must_use] - pub fn preview(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().preview - } - /// True when preview is a truncation of the full content. - /// - /// Field 6: `truncated` - #[must_use] - pub fn truncated(&self) -> ::core::option::Option { - self.0.reborrow().truncated - } - /// Size of the content before truncation, when the referenced bytes are - /// themselves a truncation of a larger original that was never stored. Unset - /// when size_bytes already is the full size. Recorded so a reader can tell - /// "1 KB of output" from "1 KB of a 40 MB output" without fetching anything. - /// - /// Field 7: `untruncated_size_bytes` - #[must_use] - pub fn untruncated_size_bytes(&self) -> ::core::option::Option { - self.0.reborrow().untruncated_size_bytes - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ArtifactRefOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ArtifactRefOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ArtifactRefOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ArtifactRefOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ArtifactRef { - type View<'a> = ArtifactRefView<'a>; - type ViewHandle = ArtifactRefOwnedView; -} -impl ::serde::Serialize for ArtifactRefOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ArtifactMetadata is the claim-check record carried by ArtifactRecorded. Its -/// source arm distinguishes durably-stored bytes (addressable by sha256) from a -/// degraded external reference whose bytes were not durably stored, so required-ness is -/// expressed per branch rather than collapsed into always-required fields that a -/// degraded artifact cannot supply (ADR#0035 facet 3). Media type lives per -/// branch rather than on this envelope: StoredArtifact.mime is always required -/// (decoded/validated), ExternalArtifact.declared_mime is optional -/// (source-declared, never validated). A reader needing one effective type -/// uses stored mime, else declared_mime, else falls back to -/// "application/octet-stream" (D11). -#[derive(Clone, Debug, Default)] -pub struct ArtifactMetadataView<'a> { - /// Stable artifact id within the session. - /// - /// Field 1: `artifact_id` - pub artifact_id: &'a str, - /// Short human-readable preview; empty when none was produced. - /// - /// Field 3: `preview` - pub preview: ::core::option::Option<&'a str>, - /// True when preview is a truncation of the full content. - /// - /// Field 4: `truncated` - pub truncated: ::core::option::Option, - /// Wall-clock instant the artifact record was created: a real external - /// occurrence distinct from envelope append time (D10). - /// - /// Field 5: `created_at` - pub created_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - pub source: ::core::option::Option< - super::super::__buffa::view::oneof::artifact_metadata::Source<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ArtifactMetadataView<'a> { - /**Whether required field `artifact_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `created_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_created_at(&self) -> bool { - self.created_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ArtifactMetadataView<'a> { - type Owned = super::super::ArtifactMetadata; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.artifact_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.preview = Some(::buffa::types::borrow_str(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.truncated = Some(::buffa::types::decode_bool(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.created_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.created_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::artifact_metadata::Source::Stored( - ref mut existing, - ), - ) = view.source - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.source = Some( - super::super::__buffa::view::oneof::artifact_metadata::Source::Stored( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::artifact_metadata::Source::External( - ref mut existing, - ), - ) = view.source - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.source = Some( - super::super::__buffa::view::oneof::artifact_metadata::Source::External( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ArtifactMetadata { - artifact_id: self.artifact_id.to_string(), - preview: self.preview.map(|s| s.to_string()), - truncated: self.truncated, - created_at: match self.created_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - source: match self.source.as_ref() { - ::core::option::Option::Some(v) => { - ::core::option::Option::Some( - match v { - super::super::__buffa::view::oneof::artifact_metadata::Source::Stored( - v, - ) => { - super::super::__buffa::oneof::artifact_metadata::Source::Stored( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::artifact_metadata::Source::External( - v, - ) => { - super::super::__buffa::oneof::artifact_metadata::Source::External( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - }, - ) - } - ::core::option::Option::None => ::core::option::Option::None, - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ArtifactMetadataView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - if let Some(ref v) = self.preview { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.truncated.is_some() { - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - } - if self.created_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.created_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let ::core::option::Option::Some(ref v) = self.source { - match v { - super::super::__buffa::view::oneof::artifact_metadata::Source::Stored( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::artifact_metadata::Source::External( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.artifact_id, buf); - if let Some(ref v) = self.preview { - ::buffa::types::put_string_field(3u32, v, buf); - } - if let Some(v) = self.truncated { - ::buffa::types::put_bool_field(4u32, v, buf); - } - if self.created_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.created_at.write_to(__cache, buf); - } - if let ::core::option::Option::Some(ref v) = self.source { - match v { - super::super::__buffa::view::oneof::artifact_metadata::Source::Stored( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::artifact_metadata::Source::External( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ArtifactMetadataView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("artifactId", self.artifact_id)?; - } - if let ::core::option::Option::Some(__v) = self.preview { - __map.serialize_entry("preview", __v)?; - } - if let ::core::option::Option::Some(__v) = self.truncated { - __map.serialize_entry("truncated", &__v)?; - } - { - if let ::core::option::Option::Some(__v) = self.created_at.as_option() { - __map.serialize_entry("createdAt", __v)?; - } - } - if let ::core::option::Option::Some(ref __ov) = self.source { - match __ov { - super::super::__buffa::view::oneof::artifact_metadata::Source::Stored( - v, - ) => { - __map.serialize_entry("stored", v)?; - } - super::super::__buffa::view::oneof::artifact_metadata::Source::External( - v, - ) => { - __map.serialize_entry("external", v)?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ArtifactMetadataView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ArtifactMetadata"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ArtifactMetadata"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactMetadata"; -} -::buffa::impl_default_view_instance!(ArtifactMetadataView); -::buffa::impl_view_reborrow!(ArtifactMetadataView); -/** Self-contained, `'static` owned view of a `ArtifactMetadata` message. - - Wraps [`::buffa::OwnedView`]`<`[`ArtifactMetadataView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ArtifactMetadataView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ArtifactMetadataOwnedView(::buffa::OwnedView>); -impl ArtifactMetadataOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactMetadataOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactMetadataOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ArtifactMetadata, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactMetadataOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ArtifactMetadataView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ArtifactMetadataView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ArtifactMetadata { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Stable artifact id within the session. - /// - /// Field 1: `artifact_id` - #[must_use] - pub fn artifact_id(&self) -> &'_ str { - self.0.reborrow().artifact_id - } - /// Short human-readable preview; empty when none was produced. - /// - /// Field 3: `preview` - #[must_use] - pub fn preview(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().preview - } - /// True when preview is a truncation of the full content. - /// - /// Field 4: `truncated` - #[must_use] - pub fn truncated(&self) -> ::core::option::Option { - self.0.reborrow().truncated - } - /// Wall-clock instant the artifact record was created: a real external - /// occurrence distinct from envelope append time (D10). - /// - /// Field 5: `created_at` - #[must_use] - pub fn created_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().created_at - } - /// Oneof `source`. - #[must_use] - pub fn source( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::artifact_metadata::Source<'_>, - > { - self.0.reborrow().source.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ArtifactMetadataOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ArtifactMetadataOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ArtifactMetadataOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ArtifactMetadataOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ArtifactMetadata { - type View<'a> = ArtifactMetadataView<'a>; - type ViewHandle = ArtifactMetadataOwnedView; -} -impl ::serde::Serialize for ArtifactMetadataOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// StoredArtifact is the source arm for an artifact whose bytes were durably stored. -#[derive(Clone, Debug, Default)] -pub struct StoredArtifactView<'a> { - /// Content digest over the stored bytes; the claim-check key. - /// - /// Field 1: `digest` - pub digest: ::buffa::MessageFieldView>, - /// Size of the stored bytes. - /// - /// Field 2: `size_bytes` - pub size_bytes: u64, - /// External location the bytes were stored at (for example an Object Store key). - /// - /// Field 3: `storage_ref` - pub storage_ref: &'a str, - /// Decoded/validated media type of the stored bytes. - /// - /// Field 4: `mime` - pub mime: &'a str, - /// Chunk hashing that lets a caller check part of this artifact without - /// reading all of it. Unset when the artifact was stored without one, which - /// means no range of it can be checked. - /// - /// Field 5: `chunks` - pub chunks: ::buffa::MessageFieldView< - super::super::__buffa::view::ContentChunksView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> StoredArtifactView<'a> { - /**Whether required field `digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_digest(&self) -> bool { - self.digest.is_set() - } - /**Whether required field `size_bytes` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_size_bytes(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `storage_ref` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_storage_ref(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `mime` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_mime(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for StoredArtifactView<'a> { - type Owned = super::super::StoredArtifact; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.size_bytes = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.storage_ref = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.mime = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.chunks.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.chunks = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::StoredArtifact { - digest: match self.digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - size_bytes: self.size_bytes, - storage_ref: self.storage_ref.to_string(), - mime: self.mime.to_string(), - chunks: match self.chunks.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ContentChunks, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for StoredArtifactView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.size_bytes) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.storage_ref) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.mime) as u64; - if self.chunks.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.chunks.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.digest.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.digest.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(2u32, self.size_bytes, buf); - ::buffa::types::put_string_field(3u32, &self.storage_ref, buf); - ::buffa::types::put_string_field(4u32, &self.mime, buf); - if self.chunks.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.chunks.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for StoredArtifactView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.digest.as_option() { - __map.serialize_entry("digest", __v)?; - } - } - { - __map - .serialize_entry( - "sizeBytes", - &::buffa::json_helpers::ProtoJson(&self.size_bytes), - )?; - } - { - __map.serialize_entry("storageRef", self.storage_ref)?; - } - { - __map.serialize_entry("mime", self.mime)?; - } - { - if let ::core::option::Option::Some(__v) = self.chunks.as_option() { - __map.serialize_entry("chunks", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for StoredArtifactView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "StoredArtifact"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.StoredArtifact"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StoredArtifact"; -} -::buffa::impl_default_view_instance!(StoredArtifactView); -::buffa::impl_view_reborrow!(StoredArtifactView); -/** Self-contained, `'static` owned view of a `StoredArtifact` message. - - Wraps [`::buffa::OwnedView`]`<`[`StoredArtifactView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`StoredArtifactView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct StoredArtifactOwnedView(::buffa::OwnedView>); -impl StoredArtifactOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StoredArtifactOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StoredArtifactOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::StoredArtifact, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StoredArtifactOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`StoredArtifactView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &StoredArtifactView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::StoredArtifact { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Content digest over the stored bytes; the claim-check key. - /// - /// Field 1: `digest` - #[must_use] - pub fn digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().digest - } - /// Size of the stored bytes. - /// - /// Field 2: `size_bytes` - #[must_use] - pub fn size_bytes(&self) -> u64 { - self.0.reborrow().size_bytes - } - /// External location the bytes were stored at (for example an Object Store key). - /// - /// Field 3: `storage_ref` - #[must_use] - pub fn storage_ref(&self) -> &'_ str { - self.0.reborrow().storage_ref - } - /// Decoded/validated media type of the stored bytes. - /// - /// Field 4: `mime` - #[must_use] - pub fn mime(&self) -> &'_ str { - self.0.reborrow().mime - } - /// Chunk hashing that lets a caller check part of this artifact without - /// reading all of it. Unset when the artifact was stored without one, which - /// means no range of it can be checked. - /// - /// Field 5: `chunks` - #[must_use] - pub fn chunks( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().chunks - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for StoredArtifactOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - StoredArtifactOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: StoredArtifactOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for StoredArtifactOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::StoredArtifact { - type View<'a> = StoredArtifactView<'a>; - type ViewHandle = StoredArtifactOwnedView; -} -impl ::serde::Serialize for StoredArtifactOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ExternalArtifact is the degraded source arm for an artifact whose bytes were -/// not durably stored; the source reference and optional transient fetch -/// evidence (fetched_at, content_digest) are retained. -#[derive(Clone, Debug, Default)] -pub struct ExternalArtifactView<'a> { - /// The (un-fetchable) source location. Must be credential-free: a - /// credential-bearing URL, a signed URL, or a secret is prohibited in this - /// durable field (D7); ingress secret-scanning is a command-boundary - /// obligation. - /// - /// Field 1: `source_url` - pub source_url: &'a str, - /// Source transport encoding, for example "base64"; empty when none. - /// - /// Field 2: `source_encoding` - pub source_encoding: ::core::option::Option<&'a str>, - /// MIME as declared by the source before validation; empty when not declared. - /// - /// Field 3: `declared_mime` - pub declared_mime: ::core::option::Option<&'a str>, - /// When a fetch of the source was attempted: a real external occurrence - /// distinct from envelope append time (D10); unset when not applicable. - /// - /// Field 4: `fetched_at` - pub fetched_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// Content digest computed over fetched bytes when the source was fetched - /// and hashed without being durably stored; unset otherwise. - /// - /// Field 5: `content_digest` - pub content_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ExternalArtifactView<'a> { - /**Whether required field `source_url` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_url(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ExternalArtifactView<'a> { - type Owned = super::super::ExternalArtifact; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source_url = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source_encoding = Some(::buffa::types::borrow_str(&mut cur)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.declared_mime = Some(::buffa::types::borrow_str(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.fetched_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.fetched_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.content_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.content_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ExternalArtifact { - source_url: self.source_url.to_string(), - source_encoding: self.source_encoding.map(|s| s.to_string()), - declared_mime: self.declared_mime.map(|s| s.to_string()), - fetched_at: match self.fetched_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - content_digest: match self.content_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ExternalArtifactView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.source_url) as u64; - if let Some(ref v) = self.source_encoding { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.declared_mime { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.fetched_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.fetched_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.content_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.content_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_url, buf); - if let Some(ref v) = self.source_encoding { - ::buffa::types::put_string_field(2u32, v, buf); - } - if let Some(ref v) = self.declared_mime { - ::buffa::types::put_string_field(3u32, v, buf); - } - if self.fetched_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.fetched_at.write_to(__cache, buf); - } - if self.content_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.content_digest.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ExternalArtifactView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sourceUrl", self.source_url)?; - } - if let ::core::option::Option::Some(__v) = self.source_encoding { - __map.serialize_entry("sourceEncoding", __v)?; - } - if let ::core::option::Option::Some(__v) = self.declared_mime { - __map.serialize_entry("declaredMime", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.fetched_at.as_option() { - __map.serialize_entry("fetchedAt", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.content_digest.as_option() { - __map.serialize_entry("contentDigest", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ExternalArtifactView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ExternalArtifact"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ExternalArtifact"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExternalArtifact"; -} -::buffa::impl_default_view_instance!(ExternalArtifactView); -::buffa::impl_view_reborrow!(ExternalArtifactView); -/** Self-contained, `'static` owned view of a `ExternalArtifact` message. - - Wraps [`::buffa::OwnedView`]`<`[`ExternalArtifactView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ExternalArtifactView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ExternalArtifactOwnedView(::buffa::OwnedView>); -impl ExternalArtifactOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExternalArtifactOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExternalArtifactOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ExternalArtifact, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExternalArtifactOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ExternalArtifactView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ExternalArtifactView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ExternalArtifact { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The (un-fetchable) source location. Must be credential-free: a - /// credential-bearing URL, a signed URL, or a secret is prohibited in this - /// durable field (D7); ingress secret-scanning is a command-boundary - /// obligation. - /// - /// Field 1: `source_url` - #[must_use] - pub fn source_url(&self) -> &'_ str { - self.0.reborrow().source_url - } - /// Source transport encoding, for example "base64"; empty when none. - /// - /// Field 2: `source_encoding` - #[must_use] - pub fn source_encoding(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().source_encoding - } - /// MIME as declared by the source before validation; empty when not declared. - /// - /// Field 3: `declared_mime` - #[must_use] - pub fn declared_mime(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().declared_mime - } - /// When a fetch of the source was attempted: a real external occurrence - /// distinct from envelope append time (D10); unset when not applicable. - /// - /// Field 4: `fetched_at` - #[must_use] - pub fn fetched_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().fetched_at - } - /// Content digest computed over fetched bytes when the source was fetched - /// and hashed without being durably stored; unset otherwise. - /// - /// Field 5: `content_digest` - #[must_use] - pub fn content_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().content_digest - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ExternalArtifactOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ExternalArtifactOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ExternalArtifactOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ExternalArtifactOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ExternalArtifact { - type View<'a> = ExternalArtifactView<'a>; - type ViewHandle = ExternalArtifactOwnedView; -} -impl ::serde::Serialize for ExternalArtifactOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact.__view_oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact.__view_oneof.rs deleted file mode 100644 index d3b4f448f..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact.__view_oneof.rs +++ /dev/null @@ -1,20 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/artifact.proto - -pub mod artifact_metadata { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Source<'a> { - Stored( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::StoredArtifactView<'a>, - >, - ), - External( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ExternalArtifactView<'a>, - >, - ), - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact.rs deleted file mode 100644 index 45df0188e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact.rs +++ /dev/null @@ -1,1251 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/artifact.proto - -/// ArtifactRef is an inline claim-check to an artifact stored out of line: the -/// stream carries the content digest and a preview, never the bytes. It appears -/// inside messages and tool results that reference an artifact. It references -/// durably stored bytes only -- mime is always required here because it is -/// StoredArtifact.mime carried forward, never a degraded external's -/// declared_mime (D11). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ArtifactRef { - /// Stable artifact id within the session. - /// - /// Field 1: `artifact_id` - #[serde( - rename = "artifactId", - alias = "artifact_id", - with = "::buffa::json_helpers::proto_string" - )] - pub artifact_id: ::buffa::alloc::string::String, - /// Content digest over the artifact bytes; the claim-check key (ADR#0035 facet 3). - /// Uses the shared Digest type for consistency with every other digest in the - /// package (algorithm is typically "sha256"). - /// - /// Field 2: `digest` - #[serde(rename = "digest")] - pub digest: ::buffa::MessageField>, - /// Size of the referenced bytes. - /// - /// Field 3: `size_bytes` - #[serde( - rename = "sizeBytes", - alias = "size_bytes", - with = "::buffa::json_helpers::uint64" - )] - pub size_bytes: u64, - /// IANA media type of the referenced bytes. - /// - /// Field 4: `mime` - #[serde(rename = "mime", with = "::buffa::json_helpers::proto_string")] - pub mime: ::buffa::alloc::string::String, - /// Short human-readable preview; empty when none was produced. - /// - /// Field 5: `preview` - #[serde(rename = "preview", skip_serializing_if = "::core::option::Option::is_none")] - pub preview: ::core::option::Option<::buffa::alloc::string::String>, - /// True when preview is a truncation of the full content. - /// - /// Field 6: `truncated` - #[serde( - rename = "truncated", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub truncated: ::core::option::Option, - /// Size of the content before truncation, when the referenced bytes are - /// themselves a truncation of a larger original that was never stored. Unset - /// when size_bytes already is the full size. Recorded so a reader can tell - /// "1 KB of output" from "1 KB of a 40 MB output" without fetching anything. - /// - /// Field 7: `untruncated_size_bytes` - #[serde( - rename = "untruncatedSizeBytes", - alias = "untruncated_size_bytes", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub untruncated_size_bytes: ::core::option::Option, -} -impl ::core::fmt::Debug for ArtifactRef { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ArtifactRef") - .field("artifact_id", &self.artifact_id) - .field("digest", &self.digest) - .field("size_bytes", &self.size_bytes) - .field("mime", &self.mime) - .field("preview", &self.preview) - .field("truncated", &self.truncated) - .field("untruncated_size_bytes", &self.untruncated_size_bytes) - .finish() - } -} -impl ArtifactRef { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactRef"; -} -impl ArtifactRef { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::preview`] to `Some(value)`, consuming and returning `self`. - pub fn with_preview( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.preview = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::truncated`] to `Some(value)`, consuming and returning `self`. - pub fn with_truncated(mut self, value: bool) -> Self { - self.truncated = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::untruncated_size_bytes`] to `Some(value)`, consuming and returning `self`. - pub fn with_untruncated_size_bytes(mut self, value: u64) -> Self { - self.untruncated_size_bytes = Some(value); - self - } -} -::buffa::impl_default_instance!(ArtifactRef); -impl ::buffa::MessageName for ArtifactRef { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ArtifactRef"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ArtifactRef"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactRef"; -} -impl ::buffa::Message for ArtifactRef { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - if self.digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.size_bytes) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.mime) as u64; - if let Some(ref v) = self.preview { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.truncated.is_some() { - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - } - if let Some(v) = self.untruncated_size_bytes { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.artifact_id, buf); - if self.digest.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.digest.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(3u32, self.size_bytes, buf); - ::buffa::types::put_string_field(4u32, &self.mime, buf); - if let Some(ref v) = self.preview { - ::buffa::types::put_string_field(5u32, v, buf); - } - if let Some(v) = self.truncated { - ::buffa::types::put_bool_field(6u32, v, buf); - } - if let Some(v) = self.untruncated_size_bytes { - ::buffa::types::put_uint64_field(7u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.artifact_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.size_bytes = ::buffa::types::decode_uint64(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.mime, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.preview.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.truncated = ::core::option::Option::Some( - ::buffa::types::decode_bool(buf)?, - ); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.untruncated_size_bytes = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.artifact_id.clear(); - self.digest = ::buffa::MessageField::none(); - self.size_bytes = 0u64; - self.mime.clear(); - self.preview = ::core::option::Option::None; - self.truncated = ::core::option::Option::None; - self.untruncated_size_bytes = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ArtifactRef { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ARTIFACT_REF_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactRef", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ArtifactMetadata is the claim-check record carried by ArtifactRecorded. Its -/// source arm distinguishes durably-stored bytes (addressable by sha256) from a -/// degraded external reference whose bytes were not durably stored, so required-ness is -/// expressed per branch rather than collapsed into always-required fields that a -/// degraded artifact cannot supply (ADR#0035 facet 3). Media type lives per -/// branch rather than on this envelope: StoredArtifact.mime is always required -/// (decoded/validated), ExternalArtifact.declared_mime is optional -/// (source-declared, never validated). A reader needing one effective type -/// uses stored mime, else declared_mime, else falls back to -/// "application/octet-stream" (D11). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct ArtifactMetadata { - /// Stable artifact id within the session. - /// - /// Field 1: `artifact_id` - #[serde( - rename = "artifactId", - alias = "artifact_id", - with = "::buffa::json_helpers::proto_string" - )] - pub artifact_id: ::buffa::alloc::string::String, - /// Short human-readable preview; empty when none was produced. - /// - /// Field 3: `preview` - #[serde(rename = "preview", skip_serializing_if = "::core::option::Option::is_none")] - pub preview: ::core::option::Option<::buffa::alloc::string::String>, - /// True when preview is a truncation of the full content. - /// - /// Field 4: `truncated` - #[serde( - rename = "truncated", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub truncated: ::core::option::Option, - /// Wall-clock instant the artifact record was created: a real external - /// occurrence distinct from envelope append time (D10). - /// - /// Field 5: `created_at` - #[serde(rename = "createdAt", alias = "created_at")] - pub created_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - #[serde(flatten)] - pub source: ::core::option::Option<__buffa::oneof::artifact_metadata::Source>, -} -impl ::core::fmt::Debug for ArtifactMetadata { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ArtifactMetadata") - .field("artifact_id", &self.artifact_id) - .field("preview", &self.preview) - .field("truncated", &self.truncated) - .field("created_at", &self.created_at) - .field("source", &self.source) - .finish() - } -} -impl ArtifactMetadata { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactMetadata"; -} -impl ArtifactMetadata { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::preview`] to `Some(value)`, consuming and returning `self`. - pub fn with_preview( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.preview = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::truncated`] to `Some(value)`, consuming and returning `self`. - pub fn with_truncated(mut self, value: bool) -> Self { - self.truncated = Some(value); - self - } -} -::buffa::impl_default_instance!(ArtifactMetadata); -impl ::buffa::MessageName for ArtifactMetadata { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ArtifactMetadata"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ArtifactMetadata"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactMetadata"; -} -impl ::buffa::Message for ArtifactMetadata { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - if let Some(ref v) = self.preview { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.truncated.is_some() { - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - } - if self.created_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.created_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let ::core::option::Option::Some(ref v) = self.source { - match v { - __buffa::oneof::artifact_metadata::Source::Stored(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::artifact_metadata::Source::External(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.artifact_id, buf); - if let Some(ref v) = self.preview { - ::buffa::types::put_string_field(3u32, v, buf); - } - if let Some(v) = self.truncated { - ::buffa::types::put_bool_field(4u32, v, buf); - } - if self.created_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.created_at.write_to(__cache, buf); - } - if let ::core::option::Option::Some(ref v) = self.source { - match v { - __buffa::oneof::artifact_metadata::Source::Stored(x) => { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::artifact_metadata::Source::External(x) => { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.artifact_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.preview.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.truncated = ::core::option::Option::Some( - ::buffa::types::decode_bool(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.created_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::artifact_metadata::Source::Stored(ref mut existing), - ) = self.source - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.source = ::core::option::Option::Some( - __buffa::oneof::artifact_metadata::Source::Stored( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::artifact_metadata::Source::External(ref mut existing), - ) = self.source - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.source = ::core::option::Option::Some( - __buffa::oneof::artifact_metadata::Source::External( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.artifact_id.clear(); - self.preview = ::core::option::Option::None; - self.truncated = ::core::option::Option::None; - self.created_at = ::buffa::MessageField::none(); - self.source = ::core::option::Option::None; - } -} -impl<'de> serde::Deserialize<'de> for ArtifactMetadata { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = ArtifactMetadata; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct ArtifactMetadata") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __f_artifact_id: ::core::option::Option< - ::buffa::alloc::string::String, - > = None; - let mut __f_preview: ::core::option::Option< - ::core::option::Option<::buffa::alloc::string::String>, - > = None; - let mut __f_truncated: ::core::option::Option< - ::core::option::Option, - > = None; - let mut __f_created_at: ::core::option::Option< - ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - > = None; - let mut __oneof_source: ::core::option::Option< - __buffa::oneof::artifact_metadata::Source, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "artifactId" | "artifact_id" => { - __f_artifact_id = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::alloc::string::String; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::string::String, - D::Error, - > { - ::buffa::json_helpers::proto_string::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "preview" => { - __f_preview = Some( - map - .next_value::< - ::core::option::Option<::buffa::alloc::string::String>, - >()?, - ); - } - "truncated" => { - __f_truncated = Some( - map.next_value::<::core::option::Option>()?, - ); - } - "createdAt" | "created_at" => { - __f_created_at = Some( - map - .next_value::< - ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - >()?, - ); - } - "stored" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - StoredArtifact, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_source.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'source'", - ), - ); - } - __oneof_source = Some( - __buffa::oneof::artifact_metadata::Source::Stored( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "external" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ExternalArtifact, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_source.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'source'", - ), - ); - } - __oneof_source = Some( - __buffa::oneof::artifact_metadata::Source::External( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - if let ::core::option::Option::Some(v) = __f_artifact_id { - __r.artifact_id = v; - } - if let ::core::option::Option::Some(v) = __f_preview { - __r.preview = v; - } - if let ::core::option::Option::Some(v) = __f_truncated { - __r.truncated = v; - } - if let ::core::option::Option::Some(v) = __f_created_at { - __r.created_at = v; - } - __r.source = __oneof_source; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ArtifactMetadata { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ARTIFACT_METADATA_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactMetadata", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod artifact_metadata { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::artifact_metadata::Source; - #[doc(inline)] - pub use super::__buffa::view::oneof::artifact_metadata::Source as SourceView; -} -/// StoredArtifact is the source arm for an artifact whose bytes were durably stored. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct StoredArtifact { - /// Content digest over the stored bytes; the claim-check key. - /// - /// Field 1: `digest` - #[serde(rename = "digest")] - pub digest: ::buffa::MessageField>, - /// Size of the stored bytes. - /// - /// Field 2: `size_bytes` - #[serde( - rename = "sizeBytes", - alias = "size_bytes", - with = "::buffa::json_helpers::uint64" - )] - pub size_bytes: u64, - /// External location the bytes were stored at (for example an Object Store key). - /// - /// Field 3: `storage_ref` - #[serde( - rename = "storageRef", - alias = "storage_ref", - with = "::buffa::json_helpers::proto_string" - )] - pub storage_ref: ::buffa::alloc::string::String, - /// Decoded/validated media type of the stored bytes. - /// - /// Field 4: `mime` - #[serde(rename = "mime", with = "::buffa::json_helpers::proto_string")] - pub mime: ::buffa::alloc::string::String, - /// Chunk hashing that lets a caller check part of this artifact without - /// reading all of it. Unset when the artifact was stored without one, which - /// means no range of it can be checked. - /// - /// Field 5: `chunks` - #[serde( - rename = "chunks", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub chunks: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for StoredArtifact { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("StoredArtifact") - .field("digest", &self.digest) - .field("size_bytes", &self.size_bytes) - .field("storage_ref", &self.storage_ref) - .field("mime", &self.mime) - .field("chunks", &self.chunks) - .finish() - } -} -impl StoredArtifact { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StoredArtifact"; -} -::buffa::impl_default_instance!(StoredArtifact); -impl ::buffa::MessageName for StoredArtifact { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "StoredArtifact"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.StoredArtifact"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StoredArtifact"; -} -impl ::buffa::Message for StoredArtifact { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.size_bytes) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.storage_ref) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.mime) as u64; - if self.chunks.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.chunks.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.digest.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.digest.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(2u32, self.size_bytes, buf); - ::buffa::types::put_string_field(3u32, &self.storage_ref, buf); - ::buffa::types::put_string_field(4u32, &self.mime, buf); - if self.chunks.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.chunks.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.size_bytes = ::buffa::types::decode_uint64(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.storage_ref, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.mime, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.chunks.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.digest = ::buffa::MessageField::none(); - self.size_bytes = 0u64; - self.storage_ref.clear(); - self.mime.clear(); - self.chunks = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for StoredArtifact { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __STORED_ARTIFACT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.StoredArtifact", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ExternalArtifact is the degraded source arm for an artifact whose bytes were -/// not durably stored; the source reference and optional transient fetch -/// evidence (fetched_at, content_digest) are retained. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ExternalArtifact { - /// The (un-fetchable) source location. Must be credential-free: a - /// credential-bearing URL, a signed URL, or a secret is prohibited in this - /// durable field (D7); ingress secret-scanning is a command-boundary - /// obligation. - /// - /// Field 1: `source_url` - #[serde( - rename = "sourceUrl", - alias = "source_url", - with = "::buffa::json_helpers::proto_string" - )] - pub source_url: ::buffa::alloc::string::String, - /// Source transport encoding, for example "base64"; empty when none. - /// - /// Field 2: `source_encoding` - #[serde( - rename = "sourceEncoding", - alias = "source_encoding", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub source_encoding: ::core::option::Option<::buffa::alloc::string::String>, - /// MIME as declared by the source before validation; empty when not declared. - /// - /// Field 3: `declared_mime` - #[serde( - rename = "declaredMime", - alias = "declared_mime", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub declared_mime: ::core::option::Option<::buffa::alloc::string::String>, - /// When a fetch of the source was attempted: a real external occurrence - /// distinct from envelope append time (D10); unset when not applicable. - /// - /// Field 4: `fetched_at` - #[serde( - rename = "fetchedAt", - alias = "fetched_at", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub fetched_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// Content digest computed over fetched bytes when the source was fetched - /// and hashed without being durably stored; unset otherwise. - /// - /// Field 5: `content_digest` - #[serde( - rename = "contentDigest", - alias = "content_digest", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub content_digest: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for ExternalArtifact { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ExternalArtifact") - .field("source_url", &self.source_url) - .field("source_encoding", &self.source_encoding) - .field("declared_mime", &self.declared_mime) - .field("fetched_at", &self.fetched_at) - .field("content_digest", &self.content_digest) - .finish() - } -} -impl ExternalArtifact { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExternalArtifact"; -} -impl ExternalArtifact { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::source_encoding`] to `Some(value)`, consuming and returning `self`. - pub fn with_source_encoding( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.source_encoding = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::declared_mime`] to `Some(value)`, consuming and returning `self`. - pub fn with_declared_mime( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.declared_mime = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ExternalArtifact); -impl ::buffa::MessageName for ExternalArtifact { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ExternalArtifact"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ExternalArtifact"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExternalArtifact"; -} -impl ::buffa::Message for ExternalArtifact { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.source_url) as u64; - if let Some(ref v) = self.source_encoding { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.declared_mime { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.fetched_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.fetched_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.content_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.content_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_url, buf); - if let Some(ref v) = self.source_encoding { - ::buffa::types::put_string_field(2u32, v, buf); - } - if let Some(ref v) = self.declared_mime { - ::buffa::types::put_string_field(3u32, v, buf); - } - if self.fetched_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.fetched_at.write_to(__cache, buf); - } - if self.content_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.content_digest.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.source_url, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .source_encoding - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .declared_mime - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.fetched_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.content_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.source_url.clear(); - self.source_encoding = ::core::option::Option::None; - self.declared_mime = ::core::option::Option::None; - self.fetched_at = ::buffa::MessageField::none(); - self.content_digest = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ExternalArtifact { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __EXTERNAL_ARTIFACT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExternalArtifact", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact_erased.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact_erased.__view.rs deleted file mode 100644 index d0ed93ec2..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact_erased.__view.rs +++ /dev/null @@ -1,315 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/artifact_erased.proto - -/// ArtifactErased records out-of-band destruction of claim-checked artifact -/// bytes; the artifact's digest and metadata remain on the log as provenance, -/// even though the bytes they reference are gone. This separates artifact-byte -/// lifecycle from event-log retention: the log itself is never purged, but the -/// out-of-line bytes an artifact claim-check points to may be destroyed -/// independently (D7). It is an invariant-bearing transition -/// (WRITE_PRECONDITION = At). -#[derive(Clone, Debug, Default)] -pub struct ArtifactErasedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `artifact_id` - pub artifact_id: &'a str, - /// Command-time reason for the erasure; empty when none. - /// - /// Field 3: `reason` - pub reason: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ArtifactErasedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `artifact_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ArtifactErasedView<'a> { - type Owned = super::super::ArtifactErased; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.artifact_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ArtifactErased { - session_id: self.session_id.to_string(), - artifact_id: self.artifact_id.to_string(), - reason: self.reason.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ArtifactErasedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.artifact_id, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ArtifactErasedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("artifactId", self.artifact_id)?; - } - if let ::core::option::Option::Some(__v) = self.reason { - __map.serialize_entry("reason", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ArtifactErasedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ArtifactErased"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ArtifactErased"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactErased"; -} -::buffa::impl_default_view_instance!(ArtifactErasedView); -::buffa::impl_view_reborrow!(ArtifactErasedView); -/** Self-contained, `'static` owned view of a `ArtifactErased` message. - - Wraps [`::buffa::OwnedView`]`<`[`ArtifactErasedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ArtifactErasedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ArtifactErasedOwnedView(::buffa::OwnedView>); -impl ArtifactErasedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactErasedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactErasedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ArtifactErased, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactErasedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ArtifactErasedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ArtifactErasedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ArtifactErased { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `artifact_id` - #[must_use] - pub fn artifact_id(&self) -> &'_ str { - self.0.reborrow().artifact_id - } - /// Command-time reason for the erasure; empty when none. - /// - /// Field 3: `reason` - #[must_use] - pub fn reason(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ArtifactErasedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ArtifactErasedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ArtifactErasedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ArtifactErasedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ArtifactErased { - type View<'a> = ArtifactErasedView<'a>; - type ViewHandle = ArtifactErasedOwnedView; -} -impl ::serde::Serialize for ArtifactErasedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact_erased.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact_erased.rs deleted file mode 100644 index 80885844e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact_erased.rs +++ /dev/null @@ -1,169 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/artifact_erased.proto - -/// ArtifactErased records out-of-band destruction of claim-checked artifact -/// bytes; the artifact's digest and metadata remain on the log as provenance, -/// even though the bytes they reference are gone. This separates artifact-byte -/// lifecycle from event-log retention: the log itself is never purged, but the -/// out-of-line bytes an artifact claim-check points to may be destroyed -/// independently (D7). It is an invariant-bearing transition -/// (WRITE_PRECONDITION = At). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ArtifactErased { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `artifact_id` - #[serde( - rename = "artifactId", - alias = "artifact_id", - with = "::buffa::json_helpers::proto_string" - )] - pub artifact_id: ::buffa::alloc::string::String, - /// Command-time reason for the erasure; empty when none. - /// - /// Field 3: `reason` - #[serde(rename = "reason", skip_serializing_if = "::core::option::Option::is_none")] - pub reason: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for ArtifactErased { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ArtifactErased") - .field("session_id", &self.session_id) - .field("artifact_id", &self.artifact_id) - .field("reason", &self.reason) - .finish() - } -} -impl ArtifactErased { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactErased"; -} -impl ArtifactErased { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::reason`] to `Some(value)`, consuming and returning `self`. - pub fn with_reason( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.reason = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ArtifactErased); -impl ::buffa::MessageName for ArtifactErased { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ArtifactErased"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ArtifactErased"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactErased"; -} -impl ::buffa::Message for ArtifactErased { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.artifact_id, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.artifact_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.reason.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.artifact_id.clear(); - self.reason = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ArtifactErased { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ARTIFACT_ERASED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactErased", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact_recorded.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact_recorded.__view.rs deleted file mode 100644 index dfcd184b2..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact_recorded.__view.rs +++ /dev/null @@ -1,325 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/artifact_recorded.proto - -/// ArtifactRecorded records an artifact by claim-check (sha256), never inlining -/// its bytes (ADR#0035 facet 3); a commuting happened-fact (WRITE_PRECONDITION = Any). -#[derive(Clone, Debug, Default)] -pub struct ArtifactRecordedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `artifact` - pub artifact: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactMetadataView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ArtifactRecordedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `artifact` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact(&self) -> bool { - self.artifact.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ArtifactRecordedView<'a> { - type Owned = super::super::ArtifactRecorded; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.artifact.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.artifact = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ArtifactRecorded { - session_id: self.session_id.to_string(), - artifact: match self.artifact.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactMetadata, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ArtifactRecordedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.artifact.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.artifact.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.artifact.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.artifact.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ArtifactRecordedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.artifact.as_option() { - __map.serialize_entry("artifact", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ArtifactRecordedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ArtifactRecorded"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ArtifactRecorded"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactRecorded"; -} -::buffa::impl_default_view_instance!(ArtifactRecordedView); -::buffa::impl_view_reborrow!(ArtifactRecordedView); -/** Self-contained, `'static` owned view of a `ArtifactRecorded` message. - - Wraps [`::buffa::OwnedView`]`<`[`ArtifactRecordedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ArtifactRecordedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ArtifactRecordedOwnedView(::buffa::OwnedView>); -impl ArtifactRecordedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactRecordedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactRecordedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ArtifactRecorded, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ArtifactRecordedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ArtifactRecordedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ArtifactRecordedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ArtifactRecorded { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `artifact` - #[must_use] - pub fn artifact( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactMetadataView<'_>, - > { - &self.0.reborrow().artifact - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ArtifactRecordedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ArtifactRecordedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ArtifactRecordedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ArtifactRecordedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ArtifactRecorded { - type View<'a> = ArtifactRecordedView<'a>; - type ViewHandle = ArtifactRecordedOwnedView; -} -impl ::serde::Serialize for ArtifactRecordedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact_recorded.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact_recorded.rs deleted file mode 100644 index cde16eace..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.artifact_recorded.rs +++ /dev/null @@ -1,146 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/artifact_recorded.proto - -/// ArtifactRecorded records an artifact by claim-check (sha256), never inlining -/// its bytes (ADR#0035 facet 3); a commuting happened-fact (WRITE_PRECONDITION = Any). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ArtifactRecorded { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `artifact` - #[serde(rename = "artifact")] - pub artifact: ::buffa::MessageField< - ArtifactMetadata, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for ArtifactRecorded { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ArtifactRecorded") - .field("session_id", &self.session_id) - .field("artifact", &self.artifact) - .finish() - } -} -impl ArtifactRecorded { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactRecorded"; -} -::buffa::impl_default_instance!(ArtifactRecorded); -impl ::buffa::MessageName for ArtifactRecorded { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ArtifactRecorded"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ArtifactRecorded"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactRecorded"; -} -impl ::buffa::Message for ArtifactRecorded { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.artifact.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.artifact.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.artifact.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.artifact.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.artifact.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.artifact = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ArtifactRecorded { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ARTIFACT_RECORDED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ArtifactRecorded", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_completed.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_completed.__view.rs deleted file mode 100644 index 661e213ea..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_completed.__view.rs +++ /dev/null @@ -1,437 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/assistant_message_completed.proto - -/// AssistantMessageCompleted is a durable fact carrying the full assistant message -/// in canonical form; its message id, token usage, and cost live on the embedded -/// CanonicalMessage. finish_reason records why the turn stopped, so a truncated -/// turn is distinguishable from a normal one. Per message_id, this competes with -/// AssistantMessageFailed under a first-terminal-outcome-wins fold rule: the -/// first of the two to appear in fold order is authoritative, and a later -/// conflicting outcome is retained as audit-only, surfaced by a projection -/// flag, never folded into state (D4). It is a commuting happened-fact -/// (WRITE_PRECONDITION = Any). -#[derive(Clone, Debug, Default)] -pub struct AssistantMessageCompletedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `message` - pub message: ::buffa::MessageFieldView< - super::super::__buffa::view::CanonicalMessageView<'a>, - >, - /// Field 3: `finish_reason` - pub finish_reason: ::buffa::EnumValue, - /// The stop sequence that fired, set only when finish_reason is - /// FINISH_REASON_STOP_SEQUENCE; a one-time runtime observation, empty otherwise. - /// - /// Field 4: `matched_stop_sequence` - pub matched_stop_sequence: ::core::option::Option<&'a str>, - /// Turn this generation belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 5: `turn_id` - pub turn_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> AssistantMessageCompletedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `message` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message(&self) -> bool { - self.message.is_set() - } - /**Whether required field `finish_reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_finish_reason(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for AssistantMessageCompletedView<'a> { - type Owned = super::super::AssistantMessageCompleted; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.message.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.message = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.finish_reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.matched_stop_sequence = Some(::buffa::types::borrow_str(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::AssistantMessageCompleted, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::AssistantMessageCompleted, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::AssistantMessageCompleted { - session_id: self.session_id.to_string(), - message: match self.message.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CanonicalMessage, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - finish_reason: self.finish_reason, - matched_stop_sequence: self.matched_stop_sequence.map(|s| s.to_string()), - turn_id: self.turn_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for AssistantMessageCompletedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.message.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.message.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.finish_reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.matched_stop_sequence { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.message.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.message.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.finish_reason.to_i32(), buf); - if let Some(ref v) = self.matched_stop_sequence { - ::buffa::types::put_string_field(4u32, v, buf); - } - ::buffa::types::put_string_field(5u32, &self.turn_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for AssistantMessageCompletedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.message.as_option() { - __map.serialize_entry("message", __v)?; - } - } - { - __map.serialize_entry("finishReason", &self.finish_reason)?; - } - if let ::core::option::Option::Some(__v) = self.matched_stop_sequence { - __map.serialize_entry("matchedStopSequence", __v)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for AssistantMessageCompletedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "AssistantMessageCompleted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.AssistantMessageCompleted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.AssistantMessageCompleted"; -} -::buffa::impl_default_view_instance!(AssistantMessageCompletedView); -::buffa::impl_view_reborrow!(AssistantMessageCompletedView); -/** Self-contained, `'static` owned view of a `AssistantMessageCompleted` message. - - Wraps [`::buffa::OwnedView`]`<`[`AssistantMessageCompletedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`AssistantMessageCompletedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct AssistantMessageCompletedOwnedView( - ::buffa::OwnedView>, -); -impl AssistantMessageCompletedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AssistantMessageCompletedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AssistantMessageCompletedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::AssistantMessageCompleted, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AssistantMessageCompletedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`AssistantMessageCompletedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &AssistantMessageCompletedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::AssistantMessageCompleted { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `message` - #[must_use] - pub fn message( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CanonicalMessageView<'_>, - > { - &self.0.reborrow().message - } - /// Field 3: `finish_reason` - #[must_use] - pub fn finish_reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().finish_reason - } - /// The stop sequence that fired, set only when finish_reason is - /// FINISH_REASON_STOP_SEQUENCE; a one-time runtime observation, empty otherwise. - /// - /// Field 4: `matched_stop_sequence` - #[must_use] - pub fn matched_stop_sequence(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().matched_stop_sequence - } - /// Turn this generation belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 5: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for AssistantMessageCompletedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - AssistantMessageCompletedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: AssistantMessageCompletedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for AssistantMessageCompletedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::AssistantMessageCompleted { - type View<'a> = AssistantMessageCompletedView<'a>; - type ViewHandle = AssistantMessageCompletedOwnedView; -} -impl ::serde::Serialize for AssistantMessageCompletedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_completed.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_completed.rs deleted file mode 100644 index ff28426c4..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_completed.rs +++ /dev/null @@ -1,446 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/assistant_message_completed.proto - -/// FinishReason is why a completed assistant turn stopped generating. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum FinishReason { - FINISH_REASON_UNSPECIFIED = 0i32, - /// Model ended its turn normally. - FINISH_REASON_END_TURN = 1i32, - /// Output stopped at the max-tokens limit. - FINISH_REASON_MAX_TOKENS = 2i32, - /// Model stopped to invoke a tool. - FINISH_REASON_TOOL_USE = 3i32, - /// Output stopped at a configured stop sequence. - FINISH_REASON_STOP_SEQUENCE = 4i32, - /// Output stopped by a content filter. - FINISH_REASON_CONTENT_FILTER = 5i32, - /// Resumable server-side pause of a tool loop (e.g. Claude pause_turn). - FINISH_REASON_PAUSE_TURN = 6i32, - /// Model declined to respond on safety grounds (e.g. Claude refusal). - FINISH_REASON_REFUSAL = 7i32, -} -impl FinishReason { - ///Idiomatic alias for [`Self::FINISH_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::FINISH_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::FINISH_REASON_END_TURN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const EndTurn: Self = Self::FINISH_REASON_END_TURN; - ///Idiomatic alias for [`Self::FINISH_REASON_MAX_TOKENS`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const MaxTokens: Self = Self::FINISH_REASON_MAX_TOKENS; - ///Idiomatic alias for [`Self::FINISH_REASON_TOOL_USE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ToolUse: Self = Self::FINISH_REASON_TOOL_USE; - ///Idiomatic alias for [`Self::FINISH_REASON_STOP_SEQUENCE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const StopSequence: Self = Self::FINISH_REASON_STOP_SEQUENCE; - ///Idiomatic alias for [`Self::FINISH_REASON_CONTENT_FILTER`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ContentFilter: Self = Self::FINISH_REASON_CONTENT_FILTER; - ///Idiomatic alias for [`Self::FINISH_REASON_PAUSE_TURN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const PauseTurn: Self = Self::FINISH_REASON_PAUSE_TURN; - ///Idiomatic alias for [`Self::FINISH_REASON_REFUSAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Refusal: Self = Self::FINISH_REASON_REFUSAL; -} -impl ::core::default::Default for FinishReason { - fn default() -> Self { - Self::FINISH_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for FinishReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for FinishReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = FinishReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(FinishReason)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for FinishReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for FinishReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::FINISH_REASON_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::FINISH_REASON_END_TURN), - 2i32 => ::core::option::Option::Some(Self::FINISH_REASON_MAX_TOKENS), - 3i32 => ::core::option::Option::Some(Self::FINISH_REASON_TOOL_USE), - 4i32 => ::core::option::Option::Some(Self::FINISH_REASON_STOP_SEQUENCE), - 5i32 => ::core::option::Option::Some(Self::FINISH_REASON_CONTENT_FILTER), - 6i32 => ::core::option::Option::Some(Self::FINISH_REASON_PAUSE_TURN), - 7i32 => ::core::option::Option::Some(Self::FINISH_REASON_REFUSAL), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::FINISH_REASON_UNSPECIFIED => "FINISH_REASON_UNSPECIFIED", - Self::FINISH_REASON_END_TURN => "FINISH_REASON_END_TURN", - Self::FINISH_REASON_MAX_TOKENS => "FINISH_REASON_MAX_TOKENS", - Self::FINISH_REASON_TOOL_USE => "FINISH_REASON_TOOL_USE", - Self::FINISH_REASON_STOP_SEQUENCE => "FINISH_REASON_STOP_SEQUENCE", - Self::FINISH_REASON_CONTENT_FILTER => "FINISH_REASON_CONTENT_FILTER", - Self::FINISH_REASON_PAUSE_TURN => "FINISH_REASON_PAUSE_TURN", - Self::FINISH_REASON_REFUSAL => "FINISH_REASON_REFUSAL", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "FINISH_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::FINISH_REASON_UNSPECIFIED) - } - "FINISH_REASON_END_TURN" => { - ::core::option::Option::Some(Self::FINISH_REASON_END_TURN) - } - "FINISH_REASON_MAX_TOKENS" => { - ::core::option::Option::Some(Self::FINISH_REASON_MAX_TOKENS) - } - "FINISH_REASON_TOOL_USE" => { - ::core::option::Option::Some(Self::FINISH_REASON_TOOL_USE) - } - "FINISH_REASON_STOP_SEQUENCE" => { - ::core::option::Option::Some(Self::FINISH_REASON_STOP_SEQUENCE) - } - "FINISH_REASON_CONTENT_FILTER" => { - ::core::option::Option::Some(Self::FINISH_REASON_CONTENT_FILTER) - } - "FINISH_REASON_PAUSE_TURN" => { - ::core::option::Option::Some(Self::FINISH_REASON_PAUSE_TURN) - } - "FINISH_REASON_REFUSAL" => { - ::core::option::Option::Some(Self::FINISH_REASON_REFUSAL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::FINISH_REASON_UNSPECIFIED, - Self::FINISH_REASON_END_TURN, - Self::FINISH_REASON_MAX_TOKENS, - Self::FINISH_REASON_TOOL_USE, - Self::FINISH_REASON_STOP_SEQUENCE, - Self::FINISH_REASON_CONTENT_FILTER, - Self::FINISH_REASON_PAUSE_TURN, - Self::FINISH_REASON_REFUSAL, - ] - } -} -/// AssistantMessageCompleted is a durable fact carrying the full assistant message -/// in canonical form; its message id, token usage, and cost live on the embedded -/// CanonicalMessage. finish_reason records why the turn stopped, so a truncated -/// turn is distinguishable from a normal one. Per message_id, this competes with -/// AssistantMessageFailed under a first-terminal-outcome-wins fold rule: the -/// first of the two to appear in fold order is authoritative, and a later -/// conflicting outcome is retained as audit-only, surfaced by a projection -/// flag, never folded into state (D4). It is a commuting happened-fact -/// (WRITE_PRECONDITION = Any). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct AssistantMessageCompleted { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `message` - #[serde(rename = "message")] - pub message: ::buffa::MessageField< - CanonicalMessage, - ::buffa::Inline, - >, - /// Field 3: `finish_reason` - #[serde( - rename = "finishReason", - alias = "finish_reason", - with = "::buffa::json_helpers::proto_enum" - )] - pub finish_reason: ::buffa::EnumValue, - /// The stop sequence that fired, set only when finish_reason is - /// FINISH_REASON_STOP_SEQUENCE; a one-time runtime observation, empty otherwise. - /// - /// Field 4: `matched_stop_sequence` - #[serde( - rename = "matchedStopSequence", - alias = "matched_stop_sequence", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub matched_stop_sequence: ::core::option::Option<::buffa::alloc::string::String>, - /// Turn this generation belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 5: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for AssistantMessageCompleted { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("AssistantMessageCompleted") - .field("session_id", &self.session_id) - .field("message", &self.message) - .field("finish_reason", &self.finish_reason) - .field("matched_stop_sequence", &self.matched_stop_sequence) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl AssistantMessageCompleted { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.AssistantMessageCompleted"; -} -impl AssistantMessageCompleted { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::matched_stop_sequence`] to `Some(value)`, consuming and returning `self`. - pub fn with_matched_stop_sequence( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.matched_stop_sequence = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(AssistantMessageCompleted); -impl ::buffa::MessageName for AssistantMessageCompleted { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "AssistantMessageCompleted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.AssistantMessageCompleted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.AssistantMessageCompleted"; -} -impl ::buffa::Message for AssistantMessageCompleted { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.message.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.message.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.finish_reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.matched_stop_sequence { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.message.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.message.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.finish_reason.to_i32(), buf); - if let Some(ref v) = self.matched_stop_sequence { - ::buffa::types::put_string_field(4u32, v, buf); - } - ::buffa::types::put_string_field(5u32, &self.turn_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.message.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.finish_reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .matched_stop_sequence - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.message = ::buffa::MessageField::none(); - self.finish_reason = ::buffa::EnumValue::from(0); - self.matched_stop_sequence = ::core::option::Option::None; - self.turn_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for AssistantMessageCompleted { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ASSISTANT_MESSAGE_COMPLETED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.AssistantMessageCompleted", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_failed.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_failed.__view.rs deleted file mode 100644 index ea6a51b00..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_failed.__view.rs +++ /dev/null @@ -1,469 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/assistant_message_failed.proto - -/// AssistantMessageFailed records that an assistant turn did not complete -/// normally -- interrupted by user steering, cancelled, or errored -- so every -/// AssistantMessageStarted has a determinable outcome (AssistantMessageCompleted -/// or this), mirroring the tool lifecycle's Completed/Failed. Per message_id, -/// this competes with AssistantMessageCompleted under a -/// first-terminal-outcome-wins fold rule: the first of the two to appear in -/// fold order is authoritative, and a later conflicting outcome is retained as -/// audit-only, surfaced by a projection flag, never folded into state (D4). It -/// deliberately carries no model field: the model is recorded once on -/// AssistantMessageStarted and joined by message_id (ADR#0024's -/// record-a-fact-once rule); only AssistantMessageCompleted repeats the model, -/// inside its provider-visible CanonicalMessage, where id/model agreement with -/// the start is validated. It is a commuting happened-fact -/// (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, Debug, Default)] -pub struct AssistantMessageFailedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `message_id` - pub message_id: &'a str, - /// Field 3: `reason` - pub reason: ::buffa::EnumValue, - /// Human-readable detail; empty when none. - /// - /// Field 4: `detail` - pub detail: ::core::option::Option<&'a str>, - /// Token accounting and cost billed for the partial turn; unset when the - /// provider reported none. Recorded so a cost fold does not undercount tokens - /// consumed by a turn that failed mid-generation. - /// - /// Field 5: `usage` - pub usage: ::buffa::MessageFieldView< - super::super::__buffa::view::TokenUsageView<'a>, - >, - /// Turn this generation belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 6: `turn_id` - pub turn_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> AssistantMessageFailedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `message_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for AssistantMessageFailedView<'a> { - type Owned = super::super::AssistantMessageFailed; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.message_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.usage.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.usage = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::AssistantMessageFailed, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::AssistantMessageFailed, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::AssistantMessageFailed { - session_id: self.session_id.to_string(), - message_id: self.message_id.to_string(), - reason: self.reason, - detail: self.detail.map(|s| s.to_string()), - usage: match self.usage.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::TokenUsage, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - turn_id: self.turn_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for AssistantMessageFailedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.usage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.usage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.message_id, buf); - ::buffa::types::put_int32_field(3u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.usage.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.usage.write_to(__cache, buf); - } - ::buffa::types::put_string_field(6u32, &self.turn_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for AssistantMessageFailedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("messageId", self.message_id)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.usage.as_option() { - __map.serialize_entry("usage", __v)?; - } - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for AssistantMessageFailedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "AssistantMessageFailed"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.AssistantMessageFailed"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.AssistantMessageFailed"; -} -::buffa::impl_default_view_instance!(AssistantMessageFailedView); -::buffa::impl_view_reborrow!(AssistantMessageFailedView); -/** Self-contained, `'static` owned view of a `AssistantMessageFailed` message. - - Wraps [`::buffa::OwnedView`]`<`[`AssistantMessageFailedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`AssistantMessageFailedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct AssistantMessageFailedOwnedView( - ::buffa::OwnedView>, -); -impl AssistantMessageFailedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AssistantMessageFailedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AssistantMessageFailedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::AssistantMessageFailed, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AssistantMessageFailedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`AssistantMessageFailedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &AssistantMessageFailedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::AssistantMessageFailed { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `message_id` - #[must_use] - pub fn message_id(&self) -> &'_ str { - self.0.reborrow().message_id - } - /// Field 3: `reason` - #[must_use] - pub fn reason( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// Human-readable detail; empty when none. - /// - /// Field 4: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } - /// Token accounting and cost billed for the partial turn; unset when the - /// provider reported none. Recorded so a cost fold does not undercount tokens - /// consumed by a turn that failed mid-generation. - /// - /// Field 5: `usage` - #[must_use] - pub fn usage( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().usage - } - /// Turn this generation belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 6: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for AssistantMessageFailedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - AssistantMessageFailedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: AssistantMessageFailedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for AssistantMessageFailedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::AssistantMessageFailed { - type View<'a> = AssistantMessageFailedView<'a>; - type ViewHandle = AssistantMessageFailedOwnedView; -} -impl ::serde::Serialize for AssistantMessageFailedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_failed.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_failed.rs deleted file mode 100644 index 455d858a8..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_failed.rs +++ /dev/null @@ -1,475 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/assistant_message_failed.proto - -/// AssistantMessageFailureReason is why an assistant turn did not complete. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum AssistantMessageFailureReason { - ASSISTANT_MESSAGE_FAILURE_REASON_UNSPECIFIED = 0i32, - /// Cut off by user steering mid-turn. - ASSISTANT_MESSAGE_FAILURE_REASON_INTERRUPTED = 1i32, - /// Cancelled by an explicit cancellation intent. - ASSISTANT_MESSAGE_FAILURE_REASON_CANCELLED = 2i32, - /// Failed with a provider or runtime error. - ASSISTANT_MESSAGE_FAILURE_REASON_ERROR = 3i32, - /// Generation hung and exceeded its time budget (parity with - /// ToolCallFailureReason.TIMEOUT). - ASSISTANT_MESSAGE_FAILURE_REASON_TIMEOUT = 4i32, -} -impl AssistantMessageFailureReason { - ///Idiomatic alias for [`Self::ASSISTANT_MESSAGE_FAILURE_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::ASSISTANT_MESSAGE_FAILURE_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::ASSISTANT_MESSAGE_FAILURE_REASON_INTERRUPTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Interrupted: Self = Self::ASSISTANT_MESSAGE_FAILURE_REASON_INTERRUPTED; - ///Idiomatic alias for [`Self::ASSISTANT_MESSAGE_FAILURE_REASON_CANCELLED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Cancelled: Self = Self::ASSISTANT_MESSAGE_FAILURE_REASON_CANCELLED; - ///Idiomatic alias for [`Self::ASSISTANT_MESSAGE_FAILURE_REASON_ERROR`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Error: Self = Self::ASSISTANT_MESSAGE_FAILURE_REASON_ERROR; - ///Idiomatic alias for [`Self::ASSISTANT_MESSAGE_FAILURE_REASON_TIMEOUT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Timeout: Self = Self::ASSISTANT_MESSAGE_FAILURE_REASON_TIMEOUT; -} -impl ::core::default::Default for AssistantMessageFailureReason { - fn default() -> Self { - Self::ASSISTANT_MESSAGE_FAILURE_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for AssistantMessageFailureReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for AssistantMessageFailureReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = AssistantMessageFailureReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(AssistantMessageFailureReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name( - v, - ) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for AssistantMessageFailureReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for AssistantMessageFailureReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some( - Self::ASSISTANT_MESSAGE_FAILURE_REASON_UNSPECIFIED, - ) - } - 1i32 => { - ::core::option::Option::Some( - Self::ASSISTANT_MESSAGE_FAILURE_REASON_INTERRUPTED, - ) - } - 2i32 => { - ::core::option::Option::Some( - Self::ASSISTANT_MESSAGE_FAILURE_REASON_CANCELLED, - ) - } - 3i32 => { - ::core::option::Option::Some( - Self::ASSISTANT_MESSAGE_FAILURE_REASON_ERROR, - ) - } - 4i32 => { - ::core::option::Option::Some( - Self::ASSISTANT_MESSAGE_FAILURE_REASON_TIMEOUT, - ) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::ASSISTANT_MESSAGE_FAILURE_REASON_UNSPECIFIED => { - "ASSISTANT_MESSAGE_FAILURE_REASON_UNSPECIFIED" - } - Self::ASSISTANT_MESSAGE_FAILURE_REASON_INTERRUPTED => { - "ASSISTANT_MESSAGE_FAILURE_REASON_INTERRUPTED" - } - Self::ASSISTANT_MESSAGE_FAILURE_REASON_CANCELLED => { - "ASSISTANT_MESSAGE_FAILURE_REASON_CANCELLED" - } - Self::ASSISTANT_MESSAGE_FAILURE_REASON_ERROR => { - "ASSISTANT_MESSAGE_FAILURE_REASON_ERROR" - } - Self::ASSISTANT_MESSAGE_FAILURE_REASON_TIMEOUT => { - "ASSISTANT_MESSAGE_FAILURE_REASON_TIMEOUT" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "ASSISTANT_MESSAGE_FAILURE_REASON_UNSPECIFIED" => { - ::core::option::Option::Some( - Self::ASSISTANT_MESSAGE_FAILURE_REASON_UNSPECIFIED, - ) - } - "ASSISTANT_MESSAGE_FAILURE_REASON_INTERRUPTED" => { - ::core::option::Option::Some( - Self::ASSISTANT_MESSAGE_FAILURE_REASON_INTERRUPTED, - ) - } - "ASSISTANT_MESSAGE_FAILURE_REASON_CANCELLED" => { - ::core::option::Option::Some( - Self::ASSISTANT_MESSAGE_FAILURE_REASON_CANCELLED, - ) - } - "ASSISTANT_MESSAGE_FAILURE_REASON_ERROR" => { - ::core::option::Option::Some( - Self::ASSISTANT_MESSAGE_FAILURE_REASON_ERROR, - ) - } - "ASSISTANT_MESSAGE_FAILURE_REASON_TIMEOUT" => { - ::core::option::Option::Some( - Self::ASSISTANT_MESSAGE_FAILURE_REASON_TIMEOUT, - ) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::ASSISTANT_MESSAGE_FAILURE_REASON_UNSPECIFIED, - Self::ASSISTANT_MESSAGE_FAILURE_REASON_INTERRUPTED, - Self::ASSISTANT_MESSAGE_FAILURE_REASON_CANCELLED, - Self::ASSISTANT_MESSAGE_FAILURE_REASON_ERROR, - Self::ASSISTANT_MESSAGE_FAILURE_REASON_TIMEOUT, - ] - } -} -/// AssistantMessageFailed records that an assistant turn did not complete -/// normally -- interrupted by user steering, cancelled, or errored -- so every -/// AssistantMessageStarted has a determinable outcome (AssistantMessageCompleted -/// or this), mirroring the tool lifecycle's Completed/Failed. Per message_id, -/// this competes with AssistantMessageCompleted under a -/// first-terminal-outcome-wins fold rule: the first of the two to appear in -/// fold order is authoritative, and a later conflicting outcome is retained as -/// audit-only, surfaced by a projection flag, never folded into state (D4). It -/// deliberately carries no model field: the model is recorded once on -/// AssistantMessageStarted and joined by message_id (ADR#0024's -/// record-a-fact-once rule); only AssistantMessageCompleted repeats the model, -/// inside its provider-visible CanonicalMessage, where id/model agreement with -/// the start is validated. It is a commuting happened-fact -/// (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct AssistantMessageFailed { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `message_id` - #[serde( - rename = "messageId", - alias = "message_id", - with = "::buffa::json_helpers::proto_string" - )] - pub message_id: ::buffa::alloc::string::String, - /// Field 3: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// Human-readable detail; empty when none. - /// - /// Field 4: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, - /// Token accounting and cost billed for the partial turn; unset when the - /// provider reported none. Recorded so a cost fold does not undercount tokens - /// consumed by a turn that failed mid-generation. - /// - /// Field 5: `usage` - #[serde( - rename = "usage", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub usage: ::buffa::MessageField>, - /// Turn this generation belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 6: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for AssistantMessageFailed { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("AssistantMessageFailed") - .field("session_id", &self.session_id) - .field("message_id", &self.message_id) - .field("reason", &self.reason) - .field("detail", &self.detail) - .field("usage", &self.usage) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl AssistantMessageFailed { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.AssistantMessageFailed"; -} -impl AssistantMessageFailed { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(AssistantMessageFailed); -impl ::buffa::MessageName for AssistantMessageFailed { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "AssistantMessageFailed"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.AssistantMessageFailed"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.AssistantMessageFailed"; -} -impl ::buffa::Message for AssistantMessageFailed { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.usage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.usage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.message_id, buf); - ::buffa::types::put_int32_field(3u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.usage.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.usage.write_to(__cache, buf); - } - ::buffa::types::put_string_field(6u32, &self.turn_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.message_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.usage.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.message_id.clear(); - self.reason = ::buffa::EnumValue::from(0); - self.detail = ::core::option::Option::None; - self.usage = ::buffa::MessageField::none(); - self.turn_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for AssistantMessageFailed { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ASSISTANT_MESSAGE_FAILED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.AssistantMessageFailed", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_started.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_started.__view.rs deleted file mode 100644 index e84b5d98e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_started.__view.rs +++ /dev/null @@ -1,428 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/assistant_message_started.proto - -/// AssistantMessageStarted is a coarse durable fact that an assistant turn -/// began; streamed token deltas are delivered out of band and never appended -/// per token. It is a commuting happened-fact (WRITE_PRECONDITION = Any, -/// ADR#0035 facet 2). -#[derive(Clone, Debug, Default)] -pub struct AssistantMessageStartedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `message_id` - pub message_id: &'a str, - /// Field 3: `model` - pub model: &'a str, - /// Turn this generation belongs to (see UserMessageRecorded.turn_id). Several - /// assistant messages share one turn whenever the turn ran a tool loop. - /// - /// Field 4: `turn_id` - pub turn_id: &'a str, - /// Sampling configuration this generation ran with; unset when every setting - /// was left at the provider default. Recorded beside model for the same reason - /// model is recorded here rather than looked up: a replay must reproduce the - /// request that was made, not the request today's defaults would produce. - /// - /// Field 5: `settings` - pub settings: ::buffa::MessageFieldView< - super::super::__buffa::view::ModelSettingsView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> AssistantMessageStartedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `message_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `model` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_model(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for AssistantMessageStartedView<'a> { - type Owned = super::super::AssistantMessageStarted; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.message_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.model = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.settings.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.settings = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::AssistantMessageStarted, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::AssistantMessageStarted, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::AssistantMessageStarted { - session_id: self.session_id.to_string(), - message_id: self.message_id.to_string(), - model: self.model.to_string(), - turn_id: self.turn_id.to_string(), - settings: match self.settings.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ModelSettings, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for AssistantMessageStartedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.model) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if self.settings.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.settings.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.message_id, buf); - ::buffa::types::put_string_field(3u32, &self.model, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - if self.settings.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.settings.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for AssistantMessageStartedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("messageId", self.message_id)?; - } - { - __map.serialize_entry("model", self.model)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.settings.as_option() { - __map.serialize_entry("settings", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for AssistantMessageStartedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "AssistantMessageStarted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.AssistantMessageStarted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.AssistantMessageStarted"; -} -::buffa::impl_default_view_instance!(AssistantMessageStartedView); -::buffa::impl_view_reborrow!(AssistantMessageStartedView); -/** Self-contained, `'static` owned view of a `AssistantMessageStarted` message. - - Wraps [`::buffa::OwnedView`]`<`[`AssistantMessageStartedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`AssistantMessageStartedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct AssistantMessageStartedOwnedView( - ::buffa::OwnedView>, -); -impl AssistantMessageStartedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AssistantMessageStartedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AssistantMessageStartedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::AssistantMessageStarted, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - AssistantMessageStartedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`AssistantMessageStartedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &AssistantMessageStartedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::AssistantMessageStarted { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `message_id` - #[must_use] - pub fn message_id(&self) -> &'_ str { - self.0.reborrow().message_id - } - /// Field 3: `model` - #[must_use] - pub fn model(&self) -> &'_ str { - self.0.reborrow().model - } - /// Turn this generation belongs to (see UserMessageRecorded.turn_id). Several - /// assistant messages share one turn whenever the turn ran a tool loop. - /// - /// Field 4: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } - /// Sampling configuration this generation ran with; unset when every setting - /// was left at the provider default. Recorded beside model for the same reason - /// model is recorded here rather than looked up: a replay must reproduce the - /// request that was made, not the request today's defaults would produce. - /// - /// Field 5: `settings` - #[must_use] - pub fn settings( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().settings - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for AssistantMessageStartedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - AssistantMessageStartedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: AssistantMessageStartedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for AssistantMessageStartedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::AssistantMessageStarted { - type View<'a> = AssistantMessageStartedView<'a>; - type ViewHandle = AssistantMessageStartedOwnedView; -} -impl ::serde::Serialize for AssistantMessageStartedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_started.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_started.rs deleted file mode 100644 index df3432952..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.assistant_message_started.rs +++ /dev/null @@ -1,206 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/assistant_message_started.proto - -/// AssistantMessageStarted is a coarse durable fact that an assistant turn -/// began; streamed token deltas are delivered out of band and never appended -/// per token. It is a commuting happened-fact (WRITE_PRECONDITION = Any, -/// ADR#0035 facet 2). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct AssistantMessageStarted { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `message_id` - #[serde( - rename = "messageId", - alias = "message_id", - with = "::buffa::json_helpers::proto_string" - )] - pub message_id: ::buffa::alloc::string::String, - /// Field 3: `model` - #[serde(rename = "model", with = "::buffa::json_helpers::proto_string")] - pub model: ::buffa::alloc::string::String, - /// Turn this generation belongs to (see UserMessageRecorded.turn_id). Several - /// assistant messages share one turn whenever the turn ran a tool loop. - /// - /// Field 4: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, - /// Sampling configuration this generation ran with; unset when every setting - /// was left at the provider default. Recorded beside model for the same reason - /// model is recorded here rather than looked up: a replay must reproduce the - /// request that was made, not the request today's defaults would produce. - /// - /// Field 5: `settings` - #[serde( - rename = "settings", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub settings: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for AssistantMessageStarted { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("AssistantMessageStarted") - .field("session_id", &self.session_id) - .field("message_id", &self.message_id) - .field("model", &self.model) - .field("turn_id", &self.turn_id) - .field("settings", &self.settings) - .finish() - } -} -impl AssistantMessageStarted { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.AssistantMessageStarted"; -} -::buffa::impl_default_instance!(AssistantMessageStarted); -impl ::buffa::MessageName for AssistantMessageStarted { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "AssistantMessageStarted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.AssistantMessageStarted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.AssistantMessageStarted"; -} -impl ::buffa::Message for AssistantMessageStarted { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.model) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if self.settings.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.settings.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.message_id, buf); - ::buffa::types::put_string_field(3u32, &self.model, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - if self.settings.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.settings.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.message_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.model, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.settings.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.message_id.clear(); - self.model.clear(); - self.turn_id.clear(); - self.settings = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for AssistantMessageStarted { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ASSISTANT_MESSAGE_STARTED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.AssistantMessageStarted", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.cancel_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.cancel_session.__view.rs deleted file mode 100644 index 27abc7907..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.cancel_session.__view.rs +++ /dev/null @@ -1,310 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/cancel_session.proto - -/// CancelSession seals a session as cancelled, recording \[SessionCancelled\]. -/// -/// Write precondition At: rejected if the session is already terminal. -#[derive(Clone, Debug, Default)] -pub struct CancelSessionView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `reason` - pub reason: ::buffa::EnumValue, - /// Field 3: `detail` - pub detail: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CancelSessionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for CancelSessionView<'a> { - type Owned = super::super::CancelSession; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CancelSession { - session_id: self.session_id.to_string(), - reason: self.reason, - detail: self.detail.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CancelSessionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CancelSessionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CancelSessionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CancelSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CancelSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CancelSession"; -} -::buffa::impl_default_view_instance!(CancelSessionView); -::buffa::impl_view_reborrow!(CancelSessionView); -/** Self-contained, `'static` owned view of a `CancelSession` message. - - Wraps [`::buffa::OwnedView`]`<`[`CancelSessionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CancelSessionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CancelSessionOwnedView(::buffa::OwnedView>); -impl CancelSessionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CancelSessionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CancelSessionOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CancelSession, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CancelSessionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CancelSessionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CancelSessionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CancelSession { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// Field 3: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CancelSessionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CancelSessionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CancelSessionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CancelSessionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CancelSession { - type View<'a> = CancelSessionView<'a>; - type ViewHandle = CancelSessionOwnedView; -} -impl ::serde::Serialize for CancelSessionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.cancel_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.cancel_session.rs deleted file mode 100644 index ece783c73..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.cancel_session.rs +++ /dev/null @@ -1,164 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/cancel_session.proto - -/// CancelSession seals a session as cancelled, recording \[SessionCancelled\]. -/// -/// Write precondition At: rejected if the session is already terminal. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CancelSession { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// Field 3: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for CancelSession { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CancelSession") - .field("session_id", &self.session_id) - .field("reason", &self.reason) - .field("detail", &self.detail) - .finish() - } -} -impl CancelSession { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CancelSession"; -} -impl CancelSession { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(CancelSession); -impl ::buffa::MessageName for CancelSession { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CancelSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CancelSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CancelSession"; -} -impl ::buffa::Message for CancelSession { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.reason = ::buffa::EnumValue::from(0); - self.detail = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for CancelSession { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CANCEL_SESSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CancelSession", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.cascade_policy.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.cascade_policy.rs deleted file mode 100644 index d0c43b943..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.cascade_policy.rs +++ /dev/null @@ -1,168 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/cascade_policy.proto - -/// CascadePolicy records what happens to a child session when its parent reaches a -/// terminal state. Making both outcomes an explicit, recorded fact closes the -/// industry-wide silent-orphan gap (ADR#0035 facet 6). -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum CascadePolicy { - CASCADE_POLICY_UNSPECIFIED = 0i32, - /// Safe default: the child session is cancelled when the parent reaches a terminal - /// state, reconciled by the child session reconciler process manager. - CASCADE_POLICY_CASCADE_ON_PARENT_TERMINAL = 1i32, - /// Intentional, recorded orphan: the child session keeps running independently of the - /// parent's terminal state. - CASCADE_POLICY_INDEPENDENT = 2i32, -} -impl CascadePolicy { - ///Idiomatic alias for [`Self::CASCADE_POLICY_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::CASCADE_POLICY_UNSPECIFIED; - ///Idiomatic alias for [`Self::CASCADE_POLICY_CASCADE_ON_PARENT_TERMINAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const CascadeOnParentTerminal: Self = Self::CASCADE_POLICY_CASCADE_ON_PARENT_TERMINAL; - ///Idiomatic alias for [`Self::CASCADE_POLICY_INDEPENDENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Independent: Self = Self::CASCADE_POLICY_INDEPENDENT; -} -impl ::core::default::Default for CascadePolicy { - fn default() -> Self { - Self::CASCADE_POLICY_UNSPECIFIED - } -} -impl ::serde::Serialize for CascadePolicy { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for CascadePolicy { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = CascadePolicy; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(CascadePolicy)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for CascadePolicy { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for CascadePolicy { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::CASCADE_POLICY_UNSPECIFIED), - 1i32 => { - ::core::option::Option::Some( - Self::CASCADE_POLICY_CASCADE_ON_PARENT_TERMINAL, - ) - } - 2i32 => ::core::option::Option::Some(Self::CASCADE_POLICY_INDEPENDENT), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::CASCADE_POLICY_UNSPECIFIED => "CASCADE_POLICY_UNSPECIFIED", - Self::CASCADE_POLICY_CASCADE_ON_PARENT_TERMINAL => { - "CASCADE_POLICY_CASCADE_ON_PARENT_TERMINAL" - } - Self::CASCADE_POLICY_INDEPENDENT => "CASCADE_POLICY_INDEPENDENT", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "CASCADE_POLICY_UNSPECIFIED" => { - ::core::option::Option::Some(Self::CASCADE_POLICY_UNSPECIFIED) - } - "CASCADE_POLICY_CASCADE_ON_PARENT_TERMINAL" => { - ::core::option::Option::Some( - Self::CASCADE_POLICY_CASCADE_ON_PARENT_TERMINAL, - ) - } - "CASCADE_POLICY_INDEPENDENT" => { - ::core::option::Option::Some(Self::CASCADE_POLICY_INDEPENDENT) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::CASCADE_POLICY_UNSPECIFIED, - Self::CASCADE_POLICY_CASCADE_ON_PARENT_TERMINAL, - Self::CASCADE_POLICY_INDEPENDENT, - ] - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.checkpoint.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.checkpoint.__view.rs deleted file mode 100644 index 354779984..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.checkpoint.__view.rs +++ /dev/null @@ -1,856 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/checkpoint.proto - -/// Checkpoint is a self-describing, out-of-line durable checkpoint: a reference -/// plus a content digest and the implementation version that wrote it, never -/// inline bytes (ADR#0031 §3, §6). It is produced by CheckpointProduced and -/// restored via ExecutionAttemptStarted.restored_checkpoint, where it is -/// deliberately embedded rather than referenced: it is attempt evidence of -/// exactly what was restored, digest-verified, and now joined unambiguously to -/// its producing event via checkpoint_id. Per-event validation requires a -/// restored checkpoint's plan digest to match its ExecutionAttemptStarted plan -/// digest; the aggregate binds that digest to the session's stored plan. -/// Admission additionally verifies the supervisor capture attestation and the -/// effective-history digest (ADR#0031 §3) before CheckpointProduced is -/// recorded, and restoration re-verifies the same proof before trusting bytes. -#[derive(Clone, Debug, Default)] -pub struct CheckpointView<'a> { - /// Locator for the checkpoint artifact stored out of line. - /// - /// Field 1: `reference` - pub reference: &'a str, - /// Opaque, implementation-defined checkpoint type. - /// - /// Field 2: `checkpoint_type` - pub checkpoint_type: &'a str, - /// Digest over the checkpoint bytes, verified before restore. - /// - /// Field 3: `digest` - pub digest: ::buffa::MessageFieldView>, - /// Implementation version that wrote the checkpoint. - /// - /// Field 4: `implementation_version` - pub implementation_version: &'a str, - /// Stable checkpoint id, joining a restore back to its producing - /// CheckpointProduced event unambiguously. - /// - /// Field 5: `checkpoint_id` - pub checkpoint_id: &'a str, - /// The execution attempt that produced this checkpoint. - /// - /// Field 6: `producing_execution_attempt_id` - pub producing_execution_attempt_id: &'a str, - /// This session's own fold-derived ordinal the checkpoint's state is current - /// through, so a restore resolves to a checkpoint deterministically rather - /// than by guessing which checkpoint covers a given position. - /// - /// Field 7: `covers_through` - pub covers_through: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Digest of the session's StoredSessionExecutionPlan at checkpoint time; - /// validated against the session's plan digest before restore. - /// - /// Field 8: `session_execution_plan_digest` - pub session_execution_plan_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Locator for the capture attestation stored out of line: the producing - /// attempt's platform-controlled supervisor binds the artifact, attempt, - /// plan digest, covers_through, and effective_history_digest under that - /// attempt's confirmation key (ADR#0031 §3). - /// - /// Field 9: `capture_attestation_ref` - pub capture_attestation_ref: &'a str, - /// Digest over the capture attestation bytes, verified at admission and - /// re-verified before restore. - /// - /// Field 10: `capture_attestation_digest` - pub capture_attestation_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Digest over the harness-relevant effective session facts, in fold order, - /// through covers_through; admission recomputes it from authoritative - /// history and requires equality with the attested value (ADR#0031 §3). - /// - /// Field 11: `effective_history_digest` - pub effective_history_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CheckpointView<'a> { - /**Whether required field `reference` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reference(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `checkpoint_type` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_checkpoint_type(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_digest(&self) -> bool { - self.digest.is_set() - } - /**Whether required field `implementation_version` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_implementation_version(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `checkpoint_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_checkpoint_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `producing_execution_attempt_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_producing_execution_attempt_id(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } - /**Whether required field `covers_through` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_covers_through(&self) -> bool { - self.covers_through.is_set() - } - /**Whether required field `session_execution_plan_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_execution_plan_digest(&self) -> bool { - self.session_execution_plan_digest.is_set() - } - /**Whether required field `capture_attestation_ref` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_capture_attestation_ref(&self) -> bool { - self.__buffa_required_seen_0 & 32u64 != 0 - } - /**Whether required field `capture_attestation_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_capture_attestation_digest(&self) -> bool { - self.capture_attestation_digest.is_set() - } - /**Whether required field `effective_history_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_effective_history_digest(&self) -> bool { - self.effective_history_digest.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for CheckpointView<'a> { - type Owned = super::super::Checkpoint; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reference = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.checkpoint_type = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.implementation_version = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.checkpoint_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.producing_execution_attempt_id = ::buffa::types::borrow_str( - &mut cur, - )?; - view.__buffa_required_seen_0 |= 16u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.covers_through.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.covers_through = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.session_execution_plan_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.session_execution_plan_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.capture_attestation_ref = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 32u64; - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.capture_attestation_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.capture_attestation_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.effective_history_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.effective_history_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::Checkpoint { - reference: self.reference.to_string(), - checkpoint_type: self.checkpoint_type.to_string(), - digest: match self.digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - implementation_version: self.implementation_version.to_string(), - checkpoint_id: self.checkpoint_id.to_string(), - producing_execution_attempt_id: self - .producing_execution_attempt_id - .to_string(), - covers_through: match self.covers_through.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - session_execution_plan_digest: match self - .session_execution_plan_digest - .as_option() - { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - capture_attestation_ref: self.capture_attestation_ref.to_string(), - capture_attestation_digest: match self.capture_attestation_digest.as_option() - { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - effective_history_digest: match self.effective_history_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CheckpointView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.reference) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.checkpoint_type) as u64; - if self.digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.implementation_version) - as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.checkpoint_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len( - &self.producing_execution_attempt_id, - ) as u64; - if self.covers_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.session_execution_plan_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.session_execution_plan_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.capture_attestation_ref) - as u64; - if self.capture_attestation_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.capture_attestation_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.effective_history_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.effective_history_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.reference, buf); - ::buffa::types::put_string_field(2u32, &self.checkpoint_type, buf); - if self.digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.implementation_version, buf); - ::buffa::types::put_string_field(5u32, &self.checkpoint_id, buf); - ::buffa::types::put_string_field( - 6u32, - &self.producing_execution_attempt_id, - buf, - ); - if self.covers_through.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_through.write_to(__cache, buf); - } - if self.session_execution_plan_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.session_execution_plan_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(9u32, &self.capture_attestation_ref, buf); - if self.capture_attestation_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - self.capture_attestation_digest.write_to(__cache, buf); - } - if self.effective_history_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - self.effective_history_digest.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CheckpointView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("reference", self.reference)?; - } - { - __map.serialize_entry("checkpointType", self.checkpoint_type)?; - } - { - if let ::core::option::Option::Some(__v) = self.digest.as_option() { - __map.serialize_entry("digest", __v)?; - } - } - { - __map.serialize_entry("implementationVersion", self.implementation_version)?; - } - { - __map.serialize_entry("checkpointId", self.checkpoint_id)?; - } - { - __map - .serialize_entry( - "producingExecutionAttemptId", - self.producing_execution_attempt_id, - )?; - } - { - if let ::core::option::Option::Some(__v) = self.covers_through.as_option() { - __map.serialize_entry("coversThrough", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self - .session_execution_plan_digest - .as_option() - { - __map.serialize_entry("sessionExecutionPlanDigest", __v)?; - } - } - { - __map - .serialize_entry("captureAttestationRef", self.capture_attestation_ref)?; - } - { - if let ::core::option::Option::Some(__v) = self - .capture_attestation_digest - .as_option() - { - __map.serialize_entry("captureAttestationDigest", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self - .effective_history_digest - .as_option() - { - __map.serialize_entry("effectiveHistoryDigest", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CheckpointView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "Checkpoint"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.Checkpoint"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.Checkpoint"; -} -::buffa::impl_default_view_instance!(CheckpointView); -::buffa::impl_view_reborrow!(CheckpointView); -/** Self-contained, `'static` owned view of a `Checkpoint` message. - - Wraps [`::buffa::OwnedView`]`<`[`CheckpointView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CheckpointView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CheckpointOwnedView(::buffa::OwnedView>); -impl CheckpointOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckpointOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckpointOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::Checkpoint, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckpointOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CheckpointView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CheckpointView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::Checkpoint { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Locator for the checkpoint artifact stored out of line. - /// - /// Field 1: `reference` - #[must_use] - pub fn reference(&self) -> &'_ str { - self.0.reborrow().reference - } - /// Opaque, implementation-defined checkpoint type. - /// - /// Field 2: `checkpoint_type` - #[must_use] - pub fn checkpoint_type(&self) -> &'_ str { - self.0.reborrow().checkpoint_type - } - /// Digest over the checkpoint bytes, verified before restore. - /// - /// Field 3: `digest` - #[must_use] - pub fn digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().digest - } - /// Implementation version that wrote the checkpoint. - /// - /// Field 4: `implementation_version` - #[must_use] - pub fn implementation_version(&self) -> &'_ str { - self.0.reborrow().implementation_version - } - /// Stable checkpoint id, joining a restore back to its producing - /// CheckpointProduced event unambiguously. - /// - /// Field 5: `checkpoint_id` - #[must_use] - pub fn checkpoint_id(&self) -> &'_ str { - self.0.reborrow().checkpoint_id - } - /// The execution attempt that produced this checkpoint. - /// - /// Field 6: `producing_execution_attempt_id` - #[must_use] - pub fn producing_execution_attempt_id(&self) -> &'_ str { - self.0.reborrow().producing_execution_attempt_id - } - /// This session's own fold-derived ordinal the checkpoint's state is current - /// through, so a restore resolves to a checkpoint deterministically rather - /// than by guessing which checkpoint covers a given position. - /// - /// Field 7: `covers_through` - #[must_use] - pub fn covers_through( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().covers_through - } - /// Digest of the session's StoredSessionExecutionPlan at checkpoint time; - /// validated against the session's plan digest before restore. - /// - /// Field 8: `session_execution_plan_digest` - #[must_use] - pub fn session_execution_plan_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().session_execution_plan_digest - } - /// Locator for the capture attestation stored out of line: the producing - /// attempt's platform-controlled supervisor binds the artifact, attempt, - /// plan digest, covers_through, and effective_history_digest under that - /// attempt's confirmation key (ADR#0031 §3). - /// - /// Field 9: `capture_attestation_ref` - #[must_use] - pub fn capture_attestation_ref(&self) -> &'_ str { - self.0.reborrow().capture_attestation_ref - } - /// Digest over the capture attestation bytes, verified at admission and - /// re-verified before restore. - /// - /// Field 10: `capture_attestation_digest` - #[must_use] - pub fn capture_attestation_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().capture_attestation_digest - } - /// Digest over the harness-relevant effective session facts, in fold order, - /// through covers_through; admission recomputes it from authoritative - /// history and requires equality with the attested value (ADR#0031 §3). - /// - /// Field 11: `effective_history_digest` - #[must_use] - pub fn effective_history_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().effective_history_digest - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CheckpointOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CheckpointOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CheckpointOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CheckpointOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::Checkpoint { - type View<'a> = CheckpointView<'a>; - type ViewHandle = CheckpointOwnedView; -} -impl ::serde::Serialize for CheckpointOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.checkpoint.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.checkpoint.rs deleted file mode 100644 index b1f411c57..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.checkpoint.rs +++ /dev/null @@ -1,431 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/checkpoint.proto - -/// Checkpoint is a self-describing, out-of-line durable checkpoint: a reference -/// plus a content digest and the implementation version that wrote it, never -/// inline bytes (ADR#0031 §3, §6). It is produced by CheckpointProduced and -/// restored via ExecutionAttemptStarted.restored_checkpoint, where it is -/// deliberately embedded rather than referenced: it is attempt evidence of -/// exactly what was restored, digest-verified, and now joined unambiguously to -/// its producing event via checkpoint_id. Per-event validation requires a -/// restored checkpoint's plan digest to match its ExecutionAttemptStarted plan -/// digest; the aggregate binds that digest to the session's stored plan. -/// Admission additionally verifies the supervisor capture attestation and the -/// effective-history digest (ADR#0031 §3) before CheckpointProduced is -/// recorded, and restoration re-verifies the same proof before trusting bytes. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct Checkpoint { - /// Locator for the checkpoint artifact stored out of line. - /// - /// Field 1: `reference` - #[serde(rename = "reference", with = "::buffa::json_helpers::proto_string")] - pub reference: ::buffa::alloc::string::String, - /// Opaque, implementation-defined checkpoint type. - /// - /// Field 2: `checkpoint_type` - #[serde( - rename = "checkpointType", - alias = "checkpoint_type", - with = "::buffa::json_helpers::proto_string" - )] - pub checkpoint_type: ::buffa::alloc::string::String, - /// Digest over the checkpoint bytes, verified before restore. - /// - /// Field 3: `digest` - #[serde(rename = "digest")] - pub digest: ::buffa::MessageField>, - /// Implementation version that wrote the checkpoint. - /// - /// Field 4: `implementation_version` - #[serde( - rename = "implementationVersion", - alias = "implementation_version", - with = "::buffa::json_helpers::proto_string" - )] - pub implementation_version: ::buffa::alloc::string::String, - /// Stable checkpoint id, joining a restore back to its producing - /// CheckpointProduced event unambiguously. - /// - /// Field 5: `checkpoint_id` - #[serde( - rename = "checkpointId", - alias = "checkpoint_id", - with = "::buffa::json_helpers::proto_string" - )] - pub checkpoint_id: ::buffa::alloc::string::String, - /// The execution attempt that produced this checkpoint. - /// - /// Field 6: `producing_execution_attempt_id` - #[serde( - rename = "producingExecutionAttemptId", - alias = "producing_execution_attempt_id", - with = "::buffa::json_helpers::proto_string" - )] - pub producing_execution_attempt_id: ::buffa::alloc::string::String, - /// This session's own fold-derived ordinal the checkpoint's state is current - /// through, so a restore resolves to a checkpoint deterministically rather - /// than by guessing which checkpoint covers a given position. - /// - /// Field 7: `covers_through` - #[serde(rename = "coversThrough", alias = "covers_through")] - pub covers_through: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Digest of the session's StoredSessionExecutionPlan at checkpoint time; - /// validated against the session's plan digest before restore. - /// - /// Field 8: `session_execution_plan_digest` - #[serde( - rename = "sessionExecutionPlanDigest", - alias = "session_execution_plan_digest" - )] - pub session_execution_plan_digest: ::buffa::MessageField< - Digest, - ::buffa::Inline, - >, - /// Locator for the capture attestation stored out of line: the producing - /// attempt's platform-controlled supervisor binds the artifact, attempt, - /// plan digest, covers_through, and effective_history_digest under that - /// attempt's confirmation key (ADR#0031 §3). - /// - /// Field 9: `capture_attestation_ref` - #[serde( - rename = "captureAttestationRef", - alias = "capture_attestation_ref", - with = "::buffa::json_helpers::proto_string" - )] - pub capture_attestation_ref: ::buffa::alloc::string::String, - /// Digest over the capture attestation bytes, verified at admission and - /// re-verified before restore. - /// - /// Field 10: `capture_attestation_digest` - #[serde(rename = "captureAttestationDigest", alias = "capture_attestation_digest")] - pub capture_attestation_digest: ::buffa::MessageField< - Digest, - ::buffa::Inline, - >, - /// Digest over the harness-relevant effective session facts, in fold order, - /// through covers_through; admission recomputes it from authoritative - /// history and requires equality with the attested value (ADR#0031 §3). - /// - /// Field 11: `effective_history_digest` - #[serde(rename = "effectiveHistoryDigest", alias = "effective_history_digest")] - pub effective_history_digest: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for Checkpoint { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Checkpoint") - .field("reference", &self.reference) - .field("checkpoint_type", &self.checkpoint_type) - .field("digest", &self.digest) - .field("implementation_version", &self.implementation_version) - .field("checkpoint_id", &self.checkpoint_id) - .field( - "producing_execution_attempt_id", - &self.producing_execution_attempt_id, - ) - .field("covers_through", &self.covers_through) - .field("session_execution_plan_digest", &self.session_execution_plan_digest) - .field("capture_attestation_ref", &self.capture_attestation_ref) - .field("capture_attestation_digest", &self.capture_attestation_digest) - .field("effective_history_digest", &self.effective_history_digest) - .finish() - } -} -impl Checkpoint { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.Checkpoint"; -} -::buffa::impl_default_instance!(Checkpoint); -impl ::buffa::MessageName for Checkpoint { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "Checkpoint"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.Checkpoint"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.Checkpoint"; -} -impl ::buffa::Message for Checkpoint { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.reference) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.checkpoint_type) as u64; - if self.digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.implementation_version) - as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.checkpoint_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len( - &self.producing_execution_attempt_id, - ) as u64; - if self.covers_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.session_execution_plan_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.session_execution_plan_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.capture_attestation_ref) - as u64; - if self.capture_attestation_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.capture_attestation_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.effective_history_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.effective_history_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.reference, buf); - ::buffa::types::put_string_field(2u32, &self.checkpoint_type, buf); - if self.digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.implementation_version, buf); - ::buffa::types::put_string_field(5u32, &self.checkpoint_id, buf); - ::buffa::types::put_string_field( - 6u32, - &self.producing_execution_attempt_id, - buf, - ); - if self.covers_through.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_through.write_to(__cache, buf); - } - if self.session_execution_plan_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.session_execution_plan_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(9u32, &self.capture_attestation_ref, buf); - if self.capture_attestation_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - self.capture_attestation_digest.write_to(__cache, buf); - } - if self.effective_history_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - self.effective_history_digest.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.reference, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.checkpoint_type, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.implementation_version, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.checkpoint_id, buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - &mut self.producing_execution_attempt_id, - buf, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.covers_through.get_or_insert_default(), - buf, - ctx, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.session_execution_plan_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.capture_attestation_ref, buf)?; - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.capture_attestation_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.effective_history_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.reference.clear(); - self.checkpoint_type.clear(); - self.digest = ::buffa::MessageField::none(); - self.implementation_version.clear(); - self.checkpoint_id.clear(); - self.producing_execution_attempt_id.clear(); - self.covers_through = ::buffa::MessageField::none(); - self.session_execution_plan_digest = ::buffa::MessageField::none(); - self.capture_attestation_ref.clear(); - self.capture_attestation_digest = ::buffa::MessageField::none(); - self.effective_history_digest = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for Checkpoint { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CHECKPOINT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.Checkpoint", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.checkpoint_produced.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.checkpoint_produced.__view.rs deleted file mode 100644 index b296685b1..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.checkpoint_produced.__view.rs +++ /dev/null @@ -1,331 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/checkpoint_produced.proto - -/// CheckpointProduced records an opaque durable checkpoint an execution attempt -/// produced mid-run (ADR#0031 §3), retained as a reference and digest rather than -/// inline bytes. The checkpoint is now self-describing (checkpoint_id, -/// producing_execution_attempt_id, covers_through, session_execution_plan_digest -/// all live on the embedded Checkpoint), so this event slims to the session id -/// plus the checkpoint itself. A later attempt may restore it through -/// ExecutionAttemptStarted.restored_checkpoint. It is a commuting happened-fact -/// (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, Debug, Default)] -pub struct CheckpointProducedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 3: `checkpoint` - pub checkpoint: ::buffa::MessageFieldView< - super::super::__buffa::view::CheckpointView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CheckpointProducedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `checkpoint` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_checkpoint(&self) -> bool { - self.checkpoint.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for CheckpointProducedView<'a> { - type Owned = super::super::CheckpointProduced; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.checkpoint.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.checkpoint = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CheckpointProduced { - session_id: self.session_id.to_string(), - checkpoint: match self.checkpoint.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Checkpoint, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CheckpointProducedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.checkpoint.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.checkpoint.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.checkpoint.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.checkpoint.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CheckpointProducedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.checkpoint.as_option() { - __map.serialize_entry("checkpoint", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CheckpointProducedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CheckpointProduced"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CheckpointProduced"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CheckpointProduced"; -} -::buffa::impl_default_view_instance!(CheckpointProducedView); -::buffa::impl_view_reborrow!(CheckpointProducedView); -/** Self-contained, `'static` owned view of a `CheckpointProduced` message. - - Wraps [`::buffa::OwnedView`]`<`[`CheckpointProducedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CheckpointProducedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CheckpointProducedOwnedView( - ::buffa::OwnedView>, -); -impl CheckpointProducedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckpointProducedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckpointProducedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CheckpointProduced, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CheckpointProducedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CheckpointProducedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CheckpointProducedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CheckpointProduced { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 3: `checkpoint` - #[must_use] - pub fn checkpoint( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().checkpoint - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CheckpointProducedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CheckpointProducedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CheckpointProducedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CheckpointProducedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CheckpointProduced { - type View<'a> = CheckpointProducedView<'a>; - type ViewHandle = CheckpointProducedOwnedView; -} -impl ::serde::Serialize for CheckpointProducedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.checkpoint_produced.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.checkpoint_produced.rs deleted file mode 100644 index a8f661ee5..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.checkpoint_produced.rs +++ /dev/null @@ -1,149 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/checkpoint_produced.proto - -/// CheckpointProduced records an opaque durable checkpoint an execution attempt -/// produced mid-run (ADR#0031 §3), retained as a reference and digest rather than -/// inline bytes. The checkpoint is now self-describing (checkpoint_id, -/// producing_execution_attempt_id, covers_through, session_execution_plan_digest -/// all live on the embedded Checkpoint), so this event slims to the session id -/// plus the checkpoint itself. A later attempt may restore it through -/// ExecutionAttemptStarted.restored_checkpoint. It is a commuting happened-fact -/// (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CheckpointProduced { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 3: `checkpoint` - #[serde(rename = "checkpoint")] - pub checkpoint: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for CheckpointProduced { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CheckpointProduced") - .field("session_id", &self.session_id) - .field("checkpoint", &self.checkpoint) - .finish() - } -} -impl CheckpointProduced { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CheckpointProduced"; -} -::buffa::impl_default_instance!(CheckpointProduced); -impl ::buffa::MessageName for CheckpointProduced { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CheckpointProduced"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CheckpointProduced"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CheckpointProduced"; -} -impl ::buffa::Message for CheckpointProduced { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.checkpoint.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.checkpoint.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.checkpoint.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.checkpoint.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.checkpoint.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.checkpoint = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CheckpointProduced { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CHECKPOINT_PRODUCED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CheckpointProduced", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.close_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.close_session.__view.rs deleted file mode 100644 index c9ebcb374..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.close_session.__view.rs +++ /dev/null @@ -1,319 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/close_session.proto - -/// CloseSession seals a session as completed, recording \[SessionClosed\]. -/// -/// Write precondition At: the first terminal marker is authoritative, so a -/// decision taken against a stale head must be rejected rather than appended. -#[derive(Clone, Debug, Default)] -pub struct CloseSessionView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Out-of-line result of the session's work, when it produced one. - /// - /// Field 2: `result_ref` - pub result_ref: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactRefView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CloseSessionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for CloseSessionView<'a> { - type Owned = super::super::CloseSession; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.result_ref.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.result_ref = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CloseSession { - session_id: self.session_id.to_string(), - result_ref: match self.result_ref.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CloseSessionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.result_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.result_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.result_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.result_ref.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CloseSessionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.result_ref.as_option() { - __map.serialize_entry("resultRef", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CloseSessionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CloseSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CloseSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CloseSession"; -} -::buffa::impl_default_view_instance!(CloseSessionView); -::buffa::impl_view_reborrow!(CloseSessionView); -/** Self-contained, `'static` owned view of a `CloseSession` message. - - Wraps [`::buffa::OwnedView`]`<`[`CloseSessionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CloseSessionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CloseSessionOwnedView(::buffa::OwnedView>); -impl CloseSessionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CloseSessionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CloseSessionOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CloseSession, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CloseSessionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CloseSessionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CloseSessionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CloseSession { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Out-of-line result of the session's work, when it produced one. - /// - /// Field 2: `result_ref` - #[must_use] - pub fn result_ref( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().result_ref - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CloseSessionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CloseSessionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CloseSessionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CloseSessionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CloseSession { - type View<'a> = CloseSessionView<'a>; - type ViewHandle = CloseSessionOwnedView; -} -impl ::serde::Serialize for CloseSessionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.close_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.close_session.rs deleted file mode 100644 index 62b1e861b..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.close_session.rs +++ /dev/null @@ -1,151 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/close_session.proto - -/// CloseSession seals a session as completed, recording \[SessionClosed\]. -/// -/// Write precondition At: the first terminal marker is authoritative, so a -/// decision taken against a stale head must be rejected rather than appended. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CloseSession { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Out-of-line result of the session's work, when it produced one. - /// - /// Field 2: `result_ref` - #[serde( - rename = "resultRef", - alias = "result_ref", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub result_ref: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for CloseSession { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CloseSession") - .field("session_id", &self.session_id) - .field("result_ref", &self.result_ref) - .finish() - } -} -impl CloseSession { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CloseSession"; -} -::buffa::impl_default_instance!(CloseSession); -impl ::buffa::MessageName for CloseSession { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CloseSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CloseSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CloseSession"; -} -impl ::buffa::Message for CloseSession { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.result_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.result_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.result_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.result_ref.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.result_ref.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.result_ref = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CloseSession { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CLOSE_SESSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CloseSession", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_output_replay.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_output_replay.__view.rs deleted file mode 100644 index 21825fccf..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_output_replay.__view.rs +++ /dev/null @@ -1,1021 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/command_output_replay.proto - -/// CommandOutputReplayRef is a claim-check to the captured output of a -/// process-executing tool call, plus the small set of facts a reader needs -/// before it is allowed to render any of it. -/// -/// The output itself is an artifact: one immutable, content-addressed blob of -/// framed stdout and stderr, referenced from the terminal event rather than -/// appended to the log as an event per chunk. A long command emits millions of -/// writes, and a log that records them is a log whose size is set by the noisiest -/// thing that ever ran on it, permanently, because nothing ever leaves the log -/// (ADR#0035 facet 7). -/// -/// It lives on ToolCallCompleted, next to CommandTermination and for the same -/// reason (D11): it is the execution and audit record, not the transcript the -/// model received. The model saw ToolCallResult, which is usually a truncation -/// or a summary. Putting raw captured output into the replay shape would feed a -/// later turn context the original turn never had. -/// -/// Every field here is on the log rather than only inside the artifact, because -/// the artifact's bytes may be erased (ArtifactErased) while the log keeps its -/// provenance. After erasure a reader can still say the command produced 2.1 -/// million frames and 40 MB and was captured through a terminal, which is the -/// point of separating byte lifecycle from log retention. -#[derive(Clone, Debug, Default)] -pub struct CommandOutputReplayRefView<'a> { - /// Claim-check to the framed capture. Its `preview` conventionally holds the - /// tail of the output, which is the part someone reading a command log wants - /// first. - /// - /// Field 1: `artifact` - pub artifact: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactRefView<'a>, - >, - /// Version of the byte layout inside the artifact, as defined by - /// trogonai.session.sessions.replay.v1alpha1. - /// - /// Carried as a number and not read out of the artifact's media type, because - /// a reader deciding whether it can parse these frames should not be doing - /// string surgery on a MIME parameter to find out. - /// - /// Field 2: `format_version` - pub format_version: u32, - /// Field 3: `capture_mode` - pub capture_mode: ::buffa::EnumValue, - /// Field 4: `timing` - pub timing: ::buffa::EnumValue, - /// Field 5: `completeness` - pub completeness: ::buffa::MessageFieldView< - super::super::__buffa::view::ReplayCompletenessView<'a>, - >, - /// Frames in the capture. - /// - /// Field 6: `frame_count` - pub frame_count: u64, - /// Payload bytes across all frames, which is the size of the output as a user - /// understands it. Always smaller than ArtifactRef.size_bytes, which includes - /// framing overhead and the index. - /// - /// Field 7: `output_byte_count` - pub output_byte_count: u64, - /// Where the seek index sits inside the artifact. - /// - /// The index is a trailer, because a capturer streaming a running process does - /// not know it until the process exits and so cannot write it as a header. Its - /// location is recorded here so a reader can range-read the index directly, - /// rather than seeking relative to an end-of-object the artifact store might - /// report differently than the log does. - /// - /// Field 8: `index_offset` - pub index_offset: u64, - /// Field 9: `index_length` - pub index_length: u64, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CommandOutputReplayRefView<'a> { - /**Whether required field `artifact` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact(&self) -> bool { - self.artifact.is_set() - } - /**Whether required field `format_version` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_format_version(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `capture_mode` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_capture_mode(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `timing` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_timing(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `completeness` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_completeness(&self) -> bool { - self.completeness.is_set() - } - /**Whether required field `frame_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_frame_count(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `output_byte_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_output_byte_count(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } - /**Whether required field `index_offset` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_index_offset(&self) -> bool { - self.__buffa_required_seen_0 & 32u64 != 0 - } - /**Whether required field `index_length` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_index_length(&self) -> bool { - self.__buffa_required_seen_0 & 64u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for CommandOutputReplayRefView<'a> { - type Owned = super::super::CommandOutputReplayRef; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.artifact.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.artifact = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.format_version = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.capture_mode = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.timing = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.completeness.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.completeness = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.frame_count = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.output_byte_count = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.index_offset = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 32u64; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.index_length = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 64u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::CommandOutputReplayRef, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::CommandOutputReplayRef, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CommandOutputReplayRef { - artifact: match self.artifact.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - format_version: self.format_version, - capture_mode: self.capture_mode, - timing: self.timing, - completeness: match self.completeness.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ReplayCompleteness, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - frame_count: self.frame_count, - output_byte_count: self.output_byte_count, - index_offset: self.index_offset, - index_length: self.index_length, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CommandOutputReplayRefView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.artifact.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.artifact.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.format_version) as u64; - { - let val = self.capture_mode.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - { - let val = self.timing.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.completeness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.completeness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.frame_count) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.output_byte_count) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.index_offset) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.index_length) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.artifact.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.artifact.write_to(__cache, buf); - } - ::buffa::types::put_uint32_field(2u32, self.format_version, buf); - ::buffa::types::put_int32_field(3u32, self.capture_mode.to_i32(), buf); - ::buffa::types::put_int32_field(4u32, self.timing.to_i32(), buf); - if self.completeness.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.completeness.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(6u32, self.frame_count, buf); - ::buffa::types::put_uint64_field(7u32, self.output_byte_count, buf); - ::buffa::types::put_uint64_field(8u32, self.index_offset, buf); - ::buffa::types::put_uint64_field(9u32, self.index_length, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CommandOutputReplayRefView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.artifact.as_option() { - __map.serialize_entry("artifact", __v)?; - } - } - { - __map - .serialize_entry( - "formatVersion", - &::buffa::json_helpers::ProtoJson(&self.format_version), - )?; - } - { - __map.serialize_entry("captureMode", &self.capture_mode)?; - } - { - __map.serialize_entry("timing", &self.timing)?; - } - { - if let ::core::option::Option::Some(__v) = self.completeness.as_option() { - __map.serialize_entry("completeness", __v)?; - } - } - { - __map - .serialize_entry( - "frameCount", - &::buffa::json_helpers::ProtoJson(&self.frame_count), - )?; - } - { - __map - .serialize_entry( - "outputByteCount", - &::buffa::json_helpers::ProtoJson(&self.output_byte_count), - )?; - } - { - __map - .serialize_entry( - "indexOffset", - &::buffa::json_helpers::ProtoJson(&self.index_offset), - )?; - } - { - __map - .serialize_entry( - "indexLength", - &::buffa::json_helpers::ProtoJson(&self.index_length), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CommandOutputReplayRefView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CommandOutputReplayRef"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CommandOutputReplayRef"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CommandOutputReplayRef"; -} -::buffa::impl_default_view_instance!(CommandOutputReplayRefView); -::buffa::impl_view_reborrow!(CommandOutputReplayRefView); -/** Self-contained, `'static` owned view of a `CommandOutputReplayRef` message. - - Wraps [`::buffa::OwnedView`]`<`[`CommandOutputReplayRefView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CommandOutputReplayRefView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CommandOutputReplayRefOwnedView( - ::buffa::OwnedView>, -); -impl CommandOutputReplayRefOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CommandOutputReplayRefOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CommandOutputReplayRefOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CommandOutputReplayRef, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CommandOutputReplayRefOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CommandOutputReplayRefView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CommandOutputReplayRefView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CommandOutputReplayRef { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Claim-check to the framed capture. Its `preview` conventionally holds the - /// tail of the output, which is the part someone reading a command log wants - /// first. - /// - /// Field 1: `artifact` - #[must_use] - pub fn artifact( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().artifact - } - /// Version of the byte layout inside the artifact, as defined by - /// trogonai.session.sessions.replay.v1alpha1. - /// - /// Carried as a number and not read out of the artifact's media type, because - /// a reader deciding whether it can parse these frames should not be doing - /// string surgery on a MIME parameter to find out. - /// - /// Field 2: `format_version` - #[must_use] - pub fn format_version(&self) -> u32 { - self.0.reborrow().format_version - } - /// Field 3: `capture_mode` - #[must_use] - pub fn capture_mode(&self) -> ::buffa::EnumValue { - self.0.reborrow().capture_mode - } - /// Field 4: `timing` - #[must_use] - pub fn timing(&self) -> ::buffa::EnumValue { - self.0.reborrow().timing - } - /// Field 5: `completeness` - #[must_use] - pub fn completeness( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ReplayCompletenessView<'_>, - > { - &self.0.reborrow().completeness - } - /// Frames in the capture. - /// - /// Field 6: `frame_count` - #[must_use] - pub fn frame_count(&self) -> u64 { - self.0.reborrow().frame_count - } - /// Payload bytes across all frames, which is the size of the output as a user - /// understands it. Always smaller than ArtifactRef.size_bytes, which includes - /// framing overhead and the index. - /// - /// Field 7: `output_byte_count` - #[must_use] - pub fn output_byte_count(&self) -> u64 { - self.0.reborrow().output_byte_count - } - /// Where the seek index sits inside the artifact. - /// - /// The index is a trailer, because a capturer streaming a running process does - /// not know it until the process exits and so cannot write it as a header. Its - /// location is recorded here so a reader can range-read the index directly, - /// rather than seeking relative to an end-of-object the artifact store might - /// report differently than the log does. - /// - /// Field 8: `index_offset` - #[must_use] - pub fn index_offset(&self) -> u64 { - self.0.reborrow().index_offset - } - /// Field 9: `index_length` - #[must_use] - pub fn index_length(&self) -> u64 { - self.0.reborrow().index_length - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CommandOutputReplayRefOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CommandOutputReplayRefOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CommandOutputReplayRefOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CommandOutputReplayRefOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CommandOutputReplayRef { - type View<'a> = CommandOutputReplayRefView<'a>; - type ViewHandle = CommandOutputReplayRefOwnedView; -} -impl ::serde::Serialize for CommandOutputReplayRefOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ReplayCompleteness is how much of the output survived capture. -/// -/// This is not ArtifactRef.truncated, which says a preview is shorter than its -/// content. This says the content is shorter than what the process emitted, and -/// names which end went missing, because for a command log that is the whole -/// question: losing the tail loses the failure, losing the head loses what was -/// run. -#[derive(Clone, Debug, Default)] -pub struct ReplayCompletenessView<'a> { - /// Unspecified is not complete. A reader that cannot recognize the shape must - /// treat the capture as of unknown completeness rather than whole. - /// - /// Field 1: `shape` - pub shape: ::buffa::EnumValue, - /// Payload bytes the capturer saw and did not retain. - /// - /// Unset means dropping occurred and was not counted, which a fixed-size ring - /// buffer that overwrites without accounting cannot avoid. Left absent rather - /// than reported as zero, because zero here would say nothing was lost. - /// - /// Field 2: `dropped_byte_count` - pub dropped_byte_count: ::core::option::Option, - /// Frames the capturer saw and did not retain, under the same rule. - /// - /// Field 3: `dropped_frame_count` - pub dropped_frame_count: ::core::option::Option, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, - #[doc(hidden)] - pub __buffa_phantom: ::core::marker::PhantomData<&'a ()>, -} -impl<'a> ReplayCompletenessView<'a> { - /**Whether required field `shape` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_shape(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ReplayCompletenessView<'a> { - type Owned = super::super::ReplayCompleteness; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.shape = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.dropped_byte_count = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.dropped_frame_count = Some( - ::buffa::types::decode_uint64(&mut cur)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReplayCompleteness { - shape: self.shape, - dropped_byte_count: self.dropped_byte_count, - dropped_frame_count: self.dropped_frame_count, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReplayCompletenessView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.shape.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(v) = self.dropped_byte_count { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.dropped_frame_count { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.shape.to_i32(), buf); - if let Some(v) = self.dropped_byte_count { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if let Some(v) = self.dropped_frame_count { - ::buffa::types::put_uint64_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReplayCompletenessView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("shape", &self.shape)?; - } - if let ::core::option::Option::Some(__v) = self.dropped_byte_count { - __map - .serialize_entry( - "droppedByteCount", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.dropped_frame_count { - __map - .serialize_entry( - "droppedFrameCount", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReplayCompletenessView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ReplayCompleteness"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ReplayCompleteness"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReplayCompleteness"; -} -::buffa::impl_default_view_instance!(ReplayCompletenessView); -::buffa::impl_view_reborrow!(ReplayCompletenessView); -/** Self-contained, `'static` owned view of a `ReplayCompleteness` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReplayCompletenessView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReplayCompletenessView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReplayCompletenessOwnedView( - ::buffa::OwnedView>, -); -impl ReplayCompletenessOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReplayCompletenessOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReplayCompletenessOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReplayCompleteness, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReplayCompletenessOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReplayCompletenessView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReplayCompletenessView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReplayCompleteness { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Unspecified is not complete. A reader that cannot recognize the shape must - /// treat the capture as of unknown completeness rather than whole. - /// - /// Field 1: `shape` - #[must_use] - pub fn shape(&self) -> ::buffa::EnumValue { - self.0.reborrow().shape - } - /// Payload bytes the capturer saw and did not retain. - /// - /// Unset means dropping occurred and was not counted, which a fixed-size ring - /// buffer that overwrites without accounting cannot avoid. Left absent rather - /// than reported as zero, because zero here would say nothing was lost. - /// - /// Field 2: `dropped_byte_count` - #[must_use] - pub fn dropped_byte_count(&self) -> ::core::option::Option { - self.0.reborrow().dropped_byte_count - } - /// Frames the capturer saw and did not retain, under the same rule. - /// - /// Field 3: `dropped_frame_count` - #[must_use] - pub fn dropped_frame_count(&self) -> ::core::option::Option { - self.0.reborrow().dropped_frame_count - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReplayCompletenessOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReplayCompletenessOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReplayCompletenessOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReplayCompletenessOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReplayCompleteness { - type View<'a> = ReplayCompletenessView<'a>; - type ViewHandle = ReplayCompletenessOwnedView; -} -impl ::serde::Serialize for ReplayCompletenessOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_output_replay.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_output_replay.rs deleted file mode 100644 index 535a6556c..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_output_replay.rs +++ /dev/null @@ -1,1044 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/command_output_replay.proto - -/// CaptureMode is how the output was collected, which decides what the frame -/// order and the per-frame stream tag are actually worth. -/// -/// A renderer that ignores this will misrepresent output in one of two -/// directions, and which one depends on a decision made at spawn time that it -/// cannot see. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum CaptureMode { - CAPTURE_MODE_UNSPECIFIED = 0i32, - /// stdout and stderr were read from separate pipes. - /// - /// Stream attribution is exact and the interleaving is not: the child's own - /// buffering decides when each pipe becomes readable, so a line written to - /// stderr before a line written to stdout can be captured after it. A renderer - /// may color the two streams and must not present their relative order as the - /// order the process produced them in. - CAPTURE_MODE_SEPARATE_PIPES = 1i32, - /// Both streams were written to one terminal or one pipe. - /// - /// The interleaving is the process's own and is exact. Stream attribution is - /// gone: the frames say MERGED because at capture time there was nothing left - /// to distinguish. A renderer must not guess stderr from content, which is - /// what makes this the honest opposite of SEPARATE_PIPES rather than a - /// strictly worse version of it. - CAPTURE_MODE_MERGED_TERMINAL = 2i32, -} -impl CaptureMode { - ///Idiomatic alias for [`Self::CAPTURE_MODE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::CAPTURE_MODE_UNSPECIFIED; - ///Idiomatic alias for [`Self::CAPTURE_MODE_SEPARATE_PIPES`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SeparatePipes: Self = Self::CAPTURE_MODE_SEPARATE_PIPES; - ///Idiomatic alias for [`Self::CAPTURE_MODE_MERGED_TERMINAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const MergedTerminal: Self = Self::CAPTURE_MODE_MERGED_TERMINAL; -} -impl ::core::default::Default for CaptureMode { - fn default() -> Self { - Self::CAPTURE_MODE_UNSPECIFIED - } -} -impl ::serde::Serialize for CaptureMode { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for CaptureMode { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = CaptureMode; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(CaptureMode)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for CaptureMode { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for CaptureMode { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::CAPTURE_MODE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::CAPTURE_MODE_SEPARATE_PIPES), - 2i32 => ::core::option::Option::Some(Self::CAPTURE_MODE_MERGED_TERMINAL), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::CAPTURE_MODE_UNSPECIFIED => "CAPTURE_MODE_UNSPECIFIED", - Self::CAPTURE_MODE_SEPARATE_PIPES => "CAPTURE_MODE_SEPARATE_PIPES", - Self::CAPTURE_MODE_MERGED_TERMINAL => "CAPTURE_MODE_MERGED_TERMINAL", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "CAPTURE_MODE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::CAPTURE_MODE_UNSPECIFIED) - } - "CAPTURE_MODE_SEPARATE_PIPES" => { - ::core::option::Option::Some(Self::CAPTURE_MODE_SEPARATE_PIPES) - } - "CAPTURE_MODE_MERGED_TERMINAL" => { - ::core::option::Option::Some(Self::CAPTURE_MODE_MERGED_TERMINAL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::CAPTURE_MODE_UNSPECIFIED, - Self::CAPTURE_MODE_SEPARATE_PIPES, - Self::CAPTURE_MODE_MERGED_TERMINAL, - ] - } -} -/// TimingFidelity is whether the capture can be played back at speed, or only in -/// order. -/// -/// Order-only is the common case and the safe default, and it is stated rather -/// than left to inference because a replay UI that animates untimed frames is -/// inventing pacing and presenting it as a recording. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum TimingFidelity { - TIMING_FIDELITY_UNSPECIFIED = 0i32, - /// Frames carry no timing. Only their sequence is meaningful. - TIMING_FIDELITY_ORDER_ONLY = 1i32, - /// Frames carry the elapsed time at which the capturer observed them, which is - /// not when the process wrote them: pipe buffering, scheduler delay, and the - /// capturer's own read loop all sit in between. Close enough to replay at - /// speed, not evidence of when anything happened. - TIMING_FIDELITY_CAPTURE_ELAPSED = 2i32, -} -impl TimingFidelity { - ///Idiomatic alias for [`Self::TIMING_FIDELITY_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::TIMING_FIDELITY_UNSPECIFIED; - ///Idiomatic alias for [`Self::TIMING_FIDELITY_ORDER_ONLY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const OrderOnly: Self = Self::TIMING_FIDELITY_ORDER_ONLY; - ///Idiomatic alias for [`Self::TIMING_FIDELITY_CAPTURE_ELAPSED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const CaptureElapsed: Self = Self::TIMING_FIDELITY_CAPTURE_ELAPSED; -} -impl ::core::default::Default for TimingFidelity { - fn default() -> Self { - Self::TIMING_FIDELITY_UNSPECIFIED - } -} -impl ::serde::Serialize for TimingFidelity { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for TimingFidelity { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = TimingFidelity; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(TimingFidelity) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for TimingFidelity { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for TimingFidelity { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::TIMING_FIDELITY_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::TIMING_FIDELITY_ORDER_ONLY), - 2i32 => ::core::option::Option::Some(Self::TIMING_FIDELITY_CAPTURE_ELAPSED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::TIMING_FIDELITY_UNSPECIFIED => "TIMING_FIDELITY_UNSPECIFIED", - Self::TIMING_FIDELITY_ORDER_ONLY => "TIMING_FIDELITY_ORDER_ONLY", - Self::TIMING_FIDELITY_CAPTURE_ELAPSED => "TIMING_FIDELITY_CAPTURE_ELAPSED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "TIMING_FIDELITY_UNSPECIFIED" => { - ::core::option::Option::Some(Self::TIMING_FIDELITY_UNSPECIFIED) - } - "TIMING_FIDELITY_ORDER_ONLY" => { - ::core::option::Option::Some(Self::TIMING_FIDELITY_ORDER_ONLY) - } - "TIMING_FIDELITY_CAPTURE_ELAPSED" => { - ::core::option::Option::Some(Self::TIMING_FIDELITY_CAPTURE_ELAPSED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::TIMING_FIDELITY_UNSPECIFIED, - Self::TIMING_FIDELITY_ORDER_ONLY, - Self::TIMING_FIDELITY_CAPTURE_ELAPSED, - ] - } -} -/// TruncationShape is which part of the output is missing. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum TruncationShape { - TRUNCATION_SHAPE_UNSPECIFIED = 0i32, - /// Everything the process emitted was captured. - TRUNCATION_SHAPE_COMPLETE = 1i32, - /// The beginning was dropped, typically by a ring buffer that kept the most - /// recent output. The command's own startup and its invocation echo are gone. - TRUNCATION_SHAPE_HEAD_DROPPED = 2i32, - /// Capture stopped at a cap and the rest was discarded. Whatever the command - /// said on its way out, including why it failed, is not here. - TRUNCATION_SHAPE_TAIL_DROPPED = 3i32, - /// The head and the tail were kept and a span in the middle was not. Frame - /// sequence numbers are the capturer's original count and are never compacted - /// when frames are dropped, so the gap is visible in the frames themselves; - /// this value is what lets a reader know to expect one without scanning for - /// it. - TRUNCATION_SHAPE_MIDDLE_DROPPED = 4i32, -} -impl TruncationShape { - ///Idiomatic alias for [`Self::TRUNCATION_SHAPE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::TRUNCATION_SHAPE_UNSPECIFIED; - ///Idiomatic alias for [`Self::TRUNCATION_SHAPE_COMPLETE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Complete: Self = Self::TRUNCATION_SHAPE_COMPLETE; - ///Idiomatic alias for [`Self::TRUNCATION_SHAPE_HEAD_DROPPED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const HeadDropped: Self = Self::TRUNCATION_SHAPE_HEAD_DROPPED; - ///Idiomatic alias for [`Self::TRUNCATION_SHAPE_TAIL_DROPPED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const TailDropped: Self = Self::TRUNCATION_SHAPE_TAIL_DROPPED; - ///Idiomatic alias for [`Self::TRUNCATION_SHAPE_MIDDLE_DROPPED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const MiddleDropped: Self = Self::TRUNCATION_SHAPE_MIDDLE_DROPPED; -} -impl ::core::default::Default for TruncationShape { - fn default() -> Self { - Self::TRUNCATION_SHAPE_UNSPECIFIED - } -} -impl ::serde::Serialize for TruncationShape { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for TruncationShape { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = TruncationShape; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(TruncationShape) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for TruncationShape { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for TruncationShape { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::TRUNCATION_SHAPE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::TRUNCATION_SHAPE_COMPLETE), - 2i32 => ::core::option::Option::Some(Self::TRUNCATION_SHAPE_HEAD_DROPPED), - 3i32 => ::core::option::Option::Some(Self::TRUNCATION_SHAPE_TAIL_DROPPED), - 4i32 => ::core::option::Option::Some(Self::TRUNCATION_SHAPE_MIDDLE_DROPPED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::TRUNCATION_SHAPE_UNSPECIFIED => "TRUNCATION_SHAPE_UNSPECIFIED", - Self::TRUNCATION_SHAPE_COMPLETE => "TRUNCATION_SHAPE_COMPLETE", - Self::TRUNCATION_SHAPE_HEAD_DROPPED => "TRUNCATION_SHAPE_HEAD_DROPPED", - Self::TRUNCATION_SHAPE_TAIL_DROPPED => "TRUNCATION_SHAPE_TAIL_DROPPED", - Self::TRUNCATION_SHAPE_MIDDLE_DROPPED => "TRUNCATION_SHAPE_MIDDLE_DROPPED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "TRUNCATION_SHAPE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::TRUNCATION_SHAPE_UNSPECIFIED) - } - "TRUNCATION_SHAPE_COMPLETE" => { - ::core::option::Option::Some(Self::TRUNCATION_SHAPE_COMPLETE) - } - "TRUNCATION_SHAPE_HEAD_DROPPED" => { - ::core::option::Option::Some(Self::TRUNCATION_SHAPE_HEAD_DROPPED) - } - "TRUNCATION_SHAPE_TAIL_DROPPED" => { - ::core::option::Option::Some(Self::TRUNCATION_SHAPE_TAIL_DROPPED) - } - "TRUNCATION_SHAPE_MIDDLE_DROPPED" => { - ::core::option::Option::Some(Self::TRUNCATION_SHAPE_MIDDLE_DROPPED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::TRUNCATION_SHAPE_UNSPECIFIED, - Self::TRUNCATION_SHAPE_COMPLETE, - Self::TRUNCATION_SHAPE_HEAD_DROPPED, - Self::TRUNCATION_SHAPE_TAIL_DROPPED, - Self::TRUNCATION_SHAPE_MIDDLE_DROPPED, - ] - } -} -/// CommandOutputReplayRef is a claim-check to the captured output of a -/// process-executing tool call, plus the small set of facts a reader needs -/// before it is allowed to render any of it. -/// -/// The output itself is an artifact: one immutable, content-addressed blob of -/// framed stdout and stderr, referenced from the terminal event rather than -/// appended to the log as an event per chunk. A long command emits millions of -/// writes, and a log that records them is a log whose size is set by the noisiest -/// thing that ever ran on it, permanently, because nothing ever leaves the log -/// (ADR#0035 facet 7). -/// -/// It lives on ToolCallCompleted, next to CommandTermination and for the same -/// reason (D11): it is the execution and audit record, not the transcript the -/// model received. The model saw ToolCallResult, which is usually a truncation -/// or a summary. Putting raw captured output into the replay shape would feed a -/// later turn context the original turn never had. -/// -/// Every field here is on the log rather than only inside the artifact, because -/// the artifact's bytes may be erased (ArtifactErased) while the log keeps its -/// provenance. After erasure a reader can still say the command produced 2.1 -/// million frames and 40 MB and was captured through a terminal, which is the -/// point of separating byte lifecycle from log retention. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CommandOutputReplayRef { - /// Claim-check to the framed capture. Its `preview` conventionally holds the - /// tail of the output, which is the part someone reading a command log wants - /// first. - /// - /// Field 1: `artifact` - #[serde(rename = "artifact")] - pub artifact: ::buffa::MessageField>, - /// Version of the byte layout inside the artifact, as defined by - /// trogonai.session.sessions.replay.v1alpha1. - /// - /// Carried as a number and not read out of the artifact's media type, because - /// a reader deciding whether it can parse these frames should not be doing - /// string surgery on a MIME parameter to find out. - /// - /// Field 2: `format_version` - #[serde( - rename = "formatVersion", - alias = "format_version", - with = "::buffa::json_helpers::uint32" - )] - pub format_version: u32, - /// Field 3: `capture_mode` - #[serde( - rename = "captureMode", - alias = "capture_mode", - with = "::buffa::json_helpers::proto_enum" - )] - pub capture_mode: ::buffa::EnumValue, - /// Field 4: `timing` - #[serde(rename = "timing", with = "::buffa::json_helpers::proto_enum")] - pub timing: ::buffa::EnumValue, - /// Field 5: `completeness` - #[serde(rename = "completeness")] - pub completeness: ::buffa::MessageField< - ReplayCompleteness, - ::buffa::Inline, - >, - /// Frames in the capture. - /// - /// Field 6: `frame_count` - #[serde( - rename = "frameCount", - alias = "frame_count", - with = "::buffa::json_helpers::uint64" - )] - pub frame_count: u64, - /// Payload bytes across all frames, which is the size of the output as a user - /// understands it. Always smaller than ArtifactRef.size_bytes, which includes - /// framing overhead and the index. - /// - /// Field 7: `output_byte_count` - #[serde( - rename = "outputByteCount", - alias = "output_byte_count", - with = "::buffa::json_helpers::uint64" - )] - pub output_byte_count: u64, - /// Where the seek index sits inside the artifact. - /// - /// The index is a trailer, because a capturer streaming a running process does - /// not know it until the process exits and so cannot write it as a header. Its - /// location is recorded here so a reader can range-read the index directly, - /// rather than seeking relative to an end-of-object the artifact store might - /// report differently than the log does. - /// - /// Field 8: `index_offset` - #[serde( - rename = "indexOffset", - alias = "index_offset", - with = "::buffa::json_helpers::uint64" - )] - pub index_offset: u64, - /// Field 9: `index_length` - #[serde( - rename = "indexLength", - alias = "index_length", - with = "::buffa::json_helpers::uint64" - )] - pub index_length: u64, -} -impl ::core::fmt::Debug for CommandOutputReplayRef { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CommandOutputReplayRef") - .field("artifact", &self.artifact) - .field("format_version", &self.format_version) - .field("capture_mode", &self.capture_mode) - .field("timing", &self.timing) - .field("completeness", &self.completeness) - .field("frame_count", &self.frame_count) - .field("output_byte_count", &self.output_byte_count) - .field("index_offset", &self.index_offset) - .field("index_length", &self.index_length) - .finish() - } -} -impl CommandOutputReplayRef { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CommandOutputReplayRef"; -} -::buffa::impl_default_instance!(CommandOutputReplayRef); -impl ::buffa::MessageName for CommandOutputReplayRef { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CommandOutputReplayRef"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CommandOutputReplayRef"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CommandOutputReplayRef"; -} -impl ::buffa::Message for CommandOutputReplayRef { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.artifact.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.artifact.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.format_version) as u64; - { - let val = self.capture_mode.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - { - let val = self.timing.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.completeness.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.completeness.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.frame_count) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.output_byte_count) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.index_offset) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.index_length) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.artifact.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.artifact.write_to(__cache, buf); - } - ::buffa::types::put_uint32_field(2u32, self.format_version, buf); - ::buffa::types::put_int32_field(3u32, self.capture_mode.to_i32(), buf); - ::buffa::types::put_int32_field(4u32, self.timing.to_i32(), buf); - if self.completeness.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.completeness.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(6u32, self.frame_count, buf); - ::buffa::types::put_uint64_field(7u32, self.output_byte_count, buf); - ::buffa::types::put_uint64_field(8u32, self.index_offset, buf); - ::buffa::types::put_uint64_field(9u32, self.index_length, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.artifact.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.format_version = ::buffa::types::decode_uint32(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.capture_mode = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.timing = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.completeness.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.frame_count = ::buffa::types::decode_uint64(buf)?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.output_byte_count = ::buffa::types::decode_uint64(buf)?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.index_offset = ::buffa::types::decode_uint64(buf)?; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.index_length = ::buffa::types::decode_uint64(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.artifact = ::buffa::MessageField::none(); - self.format_version = 0u32; - self.capture_mode = ::buffa::EnumValue::from(0); - self.timing = ::buffa::EnumValue::from(0); - self.completeness = ::buffa::MessageField::none(); - self.frame_count = 0u64; - self.output_byte_count = 0u64; - self.index_offset = 0u64; - self.index_length = 0u64; - } -} -impl ::buffa::json_helpers::ProtoElemJson for CommandOutputReplayRef { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COMMAND_OUTPUT_REPLAY_REF_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CommandOutputReplayRef", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ReplayCompleteness is how much of the output survived capture. -/// -/// This is not ArtifactRef.truncated, which says a preview is shorter than its -/// content. This says the content is shorter than what the process emitted, and -/// names which end went missing, because for a command log that is the whole -/// question: losing the tail loses the failure, losing the head loses what was -/// run. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReplayCompleteness { - /// Unspecified is not complete. A reader that cannot recognize the shape must - /// treat the capture as of unknown completeness rather than whole. - /// - /// Field 1: `shape` - #[serde(rename = "shape", with = "::buffa::json_helpers::proto_enum")] - pub shape: ::buffa::EnumValue, - /// Payload bytes the capturer saw and did not retain. - /// - /// Unset means dropping occurred and was not counted, which a fixed-size ring - /// buffer that overwrites without accounting cannot avoid. Left absent rather - /// than reported as zero, because zero here would say nothing was lost. - /// - /// Field 2: `dropped_byte_count` - #[serde( - rename = "droppedByteCount", - alias = "dropped_byte_count", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub dropped_byte_count: ::core::option::Option, - /// Frames the capturer saw and did not retain, under the same rule. - /// - /// Field 3: `dropped_frame_count` - #[serde( - rename = "droppedFrameCount", - alias = "dropped_frame_count", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub dropped_frame_count: ::core::option::Option, -} -impl ::core::fmt::Debug for ReplayCompleteness { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReplayCompleteness") - .field("shape", &self.shape) - .field("dropped_byte_count", &self.dropped_byte_count) - .field("dropped_frame_count", &self.dropped_frame_count) - .finish() - } -} -impl ReplayCompleteness { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReplayCompleteness"; -} -impl ReplayCompleteness { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::dropped_byte_count`] to `Some(value)`, consuming and returning `self`. - pub fn with_dropped_byte_count(mut self, value: u64) -> Self { - self.dropped_byte_count = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::dropped_frame_count`] to `Some(value)`, consuming and returning `self`. - pub fn with_dropped_frame_count(mut self, value: u64) -> Self { - self.dropped_frame_count = Some(value); - self - } -} -::buffa::impl_default_instance!(ReplayCompleteness); -impl ::buffa::MessageName for ReplayCompleteness { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ReplayCompleteness"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ReplayCompleteness"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReplayCompleteness"; -} -impl ::buffa::Message for ReplayCompleteness { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.shape.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(v) = self.dropped_byte_count { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.dropped_frame_count { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.shape.to_i32(), buf); - if let Some(v) = self.dropped_byte_count { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if let Some(v) = self.dropped_frame_count { - ::buffa::types::put_uint64_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.shape = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.dropped_byte_count = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.dropped_frame_count = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.shape = ::buffa::EnumValue::from(0); - self.dropped_byte_count = ::core::option::Option::None; - self.dropped_frame_count = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReplayCompleteness { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REPLAY_COMPLETENESS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReplayCompleteness", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_termination.__oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_termination.__oneof.rs deleted file mode 100644 index 17ba51d20..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_termination.__oneof.rs +++ /dev/null @@ -1,34 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/command_termination.proto - -pub mod command_termination { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, PartialEq, Debug)] - pub enum Outcome { - ExitCode(i32), - Signal(i32), - } - impl ::buffa::Oneof for Outcome {} - impl serde::Serialize for Outcome { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::ExitCode(v) => { - map.serialize_entry( - "exitCode", - &::buffa::json_helpers::ProtoJson(v), - )?; - } - Self::Signal(v) => { - map.serialize_entry("signal", &::buffa::json_helpers::ProtoJson(v))?; - } - } - map.end() - } - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_termination.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_termination.__view.rs deleted file mode 100644 index 03f171062..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_termination.__view.rs +++ /dev/null @@ -1,335 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/command_termination.proto - -/// CommandTermination is how a process-executing tool call ended, kept as a -/// typed fact rather than left to be parsed back out of the tool's rendered -/// output. It belongs to ToolCallCompleted, which owns the execution and audit -/// fold, and deliberately not to ToolCallResult, which owns the provider-visible -/// transcript the model actually received (D11): an exit status the model never -/// saw must not enter the replay shape. -/// -/// A command that ran and exited non-zero is a ToolCallCompleted whose result -/// status is TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR and whose termination is -/// set. A command that never ran is a ToolCallFailed and carries no termination. -#[derive(Clone, Debug, Default)] -pub struct CommandTerminationView<'a> { - pub outcome: ::core::option::Option< - super::super::__buffa::view::oneof::command_termination::Outcome, - >, - #[doc(hidden)] - pub __buffa_phantom: ::core::marker::PhantomData<&'a ()>, -} -impl<'a> ::buffa::MessageView<'a> for CommandTerminationView<'a> { - type Owned = super::super::CommandTermination; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.outcome = Some( - super::super::__buffa::view::oneof::command_termination::Outcome::ExitCode( - ::buffa::types::decode_int32(&mut cur)?, - ), - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.outcome = Some( - super::super::__buffa::view::oneof::command_termination::Outcome::Signal( - ::buffa::types::decode_int32(&mut cur)?, - ), - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CommandTermination { - outcome: self - .outcome - .as_ref() - .map(|v| match v { - super::super::__buffa::view::oneof::command_termination::Outcome::ExitCode( - v, - ) => { - super::super::__buffa::oneof::command_termination::Outcome::ExitCode( - *v, - ) - } - super::super::__buffa::view::oneof::command_termination::Outcome::Signal( - v, - ) => { - super::super::__buffa::oneof::command_termination::Outcome::Signal( - *v, - ) - } - }), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CommandTerminationView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - super::super::__buffa::view::oneof::command_termination::Outcome::ExitCode( - v, - ) => { - size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; - } - super::super::__buffa::view::oneof::command_termination::Outcome::Signal( - v, - ) => { - size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; - } - } - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - super::super::__buffa::view::oneof::command_termination::Outcome::ExitCode( - x, - ) => { - ::buffa::types::put_int32_field(1u32, *x, buf); - } - super::super::__buffa::view::oneof::command_termination::Outcome::Signal( - x, - ) => { - ::buffa::types::put_int32_field(2u32, *x, buf); - } - } - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CommandTerminationView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - if let ::core::option::Option::Some(ref __ov) = self.outcome { - match __ov { - super::super::__buffa::view::oneof::command_termination::Outcome::ExitCode( - v, - ) => { - __map - .serialize_entry( - "exitCode", - &::buffa::json_helpers::ProtoJson(v), - )?; - } - super::super::__buffa::view::oneof::command_termination::Outcome::Signal( - v, - ) => { - __map - .serialize_entry( - "signal", - &::buffa::json_helpers::ProtoJson(v), - )?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CommandTerminationView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CommandTermination"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CommandTermination"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CommandTermination"; -} -::buffa::impl_default_view_instance!(CommandTerminationView); -::buffa::impl_view_reborrow!(CommandTerminationView); -/** Self-contained, `'static` owned view of a `CommandTermination` message. - - Wraps [`::buffa::OwnedView`]`<`[`CommandTerminationView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CommandTerminationView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CommandTerminationOwnedView( - ::buffa::OwnedView>, -); -impl CommandTerminationOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CommandTerminationOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CommandTerminationOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CommandTermination, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CommandTerminationOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CommandTerminationView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CommandTerminationView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CommandTermination { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Oneof `outcome`. - #[must_use] - pub fn outcome( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::command_termination::Outcome, - > { - self.0.reborrow().outcome.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CommandTerminationOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CommandTerminationOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CommandTerminationOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CommandTerminationOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CommandTermination { - type View<'a> = CommandTerminationView<'a>; - type ViewHandle = CommandTerminationOwnedView; -} -impl ::serde::Serialize for CommandTerminationOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_termination.__view_oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_termination.__view_oneof.rs deleted file mode 100644 index 8dff1c685..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_termination.__view_oneof.rs +++ /dev/null @@ -1,12 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/command_termination.proto - -pub mod command_termination { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Outcome { - ExitCode(i32), - Signal(i32), - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_termination.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_termination.rs deleted file mode 100644 index 4a29d12bf..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.command_termination.rs +++ /dev/null @@ -1,242 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/command_termination.proto - -/// CommandTermination is how a process-executing tool call ended, kept as a -/// typed fact rather than left to be parsed back out of the tool's rendered -/// output. It belongs to ToolCallCompleted, which owns the execution and audit -/// fold, and deliberately not to ToolCallResult, which owns the provider-visible -/// transcript the model actually received (D11): an exit status the model never -/// saw must not enter the replay shape. -/// -/// A command that ran and exited non-zero is a ToolCallCompleted whose result -/// status is TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR and whose termination is -/// set. A command that never ran is a ToolCallFailed and carries no termination. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct CommandTermination { - #[serde(flatten)] - pub outcome: ::core::option::Option<__buffa::oneof::command_termination::Outcome>, -} -impl ::core::fmt::Debug for CommandTermination { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CommandTermination").field("outcome", &self.outcome).finish() - } -} -impl CommandTermination { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CommandTermination"; -} -::buffa::impl_default_instance!(CommandTermination); -impl ::buffa::MessageName for CommandTermination { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CommandTermination"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CommandTermination"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CommandTermination"; -} -impl ::buffa::Message for CommandTermination { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - __buffa::oneof::command_termination::Outcome::ExitCode(v) => { - size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; - } - __buffa::oneof::command_termination::Outcome::Signal(v) => { - size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; - } - } - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - __buffa::oneof::command_termination::Outcome::ExitCode(x) => { - ::buffa::types::put_int32_field(1u32, *x, buf); - } - __buffa::oneof::command_termination::Outcome::Signal(x) => { - ::buffa::types::put_int32_field(2u32, *x, buf); - } - } - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.outcome = ::core::option::Option::Some( - __buffa::oneof::command_termination::Outcome::ExitCode( - ::buffa::types::decode_int32(buf)?, - ), - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.outcome = ::core::option::Option::Some( - __buffa::oneof::command_termination::Outcome::Signal( - ::buffa::types::decode_int32(buf)?, - ), - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.outcome = ::core::option::Option::None; - } -} -impl<'de> serde::Deserialize<'de> for CommandTermination { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = CommandTermination; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct CommandTermination") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __oneof_outcome: ::core::option::Option< - __buffa::oneof::command_termination::Outcome, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "exitCode" | "exit_code" => { - struct _DeserSeed; - impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed { - type Value = i32; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result { - ::buffa::json_helpers::int32::deserialize(d) - } - } - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed), - )?; - if let Some(v) = v { - if __oneof_outcome.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'outcome'", - ), - ); - } - __oneof_outcome = Some( - __buffa::oneof::command_termination::Outcome::ExitCode(v), - ); - } - } - "signal" => { - struct _DeserSeed; - impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed { - type Value = i32; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result { - ::buffa::json_helpers::int32::deserialize(d) - } - } - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed), - )?; - if let Some(v) = v { - if __oneof_outcome.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'outcome'", - ), - ); - } - __oneof_outcome = Some( - __buffa::oneof::command_termination::Outcome::Signal(v), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - __r.outcome = __oneof_outcome; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for CommandTermination { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COMMAND_TERMINATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CommandTermination", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod command_termination { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::command_termination::Outcome; - #[doc(inline)] - pub use super::__buffa::view::oneof::command_termination::Outcome as OutcomeView; -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compact_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compact_session.__view.rs deleted file mode 100644 index 96029e02e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compact_session.__view.rs +++ /dev/null @@ -1,885 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/compact_session.proto - -/// CompactSession replaces a covered span of history with a summary, recording -/// \[Compacted\]. The command carries the summary its producer generated; the -/// aggregate decides whether that cut is admissible. -/// -/// Write precondition At. The heaviest invariant set in the aggregate: the cut -/// must start at the context root, land between complete turn groups, leave a -/// non-empty complete-turn tail, include the prior usable marker, match the -/// plan-versioned covered input digest, and come from the current Ready attempt -/// (ADR#0035 facet 4). -#[derive(Clone, Debug, Default)] -pub struct CompactSessionView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `summary_id` - pub summary_id: &'a str, - /// Field 3: `summary_content` - pub summary_content: &'a str, - /// Field 4: `covers_from` - pub covers_from: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 5: `covers_through` - pub covers_through: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 6: `trigger` - pub trigger: ::buffa::EnumValue, - /// Field 7: `guidance` - pub guidance: ::core::option::Option<&'a str>, - /// Field 8: `tokens_before` - pub tokens_before: ::core::option::Option, - /// Field 9: `tokens_after` - pub tokens_after: ::core::option::Option, - /// Field 10: `model` - pub model: ::core::option::Option<&'a str>, - /// Field 11: `usage` - pub usage: ::buffa::MessageFieldView< - super::super::__buffa::view::TokenUsageView<'a>, - >, - /// Field 12: `context_root` - pub context_root: ::buffa::MessageFieldView< - super::super::__buffa::view::CompactionContextRootView<'a>, - >, - /// Field 13: `producer` - pub producer: ::buffa::MessageFieldView< - super::super::__buffa::view::CompactionProducerView<'a>, - >, - /// Digest over the plan-versioned covered input, recomputed and compared - /// before the cut is admitted. - /// - /// Field 14: `covered_input_digest` - pub covered_input_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CompactSessionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `summary_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_summary_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `summary_content` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_summary_content(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `covers_from` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_covers_from(&self) -> bool { - self.covers_from.is_set() - } - /**Whether required field `covers_through` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_covers_through(&self) -> bool { - self.covers_through.is_set() - } - /**Whether required field `trigger` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_trigger(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `context_root` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_context_root(&self) -> bool { - self.context_root.is_set() - } - /**Whether required field `producer` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_producer(&self) -> bool { - self.producer.is_set() - } - /**Whether required field `covered_input_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_covered_input_digest(&self) -> bool { - self.covered_input_digest.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for CompactSessionView<'a> { - type Owned = super::super::CompactSession; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.summary_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.summary_content = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.covers_from.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.covers_from = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.covers_through.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.covers_through = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.trigger = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 8u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.guidance = Some(::buffa::types::borrow_str(&mut cur)?); - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.tokens_before = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.tokens_after = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.model = Some(::buffa::types::borrow_str(&mut cur)?); - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.usage.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.usage = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.context_root.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.context_root = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.producer.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.producer = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 14u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.covered_input_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.covered_input_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CompactSession { - session_id: self.session_id.to_string(), - summary_id: self.summary_id.to_string(), - summary_content: self.summary_content.to_string(), - covers_from: match self.covers_from.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - covers_through: match self.covers_through.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - trigger: self.trigger, - guidance: self.guidance.map(|s| s.to_string()), - tokens_before: self.tokens_before, - tokens_after: self.tokens_after, - model: self.model.map(|s| s.to_string()), - usage: match self.usage.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::TokenUsage, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - context_root: match self.context_root.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CompactionContextRoot, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - producer: match self.producer.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CompactionProducer, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - covered_input_digest: match self.covered_input_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CompactSessionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary_content) as u64; - if self.covers_from.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_from.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covers_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.trigger.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.guidance { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(v) = self.tokens_before { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.tokens_after { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(ref v) = self.model { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.usage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.usage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.context_root.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.context_root.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.producer.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.producer.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covered_input_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covered_input_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.summary_id, buf); - ::buffa::types::put_string_field(3u32, &self.summary_content, buf); - if self.covers_from.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_from.write_to(__cache, buf); - } - if self.covers_through.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_through.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(6u32, self.trigger.to_i32(), buf); - if let Some(ref v) = self.guidance { - ::buffa::types::put_string_field(7u32, v, buf); - } - if let Some(v) = self.tokens_before { - ::buffa::types::put_uint64_field(8u32, v, buf); - } - if let Some(v) = self.tokens_after { - ::buffa::types::put_uint64_field(9u32, v, buf); - } - if let Some(ref v) = self.model { - ::buffa::types::put_string_field(10u32, v, buf); - } - if self.usage.is_set() { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - self.usage.write_to(__cache, buf); - } - if self.context_root.is_set() { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - self.context_root.write_to(__cache, buf); - } - if self.producer.is_set() { - ::buffa::types::put_len_delimited_header( - 13u32, - u64::from(__cache.consume_next()), - buf, - ); - self.producer.write_to(__cache, buf); - } - if self.covered_input_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 14u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covered_input_digest.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CompactSessionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("summaryId", self.summary_id)?; - } - { - __map.serialize_entry("summaryContent", self.summary_content)?; - } - { - if let ::core::option::Option::Some(__v) = self.covers_from.as_option() { - __map.serialize_entry("coversFrom", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.covers_through.as_option() { - __map.serialize_entry("coversThrough", __v)?; - } - } - { - __map.serialize_entry("trigger", &self.trigger)?; - } - if let ::core::option::Option::Some(__v) = self.guidance { - __map.serialize_entry("guidance", __v)?; - } - if let ::core::option::Option::Some(__v) = self.tokens_before { - __map - .serialize_entry( - "tokensBefore", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.tokens_after { - __map - .serialize_entry( - "tokensAfter", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.model { - __map.serialize_entry("model", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.usage.as_option() { - __map.serialize_entry("usage", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.context_root.as_option() { - __map.serialize_entry("contextRoot", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.producer.as_option() { - __map.serialize_entry("producer", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self - .covered_input_digest - .as_option() - { - __map.serialize_entry("coveredInputDigest", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CompactSessionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompactSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompactSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactSession"; -} -::buffa::impl_default_view_instance!(CompactSessionView); -::buffa::impl_view_reborrow!(CompactSessionView); -/** Self-contained, `'static` owned view of a `CompactSession` message. - - Wraps [`::buffa::OwnedView`]`<`[`CompactSessionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CompactSessionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CompactSessionOwnedView(::buffa::OwnedView>); -impl CompactSessionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactSessionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactSessionOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CompactSession, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactSessionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CompactSessionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CompactSessionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CompactSession { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `summary_id` - #[must_use] - pub fn summary_id(&self) -> &'_ str { - self.0.reborrow().summary_id - } - /// Field 3: `summary_content` - #[must_use] - pub fn summary_content(&self) -> &'_ str { - self.0.reborrow().summary_content - } - /// Field 4: `covers_from` - #[must_use] - pub fn covers_from( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().covers_from - } - /// Field 5: `covers_through` - #[must_use] - pub fn covers_through( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().covers_through - } - /// Field 6: `trigger` - #[must_use] - pub fn trigger(&self) -> ::buffa::EnumValue { - self.0.reborrow().trigger - } - /// Field 7: `guidance` - #[must_use] - pub fn guidance(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().guidance - } - /// Field 8: `tokens_before` - #[must_use] - pub fn tokens_before(&self) -> ::core::option::Option { - self.0.reborrow().tokens_before - } - /// Field 9: `tokens_after` - #[must_use] - pub fn tokens_after(&self) -> ::core::option::Option { - self.0.reborrow().tokens_after - } - /// Field 10: `model` - #[must_use] - pub fn model(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().model - } - /// Field 11: `usage` - #[must_use] - pub fn usage( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().usage - } - /// Field 12: `context_root` - #[must_use] - pub fn context_root( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CompactionContextRootView<'_>, - > { - &self.0.reborrow().context_root - } - /// Field 13: `producer` - #[must_use] - pub fn producer( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CompactionProducerView<'_>, - > { - &self.0.reborrow().producer - } - /// Digest over the plan-versioned covered input, recomputed and compared - /// before the cut is admitted. - /// - /// Field 14: `covered_input_digest` - #[must_use] - pub fn covered_input_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().covered_input_digest - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CompactSessionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CompactSessionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CompactSessionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CompactSessionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CompactSession { - type View<'a> = CompactSessionView<'a>; - type ViewHandle = CompactSessionOwnedView; -} -impl ::serde::Serialize for CompactSessionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compact_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compact_session.rs deleted file mode 100644 index 3e4d1c6d9..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compact_session.rs +++ /dev/null @@ -1,516 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/compact_session.proto - -/// CompactSession replaces a covered span of history with a summary, recording -/// \[Compacted\]. The command carries the summary its producer generated; the -/// aggregate decides whether that cut is admissible. -/// -/// Write precondition At. The heaviest invariant set in the aggregate: the cut -/// must start at the context root, land between complete turn groups, leave a -/// non-empty complete-turn tail, include the prior usable marker, match the -/// plan-versioned covered input digest, and come from the current Ready attempt -/// (ADR#0035 facet 4). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CompactSession { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `summary_id` - #[serde( - rename = "summaryId", - alias = "summary_id", - with = "::buffa::json_helpers::proto_string" - )] - pub summary_id: ::buffa::alloc::string::String, - /// Field 3: `summary_content` - #[serde( - rename = "summaryContent", - alias = "summary_content", - with = "::buffa::json_helpers::proto_string" - )] - pub summary_content: ::buffa::alloc::string::String, - /// Field 4: `covers_from` - #[serde(rename = "coversFrom", alias = "covers_from")] - pub covers_from: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Field 5: `covers_through` - #[serde(rename = "coversThrough", alias = "covers_through")] - pub covers_through: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Field 6: `trigger` - #[serde(rename = "trigger", with = "::buffa::json_helpers::proto_enum")] - pub trigger: ::buffa::EnumValue, - /// Field 7: `guidance` - #[serde( - rename = "guidance", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub guidance: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 8: `tokens_before` - #[serde( - rename = "tokensBefore", - alias = "tokens_before", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub tokens_before: ::core::option::Option, - /// Field 9: `tokens_after` - #[serde( - rename = "tokensAfter", - alias = "tokens_after", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub tokens_after: ::core::option::Option, - /// Field 10: `model` - #[serde(rename = "model", skip_serializing_if = "::core::option::Option::is_none")] - pub model: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 11: `usage` - #[serde( - rename = "usage", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub usage: ::buffa::MessageField>, - /// Field 12: `context_root` - #[serde(rename = "contextRoot", alias = "context_root")] - pub context_root: ::buffa::MessageField< - CompactionContextRoot, - ::buffa::Inline, - >, - /// Field 13: `producer` - #[serde(rename = "producer")] - pub producer: ::buffa::MessageField< - CompactionProducer, - ::buffa::Inline, - >, - /// Digest over the plan-versioned covered input, recomputed and compared - /// before the cut is admitted. - /// - /// Field 14: `covered_input_digest` - #[serde(rename = "coveredInputDigest", alias = "covered_input_digest")] - pub covered_input_digest: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for CompactSession { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CompactSession") - .field("session_id", &self.session_id) - .field("summary_id", &self.summary_id) - .field("summary_content", &self.summary_content) - .field("covers_from", &self.covers_from) - .field("covers_through", &self.covers_through) - .field("trigger", &self.trigger) - .field("guidance", &self.guidance) - .field("tokens_before", &self.tokens_before) - .field("tokens_after", &self.tokens_after) - .field("model", &self.model) - .field("usage", &self.usage) - .field("context_root", &self.context_root) - .field("producer", &self.producer) - .field("covered_input_digest", &self.covered_input_digest) - .finish() - } -} -impl CompactSession { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactSession"; -} -impl CompactSession { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::guidance`] to `Some(value)`, consuming and returning `self`. - pub fn with_guidance( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.guidance = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::tokens_before`] to `Some(value)`, consuming and returning `self`. - pub fn with_tokens_before(mut self, value: u64) -> Self { - self.tokens_before = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::tokens_after`] to `Some(value)`, consuming and returning `self`. - pub fn with_tokens_after(mut self, value: u64) -> Self { - self.tokens_after = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::model`] to `Some(value)`, consuming and returning `self`. - pub fn with_model( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.model = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(CompactSession); -impl ::buffa::MessageName for CompactSession { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompactSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompactSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactSession"; -} -impl ::buffa::Message for CompactSession { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary_content) as u64; - if self.covers_from.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_from.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covers_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.trigger.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.guidance { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(v) = self.tokens_before { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.tokens_after { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(ref v) = self.model { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.usage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.usage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.context_root.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.context_root.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.producer.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.producer.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covered_input_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covered_input_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.summary_id, buf); - ::buffa::types::put_string_field(3u32, &self.summary_content, buf); - if self.covers_from.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_from.write_to(__cache, buf); - } - if self.covers_through.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_through.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(6u32, self.trigger.to_i32(), buf); - if let Some(ref v) = self.guidance { - ::buffa::types::put_string_field(7u32, v, buf); - } - if let Some(v) = self.tokens_before { - ::buffa::types::put_uint64_field(8u32, v, buf); - } - if let Some(v) = self.tokens_after { - ::buffa::types::put_uint64_field(9u32, v, buf); - } - if let Some(ref v) = self.model { - ::buffa::types::put_string_field(10u32, v, buf); - } - if self.usage.is_set() { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - self.usage.write_to(__cache, buf); - } - if self.context_root.is_set() { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - self.context_root.write_to(__cache, buf); - } - if self.producer.is_set() { - ::buffa::types::put_len_delimited_header( - 13u32, - u64::from(__cache.consume_next()), - buf, - ); - self.producer.write_to(__cache, buf); - } - if self.covered_input_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 14u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covered_input_digest.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.summary_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.summary_content, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.covers_from.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.covers_through.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.trigger = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .guidance - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.tokens_before = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.tokens_after = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.model.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.usage.get_or_insert_default(), - buf, - ctx, - )?; - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.context_root.get_or_insert_default(), - buf, - ctx, - )?; - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.producer.get_or_insert_default(), - buf, - ctx, - )?; - } - 14u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.covered_input_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.summary_id.clear(); - self.summary_content.clear(); - self.covers_from = ::buffa::MessageField::none(); - self.covers_through = ::buffa::MessageField::none(); - self.trigger = ::buffa::EnumValue::from(0); - self.guidance = ::core::option::Option::None; - self.tokens_before = ::core::option::Option::None; - self.tokens_after = ::core::option::Option::None; - self.model = ::core::option::Option::None; - self.usage = ::buffa::MessageField::none(); - self.context_root = ::buffa::MessageField::none(); - self.producer = ::buffa::MessageField::none(); - self.covered_input_digest = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CompactSession { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COMPACT_SESSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactSession", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compacted.__oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compacted.__oneof.rs deleted file mode 100644 index bc57e8a88..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compacted.__oneof.rs +++ /dev/null @@ -1,57 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/compacted.proto - -pub mod compaction_context_root { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, PartialEq, Debug)] - pub enum Root { - SessionStart( - ::buffa::alloc::boxed::Box, - ), - InheritedPrefix( - ::buffa::alloc::boxed::Box, - ), - } - impl ::buffa::Oneof for Root {} - impl From for Root { - fn from(v: super::super::super::CompactionSessionStart) -> Self { - Self::SessionStart(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::CompactionSessionStart) -> Self { - Self::Some(Root::from(v)) - } - } - impl From for Root { - fn from(v: super::super::super::CompactionInheritedPrefix) -> Self { - Self::InheritedPrefix(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::CompactionInheritedPrefix) -> Self { - Self::Some(Root::from(v)) - } - } - impl serde::Serialize for Root { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::SessionStart(v) => { - map.serialize_entry("sessionStart", v)?; - } - Self::InheritedPrefix(v) => { - map.serialize_entry("inheritedPrefix", v)?; - } - } - map.end() - } - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compacted.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compacted.__view.rs deleted file mode 100644 index 7488ccc82..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compacted.__view.rs +++ /dev/null @@ -1,2261 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/compacted.proto - -/// Compacted is a self-sufficient in-stream compaction marker the store only -/// records (ADR#0035 facet 4); summary content is inline. covers_from and -/// covers_through are this session's own fold-derived SessionOrdinal positions, -/// both inclusive, delimiting the effective own-stream prefix the summary -/// replaces in the model-visible view, validated as an ordered range -/// (covers_from \<= covers_through). Rewind filtering and privacy masks run first. -/// A marker is usable only while it is not directly redacted and its -/// covered_input_digest still matches the exact effective masked covered input. -/// The view folds from the newest usable Compacted summary plus every effective -/// event strictly after covers_through. A successor cut includes the prior usable -/// Compacted marker ordinal so its self-sufficient summary cannot depend on an -/// older marker that the newest-marker fold will omit. Covered events stay on -/// the stream (keep-forever), so invalidation can expose an earlier usable marker -/// without a structured replacement set. Because this fold reads only -/// covers_through from the selected marker, covers_from is validated as 1: -/// every compaction re-covers the effective own-stream prefix and only -/// covers_through advances. context_root identifies the logical beginning that -/// precedes that own-stream prefix, including an immutable source prefix -/// inherited by a fork. A covers_from past the own-stream start would otherwise -/// pass validation and silently drop earlier effective events. It is -/// invariant-bearing, admitting one active compaction at a selected head, -/// guarded by WRITE_PRECONDITION = At(current_position). -#[derive(Clone, Debug, Default)] -pub struct CompactedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `summary_id` - pub summary_id: &'a str, - /// Field 3: `summary_content` - pub summary_content: &'a str, - /// Field 4: `covers_from` - pub covers_from: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 5: `covers_through` - pub covers_through: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Why compaction fired; a command-time input not derivable from the log. - /// - /// Field 6: `trigger` - pub trigger: ::buffa::EnumValue, - /// Optional user guidance steering the summarizer; empty when none. - /// - /// Field 7: `guidance` - pub guidance: ::core::option::Option<&'a str>, - /// Transcript token counts measured at compaction time; recorded because - /// tokenizer output is not deterministically recomputable later. Unset when the - /// compactor did not measure them. - /// - /// Field 8: `tokens_before` - pub tokens_before: ::core::option::Option, - /// Field 9: `tokens_after` - pub tokens_after: ::core::option::Option, - /// Optional provider-reported model telemetry for the summary-producing - /// invocation. It is not authoritative identity; exact selection comes from - /// the producer plan digest and typed role joined by the Session command. - /// - /// Field 10: `model` - pub model: ::core::option::Option<&'a str>, - /// Field 11: `usage` - pub usage: ::buffa::MessageFieldView< - super::super::__buffa::view::TokenUsageView<'a>, - >, - /// Logical root of the context replaced by this summary. Forks repeat their - /// inherited source tuple here because child ordinals cannot address it. - /// - /// Field 12: `context_root` - pub context_root: ::buffa::MessageFieldView< - super::super::__buffa::view::CompactionContextRootView<'a>, - >, - /// Evidence binding the summary to the immutable execution plan and the - /// platform-owned attempt that produced it. Authorization is established by - /// the Session command's history and plan joins, not by these fields alone. - /// - /// Field 13: `producer` - pub producer: ::buffa::MessageFieldView< - super::super::__buffa::view::CompactionProducerView<'a>, - >, - /// Plan-versioned digest of the exact effective privacy-masked covered input - /// summarized by this marker. - /// - /// Field 14: `covered_input_digest` - pub covered_input_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CompactedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `summary_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_summary_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `summary_content` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_summary_content(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `covers_from` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_covers_from(&self) -> bool { - self.covers_from.is_set() - } - /**Whether required field `covers_through` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_covers_through(&self) -> bool { - self.covers_through.is_set() - } - /**Whether required field `trigger` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_trigger(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `context_root` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_context_root(&self) -> bool { - self.context_root.is_set() - } - /**Whether required field `producer` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_producer(&self) -> bool { - self.producer.is_set() - } - /**Whether required field `covered_input_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_covered_input_digest(&self) -> bool { - self.covered_input_digest.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for CompactedView<'a> { - type Owned = super::super::Compacted; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.summary_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.summary_content = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.covers_from.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.covers_from = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.covers_through.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.covers_through = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.trigger = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 8u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.guidance = Some(::buffa::types::borrow_str(&mut cur)?); - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.tokens_before = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.tokens_after = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.model = Some(::buffa::types::borrow_str(&mut cur)?); - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.usage.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.usage = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.context_root.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.context_root = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.producer.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.producer = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 14u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.covered_input_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.covered_input_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::Compacted { - session_id: self.session_id.to_string(), - summary_id: self.summary_id.to_string(), - summary_content: self.summary_content.to_string(), - covers_from: match self.covers_from.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - covers_through: match self.covers_through.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - trigger: self.trigger, - guidance: self.guidance.map(|s| s.to_string()), - tokens_before: self.tokens_before, - tokens_after: self.tokens_after, - model: self.model.map(|s| s.to_string()), - usage: match self.usage.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::TokenUsage, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - context_root: match self.context_root.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CompactionContextRoot, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - producer: match self.producer.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CompactionProducer, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - covered_input_digest: match self.covered_input_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CompactedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary_content) as u64; - if self.covers_from.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_from.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covers_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.trigger.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.guidance { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(v) = self.tokens_before { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.tokens_after { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(ref v) = self.model { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.usage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.usage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.context_root.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.context_root.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.producer.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.producer.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covered_input_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covered_input_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.summary_id, buf); - ::buffa::types::put_string_field(3u32, &self.summary_content, buf); - if self.covers_from.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_from.write_to(__cache, buf); - } - if self.covers_through.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_through.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(6u32, self.trigger.to_i32(), buf); - if let Some(ref v) = self.guidance { - ::buffa::types::put_string_field(7u32, v, buf); - } - if let Some(v) = self.tokens_before { - ::buffa::types::put_uint64_field(8u32, v, buf); - } - if let Some(v) = self.tokens_after { - ::buffa::types::put_uint64_field(9u32, v, buf); - } - if let Some(ref v) = self.model { - ::buffa::types::put_string_field(10u32, v, buf); - } - if self.usage.is_set() { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - self.usage.write_to(__cache, buf); - } - if self.context_root.is_set() { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - self.context_root.write_to(__cache, buf); - } - if self.producer.is_set() { - ::buffa::types::put_len_delimited_header( - 13u32, - u64::from(__cache.consume_next()), - buf, - ); - self.producer.write_to(__cache, buf); - } - if self.covered_input_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 14u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covered_input_digest.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CompactedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("summaryId", self.summary_id)?; - } - { - __map.serialize_entry("summaryContent", self.summary_content)?; - } - { - if let ::core::option::Option::Some(__v) = self.covers_from.as_option() { - __map.serialize_entry("coversFrom", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.covers_through.as_option() { - __map.serialize_entry("coversThrough", __v)?; - } - } - { - __map.serialize_entry("trigger", &self.trigger)?; - } - if let ::core::option::Option::Some(__v) = self.guidance { - __map.serialize_entry("guidance", __v)?; - } - if let ::core::option::Option::Some(__v) = self.tokens_before { - __map - .serialize_entry( - "tokensBefore", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.tokens_after { - __map - .serialize_entry( - "tokensAfter", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.model { - __map.serialize_entry("model", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.usage.as_option() { - __map.serialize_entry("usage", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.context_root.as_option() { - __map.serialize_entry("contextRoot", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.producer.as_option() { - __map.serialize_entry("producer", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self - .covered_input_digest - .as_option() - { - __map.serialize_entry("coveredInputDigest", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CompactedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "Compacted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.Compacted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.Compacted"; -} -::buffa::impl_default_view_instance!(CompactedView); -::buffa::impl_view_reborrow!(CompactedView); -/** Self-contained, `'static` owned view of a `Compacted` message. - - Wraps [`::buffa::OwnedView`]`<`[`CompactedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CompactedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CompactedOwnedView(::buffa::OwnedView>); -impl CompactedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactedOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::Compacted, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CompactedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CompactedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::Compacted { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `summary_id` - #[must_use] - pub fn summary_id(&self) -> &'_ str { - self.0.reborrow().summary_id - } - /// Field 3: `summary_content` - #[must_use] - pub fn summary_content(&self) -> &'_ str { - self.0.reborrow().summary_content - } - /// Field 4: `covers_from` - #[must_use] - pub fn covers_from( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().covers_from - } - /// Field 5: `covers_through` - #[must_use] - pub fn covers_through( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().covers_through - } - /// Why compaction fired; a command-time input not derivable from the log. - /// - /// Field 6: `trigger` - #[must_use] - pub fn trigger(&self) -> ::buffa::EnumValue { - self.0.reborrow().trigger - } - /// Optional user guidance steering the summarizer; empty when none. - /// - /// Field 7: `guidance` - #[must_use] - pub fn guidance(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().guidance - } - /// Transcript token counts measured at compaction time; recorded because - /// tokenizer output is not deterministically recomputable later. Unset when the - /// compactor did not measure them. - /// - /// Field 8: `tokens_before` - #[must_use] - pub fn tokens_before(&self) -> ::core::option::Option { - self.0.reborrow().tokens_before - } - /// Field 9: `tokens_after` - #[must_use] - pub fn tokens_after(&self) -> ::core::option::Option { - self.0.reborrow().tokens_after - } - /// Optional provider-reported model telemetry for the summary-producing - /// invocation. It is not authoritative identity; exact selection comes from - /// the producer plan digest and typed role joined by the Session command. - /// - /// Field 10: `model` - #[must_use] - pub fn model(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().model - } - /// Field 11: `usage` - #[must_use] - pub fn usage( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().usage - } - /// Logical root of the context replaced by this summary. Forks repeat their - /// inherited source tuple here because child ordinals cannot address it. - /// - /// Field 12: `context_root` - #[must_use] - pub fn context_root( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CompactionContextRootView<'_>, - > { - &self.0.reborrow().context_root - } - /// Evidence binding the summary to the immutable execution plan and the - /// platform-owned attempt that produced it. Authorization is established by - /// the Session command's history and plan joins, not by these fields alone. - /// - /// Field 13: `producer` - #[must_use] - pub fn producer( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CompactionProducerView<'_>, - > { - &self.0.reborrow().producer - } - /// Plan-versioned digest of the exact effective privacy-masked covered input - /// summarized by this marker. - /// - /// Field 14: `covered_input_digest` - #[must_use] - pub fn covered_input_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().covered_input_digest - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CompactedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CompactedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CompactedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CompactedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::Compacted { - type View<'a> = CompactedView<'a>; - type ViewHandle = CompactedOwnedView; -} -impl ::serde::Serialize for CompactedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// CompactionContextRoot makes the logical beginning of covered context -/// explicit when own-stream ordinal 1 is not the beginning of a fork's view. -#[derive(Clone, Debug, Default)] -pub struct CompactionContextRootView<'a> { - pub root: ::core::option::Option< - super::super::__buffa::view::oneof::compaction_context_root::Root<'a>, - >, -} -impl<'a> ::buffa::MessageView<'a> for CompactionContextRootView<'a> { - type Owned = super::super::CompactionContextRoot; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::compaction_context_root::Root::SessionStart( - ref mut existing, - ), - ) = view.root - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.root = Some( - super::super::__buffa::view::oneof::compaction_context_root::Root::SessionStart( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::compaction_context_root::Root::InheritedPrefix( - ref mut existing, - ), - ) = view.root - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.root = Some( - super::super::__buffa::view::oneof::compaction_context_root::Root::InheritedPrefix( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::CompactionContextRoot, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::CompactionContextRoot, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CompactionContextRoot { - root: match self.root.as_ref() { - ::core::option::Option::Some(v) => { - ::core::option::Option::Some( - match v { - super::super::__buffa::view::oneof::compaction_context_root::Root::SessionStart( - v, - ) => { - super::super::__buffa::oneof::compaction_context_root::Root::SessionStart( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::compaction_context_root::Root::InheritedPrefix( - v, - ) => { - super::super::__buffa::oneof::compaction_context_root::Root::InheritedPrefix( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - }, - ) - } - ::core::option::Option::None => ::core::option::Option::None, - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CompactionContextRootView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let ::core::option::Option::Some(ref v) = self.root { - match v { - super::super::__buffa::view::oneof::compaction_context_root::Root::SessionStart( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::compaction_context_root::Root::InheritedPrefix( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let ::core::option::Option::Some(ref v) = self.root { - match v { - super::super::__buffa::view::oneof::compaction_context_root::Root::SessionStart( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::compaction_context_root::Root::InheritedPrefix( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CompactionContextRootView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - if let ::core::option::Option::Some(ref __ov) = self.root { - match __ov { - super::super::__buffa::view::oneof::compaction_context_root::Root::SessionStart( - v, - ) => { - __map.serialize_entry("sessionStart", v)?; - } - super::super::__buffa::view::oneof::compaction_context_root::Root::InheritedPrefix( - v, - ) => { - __map.serialize_entry("inheritedPrefix", v)?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CompactionContextRootView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompactionContextRoot"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompactionContextRoot"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionContextRoot"; -} -::buffa::impl_default_view_instance!(CompactionContextRootView); -::buffa::impl_view_reborrow!(CompactionContextRootView); -/** Self-contained, `'static` owned view of a `CompactionContextRoot` message. - - Wraps [`::buffa::OwnedView`]`<`[`CompactionContextRootView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CompactionContextRootView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CompactionContextRootOwnedView( - ::buffa::OwnedView>, -); -impl CompactionContextRootOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionContextRootOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionContextRootOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CompactionContextRoot, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionContextRootOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CompactionContextRootView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CompactionContextRootView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CompactionContextRoot { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Oneof `root`. - #[must_use] - pub fn root( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::compaction_context_root::Root<'_>, - > { - self.0.reborrow().root.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CompactionContextRootOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CompactionContextRootOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CompactionContextRootOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CompactionContextRootOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CompactionContextRoot { - type View<'a> = CompactionContextRootView<'a>; - type ViewHandle = CompactionContextRootOwnedView; -} -impl ::serde::Serialize for CompactionContextRootOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// CompactionSessionStart marks a context rooted at this session's start. -#[derive(Clone, Debug, Default)] -pub struct CompactionSessionStartView<'a> { - #[doc(hidden)] - pub __buffa_phantom: ::core::marker::PhantomData<&'a ()>, -} -impl<'a> ::buffa::MessageView<'a> for CompactionSessionStartView<'a> { - type Owned = super::super::CompactionSessionStart; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::CompactionSessionStart, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::CompactionSessionStart, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CompactionSessionStart { - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CompactionSessionStartView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let size = 0u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - _buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CompactionSessionStartView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - __map.end() - } -} -impl<'a> ::buffa::MessageName for CompactionSessionStartView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompactionSessionStart"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompactionSessionStart"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionSessionStart"; -} -::buffa::impl_default_view_instance!(CompactionSessionStartView); -::buffa::impl_view_reborrow!(CompactionSessionStartView); -/** Self-contained, `'static` owned view of a `CompactionSessionStart` message. - - Wraps [`::buffa::OwnedView`]`<`[`CompactionSessionStartView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CompactionSessionStartView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CompactionSessionStartOwnedView( - ::buffa::OwnedView>, -); -impl CompactionSessionStartOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionSessionStartOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionSessionStartOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CompactionSessionStart, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionSessionStartOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CompactionSessionStartView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CompactionSessionStartView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CompactionSessionStart { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CompactionSessionStartOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CompactionSessionStartOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CompactionSessionStartOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CompactionSessionStartOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CompactionSessionStart { - type View<'a> = CompactionSessionStartView<'a>; - type ViewHandle = CompactionSessionStartOwnedView; -} -impl ::serde::Serialize for CompactionSessionStartOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// CompactionInheritedPrefix preserves the immutable source prefix identity a -/// fork inherited, since that prefix is outside the child stream's ordinals. -#[derive(Clone, Debug, Default)] -pub struct CompactionInheritedPrefixView<'a> { - /// Field 1: `source_session_id` - pub source_session_id: &'a str, - /// Field 2: `context_prefix_boundary` - pub context_prefix_boundary: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CompactionInheritedPrefixView<'a> { - /**Whether required field `source_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `context_prefix_boundary` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_context_prefix_boundary(&self) -> bool { - self.context_prefix_boundary.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for CompactionInheritedPrefixView<'a> { - type Owned = super::super::CompactionInheritedPrefix; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.context_prefix_boundary.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.context_prefix_boundary = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::CompactionInheritedPrefix, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::CompactionInheritedPrefix, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CompactionInheritedPrefix { - source_session_id: self.source_session_id.to_string(), - context_prefix_boundary: match self.context_prefix_boundary.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CompactionInheritedPrefixView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.context_prefix_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.context_prefix_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - if self.context_prefix_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.context_prefix_boundary.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CompactionInheritedPrefixView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sourceSessionId", self.source_session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self - .context_prefix_boundary - .as_option() - { - __map.serialize_entry("contextPrefixBoundary", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CompactionInheritedPrefixView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompactionInheritedPrefix"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompactionInheritedPrefix"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionInheritedPrefix"; -} -::buffa::impl_default_view_instance!(CompactionInheritedPrefixView); -::buffa::impl_view_reborrow!(CompactionInheritedPrefixView); -/** Self-contained, `'static` owned view of a `CompactionInheritedPrefix` message. - - Wraps [`::buffa::OwnedView`]`<`[`CompactionInheritedPrefixView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CompactionInheritedPrefixView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CompactionInheritedPrefixOwnedView( - ::buffa::OwnedView>, -); -impl CompactionInheritedPrefixOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionInheritedPrefixOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionInheritedPrefixOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CompactionInheritedPrefix, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionInheritedPrefixOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CompactionInheritedPrefixView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CompactionInheritedPrefixView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CompactionInheritedPrefix { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `source_session_id` - #[must_use] - pub fn source_session_id(&self) -> &'_ str { - self.0.reborrow().source_session_id - } - /// Field 2: `context_prefix_boundary` - #[must_use] - pub fn context_prefix_boundary( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().context_prefix_boundary - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CompactionInheritedPrefixOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CompactionInheritedPrefixOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CompactionInheritedPrefixOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CompactionInheritedPrefixOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CompactionInheritedPrefix { - type View<'a> = CompactionInheritedPrefixView<'a>; - type ViewHandle = CompactionInheritedPrefixOwnedView; -} -impl ::serde::Serialize for CompactionInheritedPrefixOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// CompactionProducer records attribution evidence for the execution context -/// that produced the summary. The Session command validates this evidence -/// against folded attempt history and the immutable execution plan. -#[derive(Clone, Debug, Default)] -pub struct CompactionProducerView<'a> { - /// Field 1: `producing_execution_attempt_id` - pub producing_execution_attempt_id: &'a str, - /// Field 2: `session_execution_plan_digest` - pub session_execution_plan_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Field 3: `model_role` - pub model_role: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CompactionProducerView<'a> { - /**Whether required field `producing_execution_attempt_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_producing_execution_attempt_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `session_execution_plan_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_execution_plan_digest(&self) -> bool { - self.session_execution_plan_digest.is_set() - } - /**Whether required field `model_role` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_model_role(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for CompactionProducerView<'a> { - type Owned = super::super::CompactionProducer; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.producing_execution_attempt_id = ::buffa::types::borrow_str( - &mut cur, - )?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.session_execution_plan_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.session_execution_plan_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.model_role = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CompactionProducer { - producing_execution_attempt_id: self - .producing_execution_attempt_id - .to_string(), - session_execution_plan_digest: match self - .session_execution_plan_digest - .as_option() - { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - model_role: self.model_role, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CompactionProducerView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 - + ::buffa::types::string_encoded_len( - &self.producing_execution_attempt_id, - ) as u64; - if self.session_execution_plan_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.session_execution_plan_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.model_role.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field( - 1u32, - &self.producing_execution_attempt_id, - buf, - ); - if self.session_execution_plan_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.session_execution_plan_digest.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.model_role.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CompactionProducerView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "producingExecutionAttemptId", - self.producing_execution_attempt_id, - )?; - } - { - if let ::core::option::Option::Some(__v) = self - .session_execution_plan_digest - .as_option() - { - __map.serialize_entry("sessionExecutionPlanDigest", __v)?; - } - } - { - __map.serialize_entry("modelRole", &self.model_role)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CompactionProducerView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompactionProducer"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompactionProducer"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionProducer"; -} -::buffa::impl_default_view_instance!(CompactionProducerView); -::buffa::impl_view_reborrow!(CompactionProducerView); -/** Self-contained, `'static` owned view of a `CompactionProducer` message. - - Wraps [`::buffa::OwnedView`]`<`[`CompactionProducerView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CompactionProducerView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CompactionProducerOwnedView( - ::buffa::OwnedView>, -); -impl CompactionProducerOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionProducerOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionProducerOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CompactionProducer, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompactionProducerOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CompactionProducerView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CompactionProducerView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CompactionProducer { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `producing_execution_attempt_id` - #[must_use] - pub fn producing_execution_attempt_id(&self) -> &'_ str { - self.0.reborrow().producing_execution_attempt_id - } - /// Field 2: `session_execution_plan_digest` - #[must_use] - pub fn session_execution_plan_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().session_execution_plan_digest - } - /// Field 3: `model_role` - #[must_use] - pub fn model_role(&self) -> ::buffa::EnumValue { - self.0.reborrow().model_role - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CompactionProducerOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CompactionProducerOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CompactionProducerOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CompactionProducerOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CompactionProducer { - type View<'a> = CompactionProducerView<'a>; - type ViewHandle = CompactionProducerOwnedView; -} -impl ::serde::Serialize for CompactionProducerOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compacted.__view_oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compacted.__view_oneof.rs deleted file mode 100644 index 2306244a2..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compacted.__view_oneof.rs +++ /dev/null @@ -1,22 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/compacted.proto - -pub mod compaction_context_root { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Root<'a> { - SessionStart( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::CompactionSessionStartView<'a>, - >, - ), - InheritedPrefix( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::CompactionInheritedPrefixView< - 'a, - >, - >, - ), - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compacted.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compacted.rs deleted file mode 100644 index c8ce7a2d2..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.compacted.rs +++ /dev/null @@ -1,1566 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/compacted.proto - -/// CompactionModelRole distinguishes the plan-owned primary model from the only -/// auxiliary role permitted to produce a compaction summary. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum CompactionModelRole { - COMPACTION_MODEL_ROLE_UNSPECIFIED = 0i32, - COMPACTION_MODEL_ROLE_PRIMARY = 1i32, - COMPACTION_MODEL_ROLE_AUXILIARY_COMPACTION = 2i32, -} -impl CompactionModelRole { - ///Idiomatic alias for [`Self::COMPACTION_MODEL_ROLE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::COMPACTION_MODEL_ROLE_UNSPECIFIED; - ///Idiomatic alias for [`Self::COMPACTION_MODEL_ROLE_PRIMARY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Primary: Self = Self::COMPACTION_MODEL_ROLE_PRIMARY; - ///Idiomatic alias for [`Self::COMPACTION_MODEL_ROLE_AUXILIARY_COMPACTION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const AuxiliaryCompaction: Self = Self::COMPACTION_MODEL_ROLE_AUXILIARY_COMPACTION; -} -impl ::core::default::Default for CompactionModelRole { - fn default() -> Self { - Self::COMPACTION_MODEL_ROLE_UNSPECIFIED - } -} -impl ::serde::Serialize for CompactionModelRole { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for CompactionModelRole { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = CompactionModelRole; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(CompactionModelRole) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for CompactionModelRole { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for CompactionModelRole { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::COMPACTION_MODEL_ROLE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::COMPACTION_MODEL_ROLE_PRIMARY), - 2i32 => { - ::core::option::Option::Some( - Self::COMPACTION_MODEL_ROLE_AUXILIARY_COMPACTION, - ) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::COMPACTION_MODEL_ROLE_UNSPECIFIED => { - "COMPACTION_MODEL_ROLE_UNSPECIFIED" - } - Self::COMPACTION_MODEL_ROLE_PRIMARY => "COMPACTION_MODEL_ROLE_PRIMARY", - Self::COMPACTION_MODEL_ROLE_AUXILIARY_COMPACTION => { - "COMPACTION_MODEL_ROLE_AUXILIARY_COMPACTION" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "COMPACTION_MODEL_ROLE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::COMPACTION_MODEL_ROLE_UNSPECIFIED) - } - "COMPACTION_MODEL_ROLE_PRIMARY" => { - ::core::option::Option::Some(Self::COMPACTION_MODEL_ROLE_PRIMARY) - } - "COMPACTION_MODEL_ROLE_AUXILIARY_COMPACTION" => { - ::core::option::Option::Some( - Self::COMPACTION_MODEL_ROLE_AUXILIARY_COMPACTION, - ) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::COMPACTION_MODEL_ROLE_UNSPECIFIED, - Self::COMPACTION_MODEL_ROLE_PRIMARY, - Self::COMPACTION_MODEL_ROLE_AUXILIARY_COMPACTION, - ] - } -} -/// CompactionTrigger is why a compaction fired. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum CompactionTrigger { - COMPACTION_TRIGGER_UNSPECIFIED = 0i32, - /// Explicitly requested. - COMPACTION_TRIGGER_MANUAL = 1i32, - /// Fired when the transcript crossed a token threshold. - COMPACTION_TRIGGER_TOKEN_THRESHOLD = 2i32, - /// Fired reactively after a context-length overflow. - COMPACTION_TRIGGER_CONTEXT_OVERFLOW = 3i32, -} -impl CompactionTrigger { - ///Idiomatic alias for [`Self::COMPACTION_TRIGGER_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::COMPACTION_TRIGGER_UNSPECIFIED; - ///Idiomatic alias for [`Self::COMPACTION_TRIGGER_MANUAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Manual: Self = Self::COMPACTION_TRIGGER_MANUAL; - ///Idiomatic alias for [`Self::COMPACTION_TRIGGER_TOKEN_THRESHOLD`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const TokenThreshold: Self = Self::COMPACTION_TRIGGER_TOKEN_THRESHOLD; - ///Idiomatic alias for [`Self::COMPACTION_TRIGGER_CONTEXT_OVERFLOW`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ContextOverflow: Self = Self::COMPACTION_TRIGGER_CONTEXT_OVERFLOW; -} -impl ::core::default::Default for CompactionTrigger { - fn default() -> Self { - Self::COMPACTION_TRIGGER_UNSPECIFIED - } -} -impl ::serde::Serialize for CompactionTrigger { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for CompactionTrigger { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = CompactionTrigger; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(CompactionTrigger) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for CompactionTrigger { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for CompactionTrigger { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::COMPACTION_TRIGGER_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::COMPACTION_TRIGGER_MANUAL), - 2i32 => { - ::core::option::Option::Some(Self::COMPACTION_TRIGGER_TOKEN_THRESHOLD) - } - 3i32 => { - ::core::option::Option::Some(Self::COMPACTION_TRIGGER_CONTEXT_OVERFLOW) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::COMPACTION_TRIGGER_UNSPECIFIED => "COMPACTION_TRIGGER_UNSPECIFIED", - Self::COMPACTION_TRIGGER_MANUAL => "COMPACTION_TRIGGER_MANUAL", - Self::COMPACTION_TRIGGER_TOKEN_THRESHOLD => { - "COMPACTION_TRIGGER_TOKEN_THRESHOLD" - } - Self::COMPACTION_TRIGGER_CONTEXT_OVERFLOW => { - "COMPACTION_TRIGGER_CONTEXT_OVERFLOW" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "COMPACTION_TRIGGER_UNSPECIFIED" => { - ::core::option::Option::Some(Self::COMPACTION_TRIGGER_UNSPECIFIED) - } - "COMPACTION_TRIGGER_MANUAL" => { - ::core::option::Option::Some(Self::COMPACTION_TRIGGER_MANUAL) - } - "COMPACTION_TRIGGER_TOKEN_THRESHOLD" => { - ::core::option::Option::Some(Self::COMPACTION_TRIGGER_TOKEN_THRESHOLD) - } - "COMPACTION_TRIGGER_CONTEXT_OVERFLOW" => { - ::core::option::Option::Some(Self::COMPACTION_TRIGGER_CONTEXT_OVERFLOW) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::COMPACTION_TRIGGER_UNSPECIFIED, - Self::COMPACTION_TRIGGER_MANUAL, - Self::COMPACTION_TRIGGER_TOKEN_THRESHOLD, - Self::COMPACTION_TRIGGER_CONTEXT_OVERFLOW, - ] - } -} -/// Compacted is a self-sufficient in-stream compaction marker the store only -/// records (ADR#0035 facet 4); summary content is inline. covers_from and -/// covers_through are this session's own fold-derived SessionOrdinal positions, -/// both inclusive, delimiting the effective own-stream prefix the summary -/// replaces in the model-visible view, validated as an ordered range -/// (covers_from \<= covers_through). Rewind filtering and privacy masks run first. -/// A marker is usable only while it is not directly redacted and its -/// covered_input_digest still matches the exact effective masked covered input. -/// The view folds from the newest usable Compacted summary plus every effective -/// event strictly after covers_through. A successor cut includes the prior usable -/// Compacted marker ordinal so its self-sufficient summary cannot depend on an -/// older marker that the newest-marker fold will omit. Covered events stay on -/// the stream (keep-forever), so invalidation can expose an earlier usable marker -/// without a structured replacement set. Because this fold reads only -/// covers_through from the selected marker, covers_from is validated as 1: -/// every compaction re-covers the effective own-stream prefix and only -/// covers_through advances. context_root identifies the logical beginning that -/// precedes that own-stream prefix, including an immutable source prefix -/// inherited by a fork. A covers_from past the own-stream start would otherwise -/// pass validation and silently drop earlier effective events. It is -/// invariant-bearing, admitting one active compaction at a selected head, -/// guarded by WRITE_PRECONDITION = At(current_position). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct Compacted { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `summary_id` - #[serde( - rename = "summaryId", - alias = "summary_id", - with = "::buffa::json_helpers::proto_string" - )] - pub summary_id: ::buffa::alloc::string::String, - /// Field 3: `summary_content` - #[serde( - rename = "summaryContent", - alias = "summary_content", - with = "::buffa::json_helpers::proto_string" - )] - pub summary_content: ::buffa::alloc::string::String, - /// Field 4: `covers_from` - #[serde(rename = "coversFrom", alias = "covers_from")] - pub covers_from: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Field 5: `covers_through` - #[serde(rename = "coversThrough", alias = "covers_through")] - pub covers_through: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Why compaction fired; a command-time input not derivable from the log. - /// - /// Field 6: `trigger` - #[serde(rename = "trigger", with = "::buffa::json_helpers::proto_enum")] - pub trigger: ::buffa::EnumValue, - /// Optional user guidance steering the summarizer; empty when none. - /// - /// Field 7: `guidance` - #[serde( - rename = "guidance", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub guidance: ::core::option::Option<::buffa::alloc::string::String>, - /// Transcript token counts measured at compaction time; recorded because - /// tokenizer output is not deterministically recomputable later. Unset when the - /// compactor did not measure them. - /// - /// Field 8: `tokens_before` - #[serde( - rename = "tokensBefore", - alias = "tokens_before", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub tokens_before: ::core::option::Option, - /// Field 9: `tokens_after` - #[serde( - rename = "tokensAfter", - alias = "tokens_after", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub tokens_after: ::core::option::Option, - /// Optional provider-reported model telemetry for the summary-producing - /// invocation. It is not authoritative identity; exact selection comes from - /// the producer plan digest and typed role joined by the Session command. - /// - /// Field 10: `model` - #[serde(rename = "model", skip_serializing_if = "::core::option::Option::is_none")] - pub model: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 11: `usage` - #[serde( - rename = "usage", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub usage: ::buffa::MessageField>, - /// Logical root of the context replaced by this summary. Forks repeat their - /// inherited source tuple here because child ordinals cannot address it. - /// - /// Field 12: `context_root` - #[serde(rename = "contextRoot", alias = "context_root")] - pub context_root: ::buffa::MessageField< - CompactionContextRoot, - ::buffa::Inline, - >, - /// Evidence binding the summary to the immutable execution plan and the - /// platform-owned attempt that produced it. Authorization is established by - /// the Session command's history and plan joins, not by these fields alone. - /// - /// Field 13: `producer` - #[serde(rename = "producer")] - pub producer: ::buffa::MessageField< - CompactionProducer, - ::buffa::Inline, - >, - /// Plan-versioned digest of the exact effective privacy-masked covered input - /// summarized by this marker. - /// - /// Field 14: `covered_input_digest` - #[serde(rename = "coveredInputDigest", alias = "covered_input_digest")] - pub covered_input_digest: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for Compacted { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Compacted") - .field("session_id", &self.session_id) - .field("summary_id", &self.summary_id) - .field("summary_content", &self.summary_content) - .field("covers_from", &self.covers_from) - .field("covers_through", &self.covers_through) - .field("trigger", &self.trigger) - .field("guidance", &self.guidance) - .field("tokens_before", &self.tokens_before) - .field("tokens_after", &self.tokens_after) - .field("model", &self.model) - .field("usage", &self.usage) - .field("context_root", &self.context_root) - .field("producer", &self.producer) - .field("covered_input_digest", &self.covered_input_digest) - .finish() - } -} -impl Compacted { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.Compacted"; -} -impl Compacted { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::guidance`] to `Some(value)`, consuming and returning `self`. - pub fn with_guidance( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.guidance = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::tokens_before`] to `Some(value)`, consuming and returning `self`. - pub fn with_tokens_before(mut self, value: u64) -> Self { - self.tokens_before = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::tokens_after`] to `Some(value)`, consuming and returning `self`. - pub fn with_tokens_after(mut self, value: u64) -> Self { - self.tokens_after = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::model`] to `Some(value)`, consuming and returning `self`. - pub fn with_model( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.model = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(Compacted); -impl ::buffa::MessageName for Compacted { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "Compacted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.Compacted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.Compacted"; -} -impl ::buffa::Message for Compacted { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.summary_content) as u64; - if self.covers_from.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_from.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covers_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covers_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.trigger.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.guidance { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(v) = self.tokens_before { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.tokens_after { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(ref v) = self.model { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.usage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.usage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.context_root.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.context_root.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.producer.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.producer.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.covered_input_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.covered_input_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.summary_id, buf); - ::buffa::types::put_string_field(3u32, &self.summary_content, buf); - if self.covers_from.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_from.write_to(__cache, buf); - } - if self.covers_through.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covers_through.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(6u32, self.trigger.to_i32(), buf); - if let Some(ref v) = self.guidance { - ::buffa::types::put_string_field(7u32, v, buf); - } - if let Some(v) = self.tokens_before { - ::buffa::types::put_uint64_field(8u32, v, buf); - } - if let Some(v) = self.tokens_after { - ::buffa::types::put_uint64_field(9u32, v, buf); - } - if let Some(ref v) = self.model { - ::buffa::types::put_string_field(10u32, v, buf); - } - if self.usage.is_set() { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - self.usage.write_to(__cache, buf); - } - if self.context_root.is_set() { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - self.context_root.write_to(__cache, buf); - } - if self.producer.is_set() { - ::buffa::types::put_len_delimited_header( - 13u32, - u64::from(__cache.consume_next()), - buf, - ); - self.producer.write_to(__cache, buf); - } - if self.covered_input_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 14u32, - u64::from(__cache.consume_next()), - buf, - ); - self.covered_input_digest.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.summary_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.summary_content, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.covers_from.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.covers_through.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.trigger = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .guidance - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.tokens_before = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.tokens_after = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.model.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.usage.get_or_insert_default(), - buf, - ctx, - )?; - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.context_root.get_or_insert_default(), - buf, - ctx, - )?; - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.producer.get_or_insert_default(), - buf, - ctx, - )?; - } - 14u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.covered_input_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.summary_id.clear(); - self.summary_content.clear(); - self.covers_from = ::buffa::MessageField::none(); - self.covers_through = ::buffa::MessageField::none(); - self.trigger = ::buffa::EnumValue::from(0); - self.guidance = ::core::option::Option::None; - self.tokens_before = ::core::option::Option::None; - self.tokens_after = ::core::option::Option::None; - self.model = ::core::option::Option::None; - self.usage = ::buffa::MessageField::none(); - self.context_root = ::buffa::MessageField::none(); - self.producer = ::buffa::MessageField::none(); - self.covered_input_digest = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for Compacted { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COMPACTED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.Compacted", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// CompactionContextRoot makes the logical beginning of covered context -/// explicit when own-stream ordinal 1 is not the beginning of a fork's view. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct CompactionContextRoot { - #[serde(flatten)] - pub root: ::core::option::Option<__buffa::oneof::compaction_context_root::Root>, -} -impl ::core::fmt::Debug for CompactionContextRoot { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CompactionContextRoot").field("root", &self.root).finish() - } -} -impl CompactionContextRoot { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionContextRoot"; -} -::buffa::impl_default_instance!(CompactionContextRoot); -impl ::buffa::MessageName for CompactionContextRoot { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompactionContextRoot"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompactionContextRoot"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionContextRoot"; -} -impl ::buffa::Message for CompactionContextRoot { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let ::core::option::Option::Some(ref v) = self.root { - match v { - __buffa::oneof::compaction_context_root::Root::SessionStart(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::compaction_context_root::Root::InheritedPrefix(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let ::core::option::Option::Some(ref v) = self.root { - match v { - __buffa::oneof::compaction_context_root::Root::SessionStart(x) => { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::compaction_context_root::Root::InheritedPrefix(x) => { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::compaction_context_root::Root::SessionStart( - ref mut existing, - ), - ) = self.root - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.root = ::core::option::Option::Some( - __buffa::oneof::compaction_context_root::Root::SessionStart( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::compaction_context_root::Root::InheritedPrefix( - ref mut existing, - ), - ) = self.root - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.root = ::core::option::Option::Some( - __buffa::oneof::compaction_context_root::Root::InheritedPrefix( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.root = ::core::option::Option::None; - } -} -impl<'de> serde::Deserialize<'de> for CompactionContextRoot { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = CompactionContextRoot; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct CompactionContextRoot") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __oneof_root: ::core::option::Option< - __buffa::oneof::compaction_context_root::Root, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "sessionStart" | "session_start" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - CompactionSessionStart, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_root.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'root'", - ), - ); - } - __oneof_root = Some( - __buffa::oneof::compaction_context_root::Root::SessionStart( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "inheritedPrefix" | "inherited_prefix" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - CompactionInheritedPrefix, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_root.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'root'", - ), - ); - } - __oneof_root = Some( - __buffa::oneof::compaction_context_root::Root::InheritedPrefix( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - __r.root = __oneof_root; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for CompactionContextRoot { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COMPACTION_CONTEXT_ROOT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionContextRoot", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod compaction_context_root { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::compaction_context_root::Root; - #[doc(inline)] - pub use super::__buffa::view::oneof::compaction_context_root::Root as RootView; -} -/// CompactionSessionStart marks a context rooted at this session's start. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CompactionSessionStart {} -impl ::core::fmt::Debug for CompactionSessionStart { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CompactionSessionStart").finish() - } -} -impl CompactionSessionStart { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionSessionStart"; -} -::buffa::impl_default_instance!(CompactionSessionStart); -impl ::buffa::MessageName for CompactionSessionStart { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompactionSessionStart"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompactionSessionStart"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionSessionStart"; -} -impl ::buffa::Message for CompactionSessionStart { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let size = 0u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - _buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) {} -} -impl ::buffa::json_helpers::ProtoElemJson for CompactionSessionStart { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COMPACTION_SESSION_START_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionSessionStart", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// CompactionInheritedPrefix preserves the immutable source prefix identity a -/// fork inherited, since that prefix is outside the child stream's ordinals. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CompactionInheritedPrefix { - /// Field 1: `source_session_id` - #[serde( - rename = "sourceSessionId", - alias = "source_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub source_session_id: ::buffa::alloc::string::String, - /// Field 2: `context_prefix_boundary` - #[serde(rename = "contextPrefixBoundary", alias = "context_prefix_boundary")] - pub context_prefix_boundary: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for CompactionInheritedPrefix { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CompactionInheritedPrefix") - .field("source_session_id", &self.source_session_id) - .field("context_prefix_boundary", &self.context_prefix_boundary) - .finish() - } -} -impl CompactionInheritedPrefix { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionInheritedPrefix"; -} -::buffa::impl_default_instance!(CompactionInheritedPrefix); -impl ::buffa::MessageName for CompactionInheritedPrefix { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompactionInheritedPrefix"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompactionInheritedPrefix"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionInheritedPrefix"; -} -impl ::buffa::Message for CompactionInheritedPrefix { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.context_prefix_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.context_prefix_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.source_session_id, buf); - if self.context_prefix_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.context_prefix_boundary.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.source_session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.context_prefix_boundary.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.source_session_id.clear(); - self.context_prefix_boundary = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CompactionInheritedPrefix { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COMPACTION_INHERITED_PREFIX_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionInheritedPrefix", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// CompactionProducer records attribution evidence for the execution context -/// that produced the summary. The Session command validates this evidence -/// against folded attempt history and the immutable execution plan. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CompactionProducer { - /// Field 1: `producing_execution_attempt_id` - #[serde( - rename = "producingExecutionAttemptId", - alias = "producing_execution_attempt_id", - with = "::buffa::json_helpers::proto_string" - )] - pub producing_execution_attempt_id: ::buffa::alloc::string::String, - /// Field 2: `session_execution_plan_digest` - #[serde( - rename = "sessionExecutionPlanDigest", - alias = "session_execution_plan_digest" - )] - pub session_execution_plan_digest: ::buffa::MessageField< - Digest, - ::buffa::Inline, - >, - /// Field 3: `model_role` - #[serde( - rename = "modelRole", - alias = "model_role", - with = "::buffa::json_helpers::proto_enum" - )] - pub model_role: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for CompactionProducer { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CompactionProducer") - .field( - "producing_execution_attempt_id", - &self.producing_execution_attempt_id, - ) - .field("session_execution_plan_digest", &self.session_execution_plan_digest) - .field("model_role", &self.model_role) - .finish() - } -} -impl CompactionProducer { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionProducer"; -} -::buffa::impl_default_instance!(CompactionProducer); -impl ::buffa::MessageName for CompactionProducer { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompactionProducer"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompactionProducer"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionProducer"; -} -impl ::buffa::Message for CompactionProducer { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 - + ::buffa::types::string_encoded_len( - &self.producing_execution_attempt_id, - ) as u64; - if self.session_execution_plan_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.session_execution_plan_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.model_role.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field( - 1u32, - &self.producing_execution_attempt_id, - buf, - ); - if self.session_execution_plan_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.session_execution_plan_digest.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.model_role.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - &mut self.producing_execution_attempt_id, - buf, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.session_execution_plan_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.model_role = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.producing_execution_attempt_id.clear(); - self.session_execution_plan_digest = ::buffa::MessageField::none(); - self.model_role = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CompactionProducer { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COMPACTION_PRODUCER_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompactionProducer", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.complete_assistant_message.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.complete_assistant_message.__view.rs deleted file mode 100644 index 6f7cae01a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.complete_assistant_message.__view.rs +++ /dev/null @@ -1,428 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/complete_assistant_message.proto - -/// CompleteAssistantMessage settles an assistant turn normally, recording -/// \[AssistantMessageCompleted\]. -/// -/// Write precondition Any: per message_id this competes with -/// FailAssistantMessage under first-terminal-outcome-wins, so ordering between -/// them is decided by the fold rather than by a write guard. -#[derive(Clone, Debug, Default)] -pub struct CompleteAssistantMessageView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `message` - pub message: ::buffa::MessageFieldView< - super::super::__buffa::view::CanonicalMessageView<'a>, - >, - /// Field 3: `finish_reason` - pub finish_reason: ::buffa::EnumValue, - /// Set only when finish_reason is FINISH_REASON_STOP_SEQUENCE. - /// - /// Field 4: `matched_stop_sequence` - pub matched_stop_sequence: ::core::option::Option<&'a str>, - /// Field 5: `turn_id` - pub turn_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CompleteAssistantMessageView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `message` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message(&self) -> bool { - self.message.is_set() - } - /**Whether required field `finish_reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_finish_reason(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for CompleteAssistantMessageView<'a> { - type Owned = super::super::CompleteAssistantMessage; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.message.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.message = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.finish_reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.matched_stop_sequence = Some(::buffa::types::borrow_str(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::CompleteAssistantMessage, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::CompleteAssistantMessage, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CompleteAssistantMessage { - session_id: self.session_id.to_string(), - message: match self.message.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CanonicalMessage, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - finish_reason: self.finish_reason, - matched_stop_sequence: self.matched_stop_sequence.map(|s| s.to_string()), - turn_id: self.turn_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CompleteAssistantMessageView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.message.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.message.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.finish_reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.matched_stop_sequence { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.message.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.message.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.finish_reason.to_i32(), buf); - if let Some(ref v) = self.matched_stop_sequence { - ::buffa::types::put_string_field(4u32, v, buf); - } - ::buffa::types::put_string_field(5u32, &self.turn_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CompleteAssistantMessageView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.message.as_option() { - __map.serialize_entry("message", __v)?; - } - } - { - __map.serialize_entry("finishReason", &self.finish_reason)?; - } - if let ::core::option::Option::Some(__v) = self.matched_stop_sequence { - __map.serialize_entry("matchedStopSequence", __v)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CompleteAssistantMessageView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompleteAssistantMessage"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompleteAssistantMessage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompleteAssistantMessage"; -} -::buffa::impl_default_view_instance!(CompleteAssistantMessageView); -::buffa::impl_view_reborrow!(CompleteAssistantMessageView); -/** Self-contained, `'static` owned view of a `CompleteAssistantMessage` message. - - Wraps [`::buffa::OwnedView`]`<`[`CompleteAssistantMessageView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CompleteAssistantMessageView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CompleteAssistantMessageOwnedView( - ::buffa::OwnedView>, -); -impl CompleteAssistantMessageOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompleteAssistantMessageOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompleteAssistantMessageOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CompleteAssistantMessage, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompleteAssistantMessageOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CompleteAssistantMessageView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CompleteAssistantMessageView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CompleteAssistantMessage { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `message` - #[must_use] - pub fn message( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CanonicalMessageView<'_>, - > { - &self.0.reborrow().message - } - /// Field 3: `finish_reason` - #[must_use] - pub fn finish_reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().finish_reason - } - /// Set only when finish_reason is FINISH_REASON_STOP_SEQUENCE. - /// - /// Field 4: `matched_stop_sequence` - #[must_use] - pub fn matched_stop_sequence(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().matched_stop_sequence - } - /// Field 5: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CompleteAssistantMessageOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CompleteAssistantMessageOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CompleteAssistantMessageOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CompleteAssistantMessageOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CompleteAssistantMessage { - type View<'a> = CompleteAssistantMessageView<'a>; - type ViewHandle = CompleteAssistantMessageOwnedView; -} -impl ::serde::Serialize for CompleteAssistantMessageOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.complete_assistant_message.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.complete_assistant_message.rs deleted file mode 100644 index 854e78c2e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.complete_assistant_message.rs +++ /dev/null @@ -1,232 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/complete_assistant_message.proto - -/// CompleteAssistantMessage settles an assistant turn normally, recording -/// \[AssistantMessageCompleted\]. -/// -/// Write precondition Any: per message_id this competes with -/// FailAssistantMessage under first-terminal-outcome-wins, so ordering between -/// them is decided by the fold rather than by a write guard. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CompleteAssistantMessage { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `message` - #[serde(rename = "message")] - pub message: ::buffa::MessageField< - CanonicalMessage, - ::buffa::Inline, - >, - /// Field 3: `finish_reason` - #[serde( - rename = "finishReason", - alias = "finish_reason", - with = "::buffa::json_helpers::proto_enum" - )] - pub finish_reason: ::buffa::EnumValue, - /// Set only when finish_reason is FINISH_REASON_STOP_SEQUENCE. - /// - /// Field 4: `matched_stop_sequence` - #[serde( - rename = "matchedStopSequence", - alias = "matched_stop_sequence", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub matched_stop_sequence: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 5: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for CompleteAssistantMessage { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CompleteAssistantMessage") - .field("session_id", &self.session_id) - .field("message", &self.message) - .field("finish_reason", &self.finish_reason) - .field("matched_stop_sequence", &self.matched_stop_sequence) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl CompleteAssistantMessage { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompleteAssistantMessage"; -} -impl CompleteAssistantMessage { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::matched_stop_sequence`] to `Some(value)`, consuming and returning `self`. - pub fn with_matched_stop_sequence( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.matched_stop_sequence = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(CompleteAssistantMessage); -impl ::buffa::MessageName for CompleteAssistantMessage { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompleteAssistantMessage"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompleteAssistantMessage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompleteAssistantMessage"; -} -impl ::buffa::Message for CompleteAssistantMessage { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.message.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.message.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.finish_reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.matched_stop_sequence { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.message.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.message.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.finish_reason.to_i32(), buf); - if let Some(ref v) = self.matched_stop_sequence { - ::buffa::types::put_string_field(4u32, v, buf); - } - ::buffa::types::put_string_field(5u32, &self.turn_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.message.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.finish_reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .matched_stop_sequence - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.message = ::buffa::MessageField::none(); - self.finish_reason = ::buffa::EnumValue::from(0); - self.matched_stop_sequence = ::core::option::Option::None; - self.turn_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CompleteAssistantMessage { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COMPLETE_ASSISTANT_MESSAGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompleteAssistantMessage", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.complete_tool_call.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.complete_tool_call.__view.rs deleted file mode 100644 index dee4c1256..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.complete_tool_call.__view.rs +++ /dev/null @@ -1,891 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/complete_tool_call.proto - -/// CompleteToolCall settles a call with a result, recording \[ToolCallCompleted\]. -/// -/// Write precondition Any: it races FailToolCall for the same execution, and the -/// fold resolves that by first-terminal-outcome-wins keyed on -/// tool_execution_id. A later conflicting outcome stays on the log, flagged by a -/// projection, and never changes state. -#[derive(Clone, Debug, Default)] -pub struct CompleteToolCallView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Field 3: `tool_execution_id` - pub tool_execution_id: &'a str, - /// Field 4: `result` - pub result: ::buffa::MessageFieldView< - super::super::__buffa::view::ToolCallResultView<'a>, - >, - /// Field 5: `turn_id` - pub turn_id: &'a str, - /// Field 6: `termination` - pub termination: ::buffa::MessageFieldView< - super::super::__buffa::view::CommandTerminationView<'a>, - >, - /// Field 7: `duration` - pub duration: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, - /// Field 8: `observed` - pub observed: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::ResourceObservationView<'a>, - >, - /// Captured stdout and stderr, already sealed and stored as an artifact by the - /// time this command is issued. The capture is not part of the decision: a - /// decider that had to write 40 MB before it could append would be one whose - /// append latency is set by the noisiest command that ever ran. - /// - /// Field 9: `output_replay` - pub output_replay: ::buffa::MessageFieldView< - super::super::__buffa::view::CommandOutputReplayRefView<'a>, - >, - /// Set when the call is settling with a handle rather than an outcome. The - /// work it names must already be reserved in the operation ledger, so the - /// completion never points at an operation that does not exist. - /// - /// Field 10: `detached` - pub detached: ::buffa::MessageFieldView< - super::super::__buffa::view::DetachedWorkView<'a>, - >, - /// Field 11: `accessed` - pub accessed: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::ResourceAccessRecordView<'a>, - >, - /// Field 12: `failed_targets` - pub failed_targets: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::TargetOutcomeView<'a>, - >, - /// Field 13: `targets_attempted` - pub targets_attempted: ::core::option::Option, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CompleteToolCallView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_execution_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_execution_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `result` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_result(&self) -> bool { - self.result.is_set() - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for CompleteToolCallView<'a> { - type Owned = super::super::CompleteToolCall; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_execution_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.result.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.result = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.termination.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.termination = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.duration.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.duration = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.output_replay.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.output_replay = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.detached.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.detached = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.targets_attempted = Some(::buffa::types::decode_uint32(&mut cur)?); - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::ResourceObservationView, - >(), - )?; - view.observed - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::ResourceAccessRecordView, - >(), - )?; - view.accessed - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::TargetOutcomeView, - >(), - )?; - view.failed_targets - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CompleteToolCall { - session_id: self.session_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - tool_execution_id: self.tool_execution_id.to_string(), - result: match self.result.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ToolCallResult, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - turn_id: self.turn_id.to_string(), - termination: match self.termination.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CommandTermination, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - duration: match self.duration.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - observed: self - .observed - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - output_replay: match self.output_replay.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CommandOutputReplayRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - detached: match self.detached.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::DetachedWork, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - accessed: self - .accessed - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - failed_targets: self - .failed_targets - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - targets_attempted: self.targets_attempted, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CompleteToolCallView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - if self.result.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.result.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if self.termination.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.termination.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.duration.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.duration.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.observed { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.output_replay.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.output_replay.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.detached.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.detached.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.accessed { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.failed_targets { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(v) = self.targets_attempted { - size += 1u64 + ::buffa::types::uint32_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - if self.result.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.result.write_to(__cache, buf); - } - ::buffa::types::put_string_field(5u32, &self.turn_id, buf); - if self.termination.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.termination.write_to(__cache, buf); - } - if self.duration.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.duration.write_to(__cache, buf); - } - for v in &self.observed { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if self.output_replay.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.output_replay.write_to(__cache, buf); - } - if self.detached.is_set() { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - self.detached.write_to(__cache, buf); - } - for v in &self.accessed { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.failed_targets { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if let Some(v) = self.targets_attempted { - ::buffa::types::put_uint32_field(13u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CompleteToolCallView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolExecutionId", self.tool_execution_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.result.as_option() { - __map.serialize_entry("result", __v)?; - } - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.termination.as_option() { - __map.serialize_entry("termination", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.duration.as_option() { - __map.serialize_entry("duration", __v)?; - } - } - if !self.observed.is_empty() { - __map.serialize_entry("observed", &*self.observed)?; - } - { - if let ::core::option::Option::Some(__v) = self.output_replay.as_option() { - __map.serialize_entry("outputReplay", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.detached.as_option() { - __map.serialize_entry("detached", __v)?; - } - } - if !self.accessed.is_empty() { - __map.serialize_entry("accessed", &*self.accessed)?; - } - if !self.failed_targets.is_empty() { - __map.serialize_entry("failedTargets", &*self.failed_targets)?; - } - if let ::core::option::Option::Some(__v) = self.targets_attempted { - __map - .serialize_entry( - "targetsAttempted", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CompleteToolCallView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompleteToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompleteToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompleteToolCall"; -} -::buffa::impl_default_view_instance!(CompleteToolCallView); -::buffa::impl_view_reborrow!(CompleteToolCallView); -/** Self-contained, `'static` owned view of a `CompleteToolCall` message. - - Wraps [`::buffa::OwnedView`]`<`[`CompleteToolCallView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CompleteToolCallView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CompleteToolCallOwnedView(::buffa::OwnedView>); -impl CompleteToolCallOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompleteToolCallOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompleteToolCallOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CompleteToolCall, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CompleteToolCallOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CompleteToolCallView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CompleteToolCallView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CompleteToolCall { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Field 3: `tool_execution_id` - #[must_use] - pub fn tool_execution_id(&self) -> &'_ str { - self.0.reborrow().tool_execution_id - } - /// Field 4: `result` - #[must_use] - pub fn result( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ToolCallResultView<'_>, - > { - &self.0.reborrow().result - } - /// Field 5: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } - /// Field 6: `termination` - #[must_use] - pub fn termination( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CommandTerminationView<'_>, - > { - &self.0.reborrow().termination - } - /// Field 7: `duration` - #[must_use] - pub fn duration( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().duration - } - /// Field 8: `observed` - #[must_use] - pub fn observed( - &self, - ) -> &::buffa::RepeatedView< - '_, - super::super::__buffa::view::ResourceObservationView<'_>, - > { - &self.0.reborrow().observed - } - /// Captured stdout and stderr, already sealed and stored as an artifact by the - /// time this command is issued. The capture is not part of the decision: a - /// decider that had to write 40 MB before it could append would be one whose - /// append latency is set by the noisiest command that ever ran. - /// - /// Field 9: `output_replay` - #[must_use] - pub fn output_replay( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CommandOutputReplayRefView<'_>, - > { - &self.0.reborrow().output_replay - } - /// Set when the call is settling with a handle rather than an outcome. The - /// work it names must already be reserved in the operation ledger, so the - /// completion never points at an operation that does not exist. - /// - /// Field 10: `detached` - #[must_use] - pub fn detached( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().detached - } - /// Field 11: `accessed` - #[must_use] - pub fn accessed( - &self, - ) -> &::buffa::RepeatedView< - '_, - super::super::__buffa::view::ResourceAccessRecordView<'_>, - > { - &self.0.reborrow().accessed - } - /// Field 12: `failed_targets` - #[must_use] - pub fn failed_targets( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::TargetOutcomeView<'_>> { - &self.0.reborrow().failed_targets - } - /// Field 13: `targets_attempted` - #[must_use] - pub fn targets_attempted(&self) -> ::core::option::Option { - self.0.reborrow().targets_attempted - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CompleteToolCallOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CompleteToolCallOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CompleteToolCallOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CompleteToolCallOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CompleteToolCall { - type View<'a> = CompleteToolCallView<'a>; - type ViewHandle = CompleteToolCallOwnedView; -} -impl ::serde::Serialize for CompleteToolCallOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.complete_tool_call.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.complete_tool_call.rs deleted file mode 100644 index d259dd2dd..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.complete_tool_call.rs +++ /dev/null @@ -1,507 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/complete_tool_call.proto - -/// CompleteToolCall settles a call with a result, recording \[ToolCallCompleted\]. -/// -/// Write precondition Any: it races FailToolCall for the same execution, and the -/// fold resolves that by first-terminal-outcome-wins keyed on -/// tool_execution_id. A later conflicting outcome stays on the log, flagged by a -/// projection, and never changes state. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CompleteToolCall { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Field 3: `tool_execution_id` - #[serde( - rename = "toolExecutionId", - alias = "tool_execution_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_execution_id: ::buffa::alloc::string::String, - /// Field 4: `result` - #[serde(rename = "result")] - pub result: ::buffa::MessageField>, - /// Field 5: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, - /// Field 6: `termination` - #[serde( - rename = "termination", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub termination: ::buffa::MessageField< - CommandTermination, - ::buffa::Inline, - >, - /// Field 7: `duration` - #[serde( - rename = "duration", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub duration: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, - /// Field 8: `observed` - #[serde( - rename = "observed", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub observed: ::buffa::alloc::vec::Vec, - /// Captured stdout and stderr, already sealed and stored as an artifact by the - /// time this command is issued. The capture is not part of the decision: a - /// decider that had to write 40 MB before it could append would be one whose - /// append latency is set by the noisiest command that ever ran. - /// - /// Field 9: `output_replay` - #[serde( - rename = "outputReplay", - alias = "output_replay", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub output_replay: ::buffa::MessageField< - CommandOutputReplayRef, - ::buffa::Inline, - >, - /// Set when the call is settling with a handle rather than an outcome. The - /// work it names must already be reserved in the operation ledger, so the - /// completion never points at an operation that does not exist. - /// - /// Field 10: `detached` - #[serde( - rename = "detached", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub detached: ::buffa::MessageField>, - /// Field 11: `accessed` - #[serde( - rename = "accessed", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub accessed: ::buffa::alloc::vec::Vec, - /// Field 12: `failed_targets` - #[serde( - rename = "failedTargets", - alias = "failed_targets", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub failed_targets: ::buffa::alloc::vec::Vec, - /// Field 13: `targets_attempted` - #[serde( - rename = "targetsAttempted", - alias = "targets_attempted", - with = "::buffa::json_helpers::opt_uint32", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub targets_attempted: ::core::option::Option, -} -impl ::core::fmt::Debug for CompleteToolCall { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CompleteToolCall") - .field("session_id", &self.session_id) - .field("tool_call_id", &self.tool_call_id) - .field("tool_execution_id", &self.tool_execution_id) - .field("result", &self.result) - .field("turn_id", &self.turn_id) - .field("termination", &self.termination) - .field("duration", &self.duration) - .field("observed", &self.observed) - .field("output_replay", &self.output_replay) - .field("detached", &self.detached) - .field("accessed", &self.accessed) - .field("failed_targets", &self.failed_targets) - .field("targets_attempted", &self.targets_attempted) - .finish() - } -} -impl CompleteToolCall { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompleteToolCall"; -} -impl CompleteToolCall { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::targets_attempted`] to `Some(value)`, consuming and returning `self`. - pub fn with_targets_attempted(mut self, value: u32) -> Self { - self.targets_attempted = Some(value); - self - } -} -::buffa::impl_default_instance!(CompleteToolCall); -impl ::buffa::MessageName for CompleteToolCall { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CompleteToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CompleteToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompleteToolCall"; -} -impl ::buffa::Message for CompleteToolCall { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - if self.result.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.result.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if self.termination.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.termination.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.duration.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.duration.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.observed { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.output_replay.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.output_replay.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.detached.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.detached.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.accessed { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.failed_targets { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(v) = self.targets_attempted { - size += 1u64 + ::buffa::types::uint32_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - if self.result.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.result.write_to(__cache, buf); - } - ::buffa::types::put_string_field(5u32, &self.turn_id, buf); - if self.termination.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.termination.write_to(__cache, buf); - } - if self.duration.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.duration.write_to(__cache, buf); - } - for v in &self.observed { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if self.output_replay.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.output_replay.write_to(__cache, buf); - } - if self.detached.is_set() { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - self.detached.write_to(__cache, buf); - } - for v in &self.accessed { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.failed_targets { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if let Some(v) = self.targets_attempted { - ::buffa::types::put_uint32_field(13u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_execution_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.result.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.termination.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.duration.get_or_insert_default(), - buf, - ctx, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.observed.push(elem); - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.output_replay.get_or_insert_default(), - buf, - ctx, - )?; - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.detached.get_or_insert_default(), - buf, - ctx, - )?; - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.accessed.push(elem); - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.failed_targets.push(elem); - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.targets_attempted = ::core::option::Option::Some( - ::buffa::types::decode_uint32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.tool_call_id.clear(); - self.tool_execution_id.clear(); - self.result = ::buffa::MessageField::none(); - self.turn_id.clear(); - self.termination = ::buffa::MessageField::none(); - self.duration = ::buffa::MessageField::none(); - self.observed.clear(); - self.output_replay = ::buffa::MessageField::none(); - self.detached = ::buffa::MessageField::none(); - self.accessed.clear(); - self.failed_targets.clear(); - self.targets_attempted = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for CompleteToolCall { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COMPLETE_TOOL_CALL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CompleteToolCall", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.content_chunks.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.content_chunks.__view.rs deleted file mode 100644 index ee64c9c80..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.content_chunks.__view.rs +++ /dev/null @@ -1,392 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/content_chunks.proto - -/// ContentChunks is what makes part of an artifact checkable without reading all -/// of it. -/// -/// An artifact's Digest covers the whole artifact, so it can only be checked by -/// hashing every byte. That is exactly what a range read exists to avoid: a -/// caller fetching 64 KB of a 40 MB artifact cannot afford a 40 MB verification, -/// and a caller who skips it is reading unverified bytes while holding a digest -/// that looks like it proved something. -/// -/// So the artifact is also hashed in fixed-size chunks, and the digest of that -/// ordered chunk-digest list is recorded here, on the log. A caller holding this -/// value can fetch the chunk manifest from the artifact store, check the -/// manifest against a value the store did not supply, and then check any chunk -/// it reads against the manifest. Trust flows from the event log outward, which -/// is the only direction in which it means anything: a manifest checked only -/// against the store that served it proves the store is self-consistent. -/// -/// Optional on StoredArtifact. Absent means no range of that artifact can be -/// checked, and the read contract says so rather than serving unchecked bytes -/// that look checked. -#[derive(Clone, Debug, Default)] -pub struct ContentChunksView<'a> { - /// Hash used for each chunk and for the manifest digest, for example "sha256". - /// - /// Field 1: `algorithm` - pub algorithm: &'a str, - /// Size of every chunk but the last, which holds the remainder. - /// - /// Field 2: `chunk_size_bytes` - pub chunk_size_bytes: u64, - /// Digest over the ordered chunk digests concatenated. - /// - /// The chunk count is deliberately not recorded: it follows from - /// StoredArtifact.size_bytes and chunk_size_bytes, and a second field carrying - /// a derivable fact is a second field that can disagree with the first. - /// - /// Field 3: `manifest_digest` - pub manifest_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ContentChunksView<'a> { - /**Whether required field `algorithm` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_algorithm(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `chunk_size_bytes` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_chunk_size_bytes(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `manifest_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_manifest_digest(&self) -> bool { - self.manifest_digest.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ContentChunksView<'a> { - type Owned = super::super::ContentChunks; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.algorithm = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.chunk_size_bytes = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.manifest_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.manifest_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ContentChunks { - algorithm: self.algorithm.to_string(), - chunk_size_bytes: self.chunk_size_bytes, - manifest_digest: match self.manifest_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ContentChunksView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.algorithm) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.chunk_size_bytes) as u64; - if self.manifest_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.manifest_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.algorithm, buf); - ::buffa::types::put_uint64_field(2u32, self.chunk_size_bytes, buf); - if self.manifest_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.manifest_digest.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ContentChunksView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("algorithm", self.algorithm)?; - } - { - __map - .serialize_entry( - "chunkSizeBytes", - &::buffa::json_helpers::ProtoJson(&self.chunk_size_bytes), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.manifest_digest.as_option() { - __map.serialize_entry("manifestDigest", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ContentChunksView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ContentChunks"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ContentChunks"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ContentChunks"; -} -::buffa::impl_default_view_instance!(ContentChunksView); -::buffa::impl_view_reborrow!(ContentChunksView); -/** Self-contained, `'static` owned view of a `ContentChunks` message. - - Wraps [`::buffa::OwnedView`]`<`[`ContentChunksView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ContentChunksView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ContentChunksOwnedView(::buffa::OwnedView>); -impl ContentChunksOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContentChunksOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContentChunksOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ContentChunks, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContentChunksOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ContentChunksView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ContentChunksView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ContentChunks { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Hash used for each chunk and for the manifest digest, for example "sha256". - /// - /// Field 1: `algorithm` - #[must_use] - pub fn algorithm(&self) -> &'_ str { - self.0.reborrow().algorithm - } - /// Size of every chunk but the last, which holds the remainder. - /// - /// Field 2: `chunk_size_bytes` - #[must_use] - pub fn chunk_size_bytes(&self) -> u64 { - self.0.reborrow().chunk_size_bytes - } - /// Digest over the ordered chunk digests concatenated. - /// - /// The chunk count is deliberately not recorded: it follows from - /// StoredArtifact.size_bytes and chunk_size_bytes, and a second field carrying - /// a derivable fact is a second field that can disagree with the first. - /// - /// Field 3: `manifest_digest` - #[must_use] - pub fn manifest_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().manifest_digest - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ContentChunksOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ContentChunksOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ContentChunksOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ContentChunksOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ContentChunks { - type View<'a> = ContentChunksView<'a>; - type ViewHandle = ContentChunksOwnedView; -} -impl ::serde::Serialize for ContentChunksOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.content_chunks.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.content_chunks.rs deleted file mode 100644 index 4eccc8832..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.content_chunks.rs +++ /dev/null @@ -1,185 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/content_chunks.proto - -/// ContentChunks is what makes part of an artifact checkable without reading all -/// of it. -/// -/// An artifact's Digest covers the whole artifact, so it can only be checked by -/// hashing every byte. That is exactly what a range read exists to avoid: a -/// caller fetching 64 KB of a 40 MB artifact cannot afford a 40 MB verification, -/// and a caller who skips it is reading unverified bytes while holding a digest -/// that looks like it proved something. -/// -/// So the artifact is also hashed in fixed-size chunks, and the digest of that -/// ordered chunk-digest list is recorded here, on the log. A caller holding this -/// value can fetch the chunk manifest from the artifact store, check the -/// manifest against a value the store did not supply, and then check any chunk -/// it reads against the manifest. Trust flows from the event log outward, which -/// is the only direction in which it means anything: a manifest checked only -/// against the store that served it proves the store is self-consistent. -/// -/// Optional on StoredArtifact. Absent means no range of that artifact can be -/// checked, and the read contract says so rather than serving unchecked bytes -/// that look checked. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ContentChunks { - /// Hash used for each chunk and for the manifest digest, for example "sha256". - /// - /// Field 1: `algorithm` - #[serde(rename = "algorithm", with = "::buffa::json_helpers::proto_string")] - pub algorithm: ::buffa::alloc::string::String, - /// Size of every chunk but the last, which holds the remainder. - /// - /// Field 2: `chunk_size_bytes` - #[serde( - rename = "chunkSizeBytes", - alias = "chunk_size_bytes", - with = "::buffa::json_helpers::uint64" - )] - pub chunk_size_bytes: u64, - /// Digest over the ordered chunk digests concatenated. - /// - /// The chunk count is deliberately not recorded: it follows from - /// StoredArtifact.size_bytes and chunk_size_bytes, and a second field carrying - /// a derivable fact is a second field that can disagree with the first. - /// - /// Field 3: `manifest_digest` - #[serde(rename = "manifestDigest", alias = "manifest_digest")] - pub manifest_digest: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for ContentChunks { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ContentChunks") - .field("algorithm", &self.algorithm) - .field("chunk_size_bytes", &self.chunk_size_bytes) - .field("manifest_digest", &self.manifest_digest) - .finish() - } -} -impl ContentChunks { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ContentChunks"; -} -::buffa::impl_default_instance!(ContentChunks); -impl ::buffa::MessageName for ContentChunks { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ContentChunks"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ContentChunks"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ContentChunks"; -} -impl ::buffa::Message for ContentChunks { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.algorithm) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.chunk_size_bytes) as u64; - if self.manifest_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.manifest_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.algorithm, buf); - ::buffa::types::put_uint64_field(2u32, self.chunk_size_bytes, buf); - if self.manifest_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.manifest_digest.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.algorithm, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.chunk_size_bytes = ::buffa::types::decode_uint64(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.manifest_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.algorithm.clear(); - self.chunk_size_bytes = 0u64; - self.manifest_digest = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ContentChunks { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CONTENT_CHUNKS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ContentChunks", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.copy_source.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.copy_source.__view.rs deleted file mode 100644 index 2185fb37c..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.copy_source.__view.rs +++ /dev/null @@ -1,345 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/copy_source.proto - -/// CopySource records where a copied file came from. -/// -/// A copy recorded only as a create loses the one fact that makes it reviewable. -/// "A new file appeared at deploy/prod.yaml" and "deploy/staging.yaml was -/// duplicated to deploy/prod.yaml" are different events for a reviewer, and the -/// second is the one that raises the question worth raising. -/// -/// This is a distinct field rather than a reuse of FileChanged.previous_path, -/// even though both name an earlier location, because the two make opposite -/// claims about the source. After a rename the previous path is gone. After a -/// copy the source still exists, unchanged, and anything that treated the two the -/// same would report a file as moved that is still sitting there. -#[derive(Clone, Debug, Default)] -pub struct CopySourceView<'a> { - /// Workspace-relative path the content was copied from, in the same form as - /// FileChanged.path. - /// - /// Field 1: `path` - pub path: &'a str, - /// What the source hashed to at the moment of the copy. - /// - /// This is what makes a copy checkable later, on the same reasoning as - /// ResourceObservation: without it, a reader can see that prod.yaml came from - /// staging.yaml but cannot tell whether it came from the staging.yaml that - /// exists now or from a version since edited. Unset when the source content was - /// not hashed. - /// - /// Field 2: `source_digest` - pub source_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CopySourceView<'a> { - /**Whether required field `path` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_path(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for CopySourceView<'a> { - type Owned = super::super::CopySource; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.path = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.source_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.source_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CopySource { - path: self.path.to_string(), - source_digest: match self.source_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CopySourceView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.path) as u64; - if self.source_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.path, buf); - if self.source_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_digest.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CopySourceView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("path", self.path)?; - } - { - if let ::core::option::Option::Some(__v) = self.source_digest.as_option() { - __map.serialize_entry("sourceDigest", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CopySourceView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CopySource"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CopySource"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CopySource"; -} -::buffa::impl_default_view_instance!(CopySourceView); -::buffa::impl_view_reborrow!(CopySourceView); -/** Self-contained, `'static` owned view of a `CopySource` message. - - Wraps [`::buffa::OwnedView`]`<`[`CopySourceView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CopySourceView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CopySourceOwnedView(::buffa::OwnedView>); -impl CopySourceOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CopySourceOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CopySourceOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CopySource, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CopySourceOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CopySourceView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CopySourceView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CopySource { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Workspace-relative path the content was copied from, in the same form as - /// FileChanged.path. - /// - /// Field 1: `path` - #[must_use] - pub fn path(&self) -> &'_ str { - self.0.reborrow().path - } - /// What the source hashed to at the moment of the copy. - /// - /// This is what makes a copy checkable later, on the same reasoning as - /// ResourceObservation: without it, a reader can see that prod.yaml came from - /// staging.yaml but cannot tell whether it came from the staging.yaml that - /// exists now or from a version since edited. Unset when the source content was - /// not hashed. - /// - /// Field 2: `source_digest` - #[must_use] - pub fn source_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().source_digest - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CopySourceOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CopySourceOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CopySourceOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CopySourceOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CopySource { - type View<'a> = CopySourceView<'a>; - type ViewHandle = CopySourceOwnedView; -} -impl ::serde::Serialize for CopySourceOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.copy_source.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.copy_source.rs deleted file mode 100644 index 1ae8d422a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.copy_source.rs +++ /dev/null @@ -1,164 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/copy_source.proto - -/// CopySource records where a copied file came from. -/// -/// A copy recorded only as a create loses the one fact that makes it reviewable. -/// "A new file appeared at deploy/prod.yaml" and "deploy/staging.yaml was -/// duplicated to deploy/prod.yaml" are different events for a reviewer, and the -/// second is the one that raises the question worth raising. -/// -/// This is a distinct field rather than a reuse of FileChanged.previous_path, -/// even though both name an earlier location, because the two make opposite -/// claims about the source. After a rename the previous path is gone. After a -/// copy the source still exists, unchanged, and anything that treated the two the -/// same would report a file as moved that is still sitting there. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CopySource { - /// Workspace-relative path the content was copied from, in the same form as - /// FileChanged.path. - /// - /// Field 1: `path` - #[serde(rename = "path", with = "::buffa::json_helpers::proto_string")] - pub path: ::buffa::alloc::string::String, - /// What the source hashed to at the moment of the copy. - /// - /// This is what makes a copy checkable later, on the same reasoning as - /// ResourceObservation: without it, a reader can see that prod.yaml came from - /// staging.yaml but cannot tell whether it came from the staging.yaml that - /// exists now or from a version since edited. Unset when the source content was - /// not hashed. - /// - /// Field 2: `source_digest` - #[serde( - rename = "sourceDigest", - alias = "source_digest", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub source_digest: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for CopySource { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CopySource") - .field("path", &self.path) - .field("source_digest", &self.source_digest) - .finish() - } -} -impl CopySource { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CopySource"; -} -::buffa::impl_default_instance!(CopySource); -impl ::buffa::MessageName for CopySource { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CopySource"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CopySource"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CopySource"; -} -impl ::buffa::Message for CopySource { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.path) as u64; - if self.source_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.path, buf); - if self.source_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_digest.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.path, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.source_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.path.clear(); - self.source_digest = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CopySource { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COPY_SOURCE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CopySource", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.create_child_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.create_child_session.__view.rs deleted file mode 100644 index b2bbbab1e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.create_child_session.__view.rs +++ /dev/null @@ -1,582 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/create_child_session.proto - -/// CreateChildSession is the delegation saga's second step: it opens the -/// delegated child's stream, recording \[SessionStarted, ParentLinked\] as one -/// batch so a child can never exist without its lineage. -/// -/// Write precondition NoStream on the child. parent_dispatched_at and -/// cascade_policy are copied verbatim from the parent's DelegationDispatched, so -/// a redelivered saga step reproduces the same link (ADR#0035 facet 6). -#[derive(Clone, Debug, Default)] -pub struct CreateChildSessionView<'a> { - /// The child session's own id. - /// - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `execution_plan` - pub execution_plan: ::buffa::MessageFieldView< - super::super::__buffa::view::StoredSessionExecutionPlanView<'a>, - >, - /// Field 3: `workspace` - pub workspace: ::buffa::MessageFieldView< - super::super::__buffa::view::WorkspaceRefView<'a>, - >, - /// Field 4: `parent_session_id` - pub parent_session_id: &'a str, - /// The parent's own ordinal of the DelegationDispatched being followed. - /// - /// Field 5: `parent_dispatched_at` - pub parent_dispatched_at: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 6: `cascade_policy` - pub cascade_policy: ::buffa::EnumValue, - /// The parent-side ledger operation this dispatch reserved. - /// - /// Field 7: `operation_id` - pub operation_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CreateChildSessionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `execution_plan` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_execution_plan(&self) -> bool { - self.execution_plan.is_set() - } - /**Whether required field `workspace` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_workspace(&self) -> bool { - self.workspace.is_set() - } - /**Whether required field `parent_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `parent_dispatched_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_dispatched_at(&self) -> bool { - self.parent_dispatched_at.is_set() - } - /**Whether required field `cascade_policy` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_cascade_policy(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for CreateChildSessionView<'a> { - type Owned = super::super::CreateChildSession; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.execution_plan.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.execution_plan = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.workspace.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.workspace = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.parent_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.parent_dispatched_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.parent_dispatched_at = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.cascade_policy = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CreateChildSession { - session_id: self.session_id.to_string(), - execution_plan: match self.execution_plan.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::StoredSessionExecutionPlan, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - workspace: match self.workspace.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::WorkspaceRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - parent_session_id: self.parent_session_id.to_string(), - parent_dispatched_at: match self.parent_dispatched_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - cascade_policy: self.cascade_policy, - operation_id: self.operation_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CreateChildSessionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.execution_plan.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.execution_plan.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.workspace.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.workspace.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - if self.parent_dispatched_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent_dispatched_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.cascade_policy.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.execution_plan.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.execution_plan.write_to(__cache, buf); - } - if self.workspace.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.workspace.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.parent_session_id, buf); - if self.parent_dispatched_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent_dispatched_at.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(6u32, self.cascade_policy.to_i32(), buf); - ::buffa::types::put_string_field(7u32, &self.operation_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CreateChildSessionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.execution_plan.as_option() { - __map.serialize_entry("executionPlan", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.workspace.as_option() { - __map.serialize_entry("workspace", __v)?; - } - } - { - __map.serialize_entry("parentSessionId", self.parent_session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self - .parent_dispatched_at - .as_option() - { - __map.serialize_entry("parentDispatchedAt", __v)?; - } - } - { - __map.serialize_entry("cascadePolicy", &self.cascade_policy)?; - } - { - __map.serialize_entry("operationId", self.operation_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CreateChildSessionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CreateChildSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CreateChildSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CreateChildSession"; -} -::buffa::impl_default_view_instance!(CreateChildSessionView); -::buffa::impl_view_reborrow!(CreateChildSessionView); -/** Self-contained, `'static` owned view of a `CreateChildSession` message. - - Wraps [`::buffa::OwnedView`]`<`[`CreateChildSessionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CreateChildSessionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CreateChildSessionOwnedView( - ::buffa::OwnedView>, -); -impl CreateChildSessionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CreateChildSessionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CreateChildSessionOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CreateChildSession, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CreateChildSessionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CreateChildSessionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CreateChildSessionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CreateChildSession { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The child session's own id. - /// - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `execution_plan` - #[must_use] - pub fn execution_plan( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::StoredSessionExecutionPlanView<'_>, - > { - &self.0.reborrow().execution_plan - } - /// Field 3: `workspace` - #[must_use] - pub fn workspace( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().workspace - } - /// Field 4: `parent_session_id` - #[must_use] - pub fn parent_session_id(&self) -> &'_ str { - self.0.reborrow().parent_session_id - } - /// The parent's own ordinal of the DelegationDispatched being followed. - /// - /// Field 5: `parent_dispatched_at` - #[must_use] - pub fn parent_dispatched_at( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().parent_dispatched_at - } - /// Field 6: `cascade_policy` - #[must_use] - pub fn cascade_policy(&self) -> ::buffa::EnumValue { - self.0.reborrow().cascade_policy - } - /// The parent-side ledger operation this dispatch reserved. - /// - /// Field 7: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CreateChildSessionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CreateChildSessionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CreateChildSessionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CreateChildSessionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CreateChildSession { - type View<'a> = CreateChildSessionView<'a>; - type ViewHandle = CreateChildSessionOwnedView; -} -impl ::serde::Serialize for CreateChildSessionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.create_child_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.create_child_session.rs deleted file mode 100644 index ca1ca2fca..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.create_child_session.rs +++ /dev/null @@ -1,284 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/create_child_session.proto - -/// CreateChildSession is the delegation saga's second step: it opens the -/// delegated child's stream, recording \[SessionStarted, ParentLinked\] as one -/// batch so a child can never exist without its lineage. -/// -/// Write precondition NoStream on the child. parent_dispatched_at and -/// cascade_policy are copied verbatim from the parent's DelegationDispatched, so -/// a redelivered saga step reproduces the same link (ADR#0035 facet 6). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CreateChildSession { - /// The child session's own id. - /// - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `execution_plan` - #[serde(rename = "executionPlan", alias = "execution_plan")] - pub execution_plan: ::buffa::MessageField< - StoredSessionExecutionPlan, - ::buffa::Inline, - >, - /// Field 3: `workspace` - #[serde(rename = "workspace")] - pub workspace: ::buffa::MessageField>, - /// Field 4: `parent_session_id` - #[serde( - rename = "parentSessionId", - alias = "parent_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub parent_session_id: ::buffa::alloc::string::String, - /// The parent's own ordinal of the DelegationDispatched being followed. - /// - /// Field 5: `parent_dispatched_at` - #[serde(rename = "parentDispatchedAt", alias = "parent_dispatched_at")] - pub parent_dispatched_at: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Field 6: `cascade_policy` - #[serde( - rename = "cascadePolicy", - alias = "cascade_policy", - with = "::buffa::json_helpers::proto_enum" - )] - pub cascade_policy: ::buffa::EnumValue, - /// The parent-side ledger operation this dispatch reserved. - /// - /// Field 7: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for CreateChildSession { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CreateChildSession") - .field("session_id", &self.session_id) - .field("execution_plan", &self.execution_plan) - .field("workspace", &self.workspace) - .field("parent_session_id", &self.parent_session_id) - .field("parent_dispatched_at", &self.parent_dispatched_at) - .field("cascade_policy", &self.cascade_policy) - .field("operation_id", &self.operation_id) - .finish() - } -} -impl CreateChildSession { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CreateChildSession"; -} -::buffa::impl_default_instance!(CreateChildSession); -impl ::buffa::MessageName for CreateChildSession { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CreateChildSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CreateChildSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CreateChildSession"; -} -impl ::buffa::Message for CreateChildSession { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.execution_plan.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.execution_plan.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.workspace.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.workspace.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - if self.parent_dispatched_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent_dispatched_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.cascade_policy.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.execution_plan.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.execution_plan.write_to(__cache, buf); - } - if self.workspace.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.workspace.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.parent_session_id, buf); - if self.parent_dispatched_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent_dispatched_at.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(6u32, self.cascade_policy.to_i32(), buf); - ::buffa::types::put_string_field(7u32, &self.operation_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.execution_plan.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.workspace.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.parent_session_id, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.parent_dispatched_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.cascade_policy = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.execution_plan = ::buffa::MessageField::none(); - self.workspace = ::buffa::MessageField::none(); - self.parent_session_id.clear(); - self.parent_dispatched_at = ::buffa::MessageField::none(); - self.cascade_policy = ::buffa::EnumValue::from(0); - self.operation_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CreateChildSession { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CREATE_CHILD_SESSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CreateChildSession", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.create_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.create_session.__view.rs deleted file mode 100644 index 0837565ea..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.create_session.__view.rs +++ /dev/null @@ -1,398 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/create_session.proto - -/// CreateSession opens a session stream, recording \[SessionStarted\]. -/// -/// Write precondition NoStream: creation is atomic and exactly-once, so a -/// redelivered create observes the stream already exists rather than forking a -/// second history (ADR#0035 facet 2). The execution plan is immutable for the -/// session's life; every later attempt, checkpoint, and compaction is bound to -/// its digest. -#[derive(Clone, Debug, Default)] -pub struct CreateSessionView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `execution_plan` - pub execution_plan: ::buffa::MessageFieldView< - super::super::__buffa::view::StoredSessionExecutionPlanView<'a>, - >, - /// Field 3: `workspace` - pub workspace: ::buffa::MessageFieldView< - super::super::__buffa::view::WorkspaceRefView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CreateSessionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `execution_plan` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_execution_plan(&self) -> bool { - self.execution_plan.is_set() - } - /**Whether required field `workspace` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_workspace(&self) -> bool { - self.workspace.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for CreateSessionView<'a> { - type Owned = super::super::CreateSession; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.execution_plan.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.execution_plan = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.workspace.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.workspace = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CreateSession { - session_id: self.session_id.to_string(), - execution_plan: match self.execution_plan.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::StoredSessionExecutionPlan, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - workspace: match self.workspace.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::WorkspaceRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CreateSessionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.execution_plan.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.execution_plan.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.workspace.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.workspace.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.execution_plan.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.execution_plan.write_to(__cache, buf); - } - if self.workspace.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.workspace.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CreateSessionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.execution_plan.as_option() { - __map.serialize_entry("executionPlan", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.workspace.as_option() { - __map.serialize_entry("workspace", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CreateSessionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CreateSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CreateSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CreateSession"; -} -::buffa::impl_default_view_instance!(CreateSessionView); -::buffa::impl_view_reborrow!(CreateSessionView); -/** Self-contained, `'static` owned view of a `CreateSession` message. - - Wraps [`::buffa::OwnedView`]`<`[`CreateSessionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CreateSessionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CreateSessionOwnedView(::buffa::OwnedView>); -impl CreateSessionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CreateSessionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CreateSessionOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CreateSession, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CreateSessionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CreateSessionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CreateSessionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CreateSession { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `execution_plan` - #[must_use] - pub fn execution_plan( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::StoredSessionExecutionPlanView<'_>, - > { - &self.0.reborrow().execution_plan - } - /// Field 3: `workspace` - #[must_use] - pub fn workspace( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().workspace - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CreateSessionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CreateSessionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CreateSessionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CreateSessionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CreateSession { - type View<'a> = CreateSessionView<'a>; - type ViewHandle = CreateSessionOwnedView; -} -impl ::serde::Serialize for CreateSessionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.create_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.create_session.rs deleted file mode 100644 index ce3db91f3..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.create_session.rs +++ /dev/null @@ -1,183 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/create_session.proto - -/// CreateSession opens a session stream, recording \[SessionStarted\]. -/// -/// Write precondition NoStream: creation is atomic and exactly-once, so a -/// redelivered create observes the stream already exists rather than forking a -/// second history (ADR#0035 facet 2). The execution plan is immutable for the -/// session's life; every later attempt, checkpoint, and compaction is bound to -/// its digest. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CreateSession { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `execution_plan` - #[serde(rename = "executionPlan", alias = "execution_plan")] - pub execution_plan: ::buffa::MessageField< - StoredSessionExecutionPlan, - ::buffa::Inline, - >, - /// Field 3: `workspace` - #[serde(rename = "workspace")] - pub workspace: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for CreateSession { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CreateSession") - .field("session_id", &self.session_id) - .field("execution_plan", &self.execution_plan) - .field("workspace", &self.workspace) - .finish() - } -} -impl CreateSession { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CreateSession"; -} -::buffa::impl_default_instance!(CreateSession); -impl ::buffa::MessageName for CreateSession { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CreateSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CreateSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CreateSession"; -} -impl ::buffa::Message for CreateSession { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.execution_plan.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.execution_plan.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.workspace.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.workspace.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.execution_plan.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.execution_plan.write_to(__cache, buf); - } - if self.workspace.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.workspace.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.execution_plan.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.workspace.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.execution_plan = ::buffa::MessageField::none(); - self.workspace = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CreateSession { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CREATE_SESSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CreateSession", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.delegation_detached.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.delegation_detached.__view.rs deleted file mode 100644 index 712d1c9bd..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.delegation_detached.__view.rs +++ /dev/null @@ -1,354 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/delegation_detached.proto - -/// DelegationDetached is the parent-side fact recording an intentional -/// severance of the parent-child delegation link, causally joined to the -/// child's own ParentDetached by one durable saga id (detach_operation_id) -/// rather than a mirrored write -- each stream records its own -/// invariant-bearing local fact, satisfying ADR#0024's record-once rule -/// (ADR#0035 facet 6). Crash repair: the reconciler completes the missing side -/// idempotently, deduped by detach_operation_id; a duplicate delivery no-ops -/// because decide sees the operation id already folded. It is an -/// invariant-bearing transition (WRITE_PRECONDITION = At). -#[derive(Clone, Debug, Default)] -pub struct DelegationDetachedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 3: `child_session_id` - pub child_session_id: &'a str, - /// Command-time reason for the intentional detach; empty when none. - /// - /// Field 4: `reason` - pub reason: ::core::option::Option<&'a str>, - /// Durable saga id joining this fact to the child's own ParentDetached. - /// - /// Field 5: `detach_operation_id` - pub detach_operation_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DelegationDetachedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `child_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_child_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `detach_operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_detach_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for DelegationDetachedView<'a> { - type Owned = super::super::DelegationDetached; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.child_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = Some(::buffa::types::borrow_str(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detach_operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DelegationDetached { - session_id: self.session_id.to_string(), - child_session_id: self.child_session_id.to_string(), - reason: self.reason.map(|s| s.to_string()), - detach_operation_id: self.detach_operation_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DelegationDetachedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.child_session_id) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.detach_operation_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(3u32, &self.child_session_id, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(4u32, v, buf); - } - ::buffa::types::put_string_field(5u32, &self.detach_operation_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DelegationDetachedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("childSessionId", self.child_session_id)?; - } - if let ::core::option::Option::Some(__v) = self.reason { - __map.serialize_entry("reason", __v)?; - } - { - __map.serialize_entry("detachOperationId", self.detach_operation_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DelegationDetachedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DelegationDetached"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DelegationDetached"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DelegationDetached"; -} -::buffa::impl_default_view_instance!(DelegationDetachedView); -::buffa::impl_view_reborrow!(DelegationDetachedView); -/** Self-contained, `'static` owned view of a `DelegationDetached` message. - - Wraps [`::buffa::OwnedView`]`<`[`DelegationDetachedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DelegationDetachedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DelegationDetachedOwnedView( - ::buffa::OwnedView>, -); -impl DelegationDetachedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DelegationDetachedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DelegationDetachedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DelegationDetached, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DelegationDetachedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DelegationDetachedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DelegationDetachedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DelegationDetached { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 3: `child_session_id` - #[must_use] - pub fn child_session_id(&self) -> &'_ str { - self.0.reborrow().child_session_id - } - /// Command-time reason for the intentional detach; empty when none. - /// - /// Field 4: `reason` - #[must_use] - pub fn reason(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().reason - } - /// Durable saga id joining this fact to the child's own ParentDetached. - /// - /// Field 5: `detach_operation_id` - #[must_use] - pub fn detach_operation_id(&self) -> &'_ str { - self.0.reborrow().detach_operation_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DelegationDetachedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DelegationDetachedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DelegationDetachedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DelegationDetachedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DelegationDetached { - type View<'a> = DelegationDetachedView<'a>; - type ViewHandle = DelegationDetachedOwnedView; -} -impl ::serde::Serialize for DelegationDetachedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.delegation_detached.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.delegation_detached.rs deleted file mode 100644 index 037fc3c9e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.delegation_detached.rs +++ /dev/null @@ -1,193 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/delegation_detached.proto - -/// DelegationDetached is the parent-side fact recording an intentional -/// severance of the parent-child delegation link, causally joined to the -/// child's own ParentDetached by one durable saga id (detach_operation_id) -/// rather than a mirrored write -- each stream records its own -/// invariant-bearing local fact, satisfying ADR#0024's record-once rule -/// (ADR#0035 facet 6). Crash repair: the reconciler completes the missing side -/// idempotently, deduped by detach_operation_id; a duplicate delivery no-ops -/// because decide sees the operation id already folded. It is an -/// invariant-bearing transition (WRITE_PRECONDITION = At). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DelegationDetached { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 3: `child_session_id` - #[serde( - rename = "childSessionId", - alias = "child_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub child_session_id: ::buffa::alloc::string::String, - /// Command-time reason for the intentional detach; empty when none. - /// - /// Field 4: `reason` - #[serde(rename = "reason", skip_serializing_if = "::core::option::Option::is_none")] - pub reason: ::core::option::Option<::buffa::alloc::string::String>, - /// Durable saga id joining this fact to the child's own ParentDetached. - /// - /// Field 5: `detach_operation_id` - #[serde( - rename = "detachOperationId", - alias = "detach_operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub detach_operation_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for DelegationDetached { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DelegationDetached") - .field("session_id", &self.session_id) - .field("child_session_id", &self.child_session_id) - .field("reason", &self.reason) - .field("detach_operation_id", &self.detach_operation_id) - .finish() - } -} -impl DelegationDetached { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DelegationDetached"; -} -impl DelegationDetached { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::reason`] to `Some(value)`, consuming and returning `self`. - pub fn with_reason( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.reason = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(DelegationDetached); -impl ::buffa::MessageName for DelegationDetached { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DelegationDetached"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DelegationDetached"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DelegationDetached"; -} -impl ::buffa::Message for DelegationDetached { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.child_session_id) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.detach_operation_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(3u32, &self.child_session_id, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(4u32, v, buf); - } - ::buffa::types::put_string_field(5u32, &self.detach_operation_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.child_session_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.reason.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.detach_operation_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.child_session_id.clear(); - self.reason = ::core::option::Option::None; - self.detach_operation_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for DelegationDetached { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DELEGATION_DETACHED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.DelegationDetached", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.delegation_dispatched.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.delegation_dispatched.__view.rs deleted file mode 100644 index 79dc74364..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.delegation_dispatched.__view.rs +++ /dev/null @@ -1,364 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/delegation_dispatched.proto - -/// DelegationDispatched is the parent-side link fact recording a dispatched -/// child session, reusing the operation-ledger id to dedupe dispatch (ADR#0035 -/// facet 6). It carries no position field: this event's own fold-derived -/// SessionOrdinal on the parent stream is the dispatch point, copied by the -/// child's ParentLinked.parent_dispatched_at after the parent append acks -/// (parent-first ordering). It is an invariant-bearing transition -/// (WRITE_PRECONDITION = At), letting DispatchDelegation refuse to spawn under -/// an already-terminal parent race-safely. Crash repair: the reconciler -/// observes a DelegationDispatched with no child stream and re-issues child -/// creation; NoStream makes the repair exactly-once. cascade_policy here is the -/// authoritative saga input: repair mints the child from this fact alone, and -/// ParentLinked.cascade_policy is copied verbatim from it, with a mismatching -/// copy rejected at child creation as a typed conflict. -#[derive(Clone, Debug, Default)] -pub struct DelegationDispatchedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `operation_id` - pub operation_id: &'a str, - /// Field 3: `child_session_id` - pub child_session_id: &'a str, - /// Field 5: `cascade_policy` - pub cascade_policy: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DelegationDispatchedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `child_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_child_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `cascade_policy` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_cascade_policy(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for DelegationDispatchedView<'a> { - type Owned = super::super::DelegationDispatched; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.child_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.cascade_policy = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::DelegationDispatched, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::DelegationDispatched, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DelegationDispatched { - session_id: self.session_id.to_string(), - operation_id: self.operation_id.to_string(), - child_session_id: self.child_session_id.to_string(), - cascade_policy: self.cascade_policy, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DelegationDispatchedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.child_session_id) as u64; - { - let val = self.cascade_policy.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - ::buffa::types::put_string_field(3u32, &self.child_session_id, buf); - ::buffa::types::put_int32_field(5u32, self.cascade_policy.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DelegationDispatchedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("operationId", self.operation_id)?; - } - { - __map.serialize_entry("childSessionId", self.child_session_id)?; - } - { - __map.serialize_entry("cascadePolicy", &self.cascade_policy)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DelegationDispatchedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DelegationDispatched"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DelegationDispatched"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DelegationDispatched"; -} -::buffa::impl_default_view_instance!(DelegationDispatchedView); -::buffa::impl_view_reborrow!(DelegationDispatchedView); -/** Self-contained, `'static` owned view of a `DelegationDispatched` message. - - Wraps [`::buffa::OwnedView`]`<`[`DelegationDispatchedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DelegationDispatchedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DelegationDispatchedOwnedView( - ::buffa::OwnedView>, -); -impl DelegationDispatchedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DelegationDispatchedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DelegationDispatchedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DelegationDispatched, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DelegationDispatchedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DelegationDispatchedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DelegationDispatchedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DelegationDispatched { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Field 3: `child_session_id` - #[must_use] - pub fn child_session_id(&self) -> &'_ str { - self.0.reborrow().child_session_id - } - /// Field 5: `cascade_policy` - #[must_use] - pub fn cascade_policy(&self) -> ::buffa::EnumValue { - self.0.reborrow().cascade_policy - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DelegationDispatchedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DelegationDispatchedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DelegationDispatchedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DelegationDispatchedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DelegationDispatched { - type View<'a> = DelegationDispatchedView<'a>; - type ViewHandle = DelegationDispatchedOwnedView; -} -impl ::serde::Serialize for DelegationDispatchedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.delegation_dispatched.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.delegation_dispatched.rs deleted file mode 100644 index d353e966b..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.delegation_dispatched.rs +++ /dev/null @@ -1,181 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/delegation_dispatched.proto - -/// DelegationDispatched is the parent-side link fact recording a dispatched -/// child session, reusing the operation-ledger id to dedupe dispatch (ADR#0035 -/// facet 6). It carries no position field: this event's own fold-derived -/// SessionOrdinal on the parent stream is the dispatch point, copied by the -/// child's ParentLinked.parent_dispatched_at after the parent append acks -/// (parent-first ordering). It is an invariant-bearing transition -/// (WRITE_PRECONDITION = At), letting DispatchDelegation refuse to spawn under -/// an already-terminal parent race-safely. Crash repair: the reconciler -/// observes a DelegationDispatched with no child stream and re-issues child -/// creation; NoStream makes the repair exactly-once. cascade_policy here is the -/// authoritative saga input: repair mints the child from this fact alone, and -/// ParentLinked.cascade_policy is copied verbatim from it, with a mismatching -/// copy rejected at child creation as a typed conflict. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DelegationDispatched { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// Field 3: `child_session_id` - #[serde( - rename = "childSessionId", - alias = "child_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub child_session_id: ::buffa::alloc::string::String, - /// Field 5: `cascade_policy` - #[serde( - rename = "cascadePolicy", - alias = "cascade_policy", - with = "::buffa::json_helpers::proto_enum" - )] - pub cascade_policy: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for DelegationDispatched { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DelegationDispatched") - .field("session_id", &self.session_id) - .field("operation_id", &self.operation_id) - .field("child_session_id", &self.child_session_id) - .field("cascade_policy", &self.cascade_policy) - .finish() - } -} -impl DelegationDispatched { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DelegationDispatched"; -} -::buffa::impl_default_instance!(DelegationDispatched); -impl ::buffa::MessageName for DelegationDispatched { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DelegationDispatched"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DelegationDispatched"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DelegationDispatched"; -} -impl ::buffa::Message for DelegationDispatched { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.child_session_id) as u64; - { - let val = self.cascade_policy.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - ::buffa::types::put_string_field(3u32, &self.child_session_id, buf); - ::buffa::types::put_int32_field(5u32, self.cascade_policy.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.child_session_id, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.cascade_policy = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.operation_id.clear(); - self.child_session_id.clear(); - self.cascade_policy = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for DelegationDispatched { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DELEGATION_DISPATCHED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.DelegationDispatched", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.deny_tool_call.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.deny_tool_call.__view.rs deleted file mode 100644 index 0104dac35..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.deny_tool_call.__view.rs +++ /dev/null @@ -1,389 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/deny_tool_call.proto - -/// DenyToolCall records a human decision to refuse a call, recording -/// \[ToolCallDenied\]. Denial is terminal for the call: it never starts. -/// -/// Write precondition At: mutually exclusive with approve. -#[derive(Clone, Debug, Default)] -pub struct DenyToolCallView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Field 3: `tool_execution_id` - pub tool_execution_id: &'a str, - /// Field 4: `denied_by` - pub denied_by: &'a str, - /// Field 5: `reason` - pub reason: ::core::option::Option<&'a str>, - /// Field 6: `turn_id` - pub turn_id: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DenyToolCallView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_execution_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_execution_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `denied_by` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_denied_by(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for DenyToolCallView<'a> { - type Owned = super::super::DenyToolCall; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_execution_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.denied_by = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = Some(::buffa::types::borrow_str(&mut cur)?); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DenyToolCall { - session_id: self.session_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - tool_execution_id: self.tool_execution_id.to_string(), - denied_by: self.denied_by.to_string(), - reason: self.reason.map(|s| s.to_string()), - turn_id: self.turn_id.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DenyToolCallView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.denied_by) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.turn_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.denied_by, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(5u32, v, buf); - } - if let Some(ref v) = self.turn_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DenyToolCallView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolExecutionId", self.tool_execution_id)?; - } - { - __map.serialize_entry("deniedBy", self.denied_by)?; - } - if let ::core::option::Option::Some(__v) = self.reason { - __map.serialize_entry("reason", __v)?; - } - if let ::core::option::Option::Some(__v) = self.turn_id { - __map.serialize_entry("turnId", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DenyToolCallView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DenyToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DenyToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DenyToolCall"; -} -::buffa::impl_default_view_instance!(DenyToolCallView); -::buffa::impl_view_reborrow!(DenyToolCallView); -/** Self-contained, `'static` owned view of a `DenyToolCall` message. - - Wraps [`::buffa::OwnedView`]`<`[`DenyToolCallView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DenyToolCallView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DenyToolCallOwnedView(::buffa::OwnedView>); -impl DenyToolCallOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DenyToolCallOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DenyToolCallOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DenyToolCall, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DenyToolCallOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DenyToolCallView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DenyToolCallView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DenyToolCall { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Field 3: `tool_execution_id` - #[must_use] - pub fn tool_execution_id(&self) -> &'_ str { - self.0.reborrow().tool_execution_id - } - /// Field 4: `denied_by` - #[must_use] - pub fn denied_by(&self) -> &'_ str { - self.0.reborrow().denied_by - } - /// Field 5: `reason` - #[must_use] - pub fn reason(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().reason - } - /// Field 6: `turn_id` - #[must_use] - pub fn turn_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DenyToolCallOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DenyToolCallOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DenyToolCallOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DenyToolCallOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DenyToolCall { - type View<'a> = DenyToolCallView<'a>; - type ViewHandle = DenyToolCallOwnedView; -} -impl ::serde::Serialize for DenyToolCallOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.deny_tool_call.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.deny_tool_call.rs deleted file mode 100644 index 40661b2b9..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.deny_tool_call.rs +++ /dev/null @@ -1,236 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/deny_tool_call.proto - -/// DenyToolCall records a human decision to refuse a call, recording -/// \[ToolCallDenied\]. Denial is terminal for the call: it never starts. -/// -/// Write precondition At: mutually exclusive with approve. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DenyToolCall { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Field 3: `tool_execution_id` - #[serde( - rename = "toolExecutionId", - alias = "tool_execution_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_execution_id: ::buffa::alloc::string::String, - /// Field 4: `denied_by` - #[serde( - rename = "deniedBy", - alias = "denied_by", - with = "::buffa::json_helpers::proto_string" - )] - pub denied_by: ::buffa::alloc::string::String, - /// Field 5: `reason` - #[serde(rename = "reason", skip_serializing_if = "::core::option::Option::is_none")] - pub reason: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 6: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub turn_id: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for DenyToolCall { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DenyToolCall") - .field("session_id", &self.session_id) - .field("tool_call_id", &self.tool_call_id) - .field("tool_execution_id", &self.tool_execution_id) - .field("denied_by", &self.denied_by) - .field("reason", &self.reason) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl DenyToolCall { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DenyToolCall"; -} -impl DenyToolCall { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::reason`] to `Some(value)`, consuming and returning `self`. - pub fn with_reason( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.reason = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::turn_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_turn_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.turn_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(DenyToolCall); -impl ::buffa::MessageName for DenyToolCall { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DenyToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DenyToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DenyToolCall"; -} -impl ::buffa::Message for DenyToolCall { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.denied_by) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.turn_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.denied_by, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(5u32, v, buf); - } - if let Some(ref v) = self.turn_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_execution_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.denied_by, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.reason.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.turn_id.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.tool_call_id.clear(); - self.tool_execution_id.clear(); - self.denied_by.clear(); - self.reason = ::core::option::Option::None; - self.turn_id = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for DenyToolCall { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DENY_TOOL_CALL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.DenyToolCall", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detach_delegation.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detach_delegation.__view.rs deleted file mode 100644 index c1f9b1579..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detach_delegation.__view.rs +++ /dev/null @@ -1,345 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/detach_delegation.proto - -/// DetachDelegation releases a child from its parent, run against the parent -/// side, recording \[DelegationDetached\]. After it, the parent's terminal state -/// no longer cascades to that child. -/// -/// Write precondition At: one detach per detach_operation_id. The child-side -/// half of the same intent is DetachParent. -#[derive(Clone, Debug, Default)] -pub struct DetachDelegationView<'a> { - /// The parent session. - /// - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `child_session_id` - pub child_session_id: &'a str, - /// Field 3: `detach_operation_id` - pub detach_operation_id: &'a str, - /// Field 4: `reason` - pub reason: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DetachDelegationView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `child_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_child_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `detach_operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_detach_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for DetachDelegationView<'a> { - type Owned = super::super::DetachDelegation; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.child_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detach_operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DetachDelegation { - session_id: self.session_id.to_string(), - child_session_id: self.child_session_id.to_string(), - detach_operation_id: self.detach_operation_id.to_string(), - reason: self.reason.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DetachDelegationView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.child_session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.detach_operation_id) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.child_session_id, buf); - ::buffa::types::put_string_field(3u32, &self.detach_operation_id, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(4u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DetachDelegationView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("childSessionId", self.child_session_id)?; - } - { - __map.serialize_entry("detachOperationId", self.detach_operation_id)?; - } - if let ::core::option::Option::Some(__v) = self.reason { - __map.serialize_entry("reason", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DetachDelegationView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DetachDelegation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DetachDelegation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DetachDelegation"; -} -::buffa::impl_default_view_instance!(DetachDelegationView); -::buffa::impl_view_reborrow!(DetachDelegationView); -/** Self-contained, `'static` owned view of a `DetachDelegation` message. - - Wraps [`::buffa::OwnedView`]`<`[`DetachDelegationView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DetachDelegationView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DetachDelegationOwnedView(::buffa::OwnedView>); -impl DetachDelegationOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DetachDelegationOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DetachDelegationOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DetachDelegation, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DetachDelegationOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DetachDelegationView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DetachDelegationView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DetachDelegation { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The parent session. - /// - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `child_session_id` - #[must_use] - pub fn child_session_id(&self) -> &'_ str { - self.0.reborrow().child_session_id - } - /// Field 3: `detach_operation_id` - #[must_use] - pub fn detach_operation_id(&self) -> &'_ str { - self.0.reborrow().detach_operation_id - } - /// Field 4: `reason` - #[must_use] - pub fn reason(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DetachDelegationOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DetachDelegationOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DetachDelegationOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DetachDelegationOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DetachDelegation { - type View<'a> = DetachDelegationView<'a>; - type ViewHandle = DetachDelegationOwnedView; -} -impl ::serde::Serialize for DetachDelegationOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detach_delegation.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detach_delegation.rs deleted file mode 100644 index 15b39234d..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detach_delegation.rs +++ /dev/null @@ -1,188 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/detach_delegation.proto - -/// DetachDelegation releases a child from its parent, run against the parent -/// side, recording \[DelegationDetached\]. After it, the parent's terminal state -/// no longer cascades to that child. -/// -/// Write precondition At: one detach per detach_operation_id. The child-side -/// half of the same intent is DetachParent. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DetachDelegation { - /// The parent session. - /// - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `child_session_id` - #[serde( - rename = "childSessionId", - alias = "child_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub child_session_id: ::buffa::alloc::string::String, - /// Field 3: `detach_operation_id` - #[serde( - rename = "detachOperationId", - alias = "detach_operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub detach_operation_id: ::buffa::alloc::string::String, - /// Field 4: `reason` - #[serde(rename = "reason", skip_serializing_if = "::core::option::Option::is_none")] - pub reason: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for DetachDelegation { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DetachDelegation") - .field("session_id", &self.session_id) - .field("child_session_id", &self.child_session_id) - .field("detach_operation_id", &self.detach_operation_id) - .field("reason", &self.reason) - .finish() - } -} -impl DetachDelegation { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DetachDelegation"; -} -impl DetachDelegation { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::reason`] to `Some(value)`, consuming and returning `self`. - pub fn with_reason( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.reason = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(DetachDelegation); -impl ::buffa::MessageName for DetachDelegation { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DetachDelegation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DetachDelegation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DetachDelegation"; -} -impl ::buffa::Message for DetachDelegation { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.child_session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.detach_operation_id) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.child_session_id, buf); - ::buffa::types::put_string_field(3u32, &self.detach_operation_id, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(4u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.child_session_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.detach_operation_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.reason.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.child_session_id.clear(); - self.detach_operation_id.clear(); - self.reason = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for DetachDelegation { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DETACH_DELEGATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.DetachDelegation", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detach_parent.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detach_parent.__view.rs deleted file mode 100644 index b9fb4e065..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detach_parent.__view.rs +++ /dev/null @@ -1,320 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/detach_parent.proto - -/// DetachParent releases a child from its parent, run against the child side, -/// recording \[ParentDetached\]. It is the repair half of DetachDelegation: the -/// two sides carry the same detach_operation_id, so a saga interrupted between -/// them converges rather than leaving one side linked. -/// -/// Write precondition At: one detach per detach_operation_id. -#[derive(Clone, Debug, Default)] -pub struct DetachParentView<'a> { - /// The child session. - /// - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `parent_session_id` - pub parent_session_id: &'a str, - /// Field 3: `detach_operation_id` - pub detach_operation_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DetachParentView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `parent_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `detach_operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_detach_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for DetachParentView<'a> { - type Owned = super::super::DetachParent; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.parent_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detach_operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DetachParent { - session_id: self.session_id.to_string(), - parent_session_id: self.parent_session_id.to_string(), - detach_operation_id: self.detach_operation_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DetachParentView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.detach_operation_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - ::buffa::types::put_string_field(3u32, &self.detach_operation_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DetachParentView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("parentSessionId", self.parent_session_id)?; - } - { - __map.serialize_entry("detachOperationId", self.detach_operation_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DetachParentView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DetachParent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DetachParent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DetachParent"; -} -::buffa::impl_default_view_instance!(DetachParentView); -::buffa::impl_view_reborrow!(DetachParentView); -/** Self-contained, `'static` owned view of a `DetachParent` message. - - Wraps [`::buffa::OwnedView`]`<`[`DetachParentView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DetachParentView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DetachParentOwnedView(::buffa::OwnedView>); -impl DetachParentOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DetachParentOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DetachParentOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DetachParent, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DetachParentOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DetachParentView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DetachParentView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DetachParent { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The child session. - /// - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `parent_session_id` - #[must_use] - pub fn parent_session_id(&self) -> &'_ str { - self.0.reborrow().parent_session_id - } - /// Field 3: `detach_operation_id` - #[must_use] - pub fn detach_operation_id(&self) -> &'_ str { - self.0.reborrow().detach_operation_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DetachParentOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DetachParentOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DetachParentOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DetachParentOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DetachParent { - type View<'a> = DetachParentView<'a>; - type ViewHandle = DetachParentOwnedView; -} -impl ::serde::Serialize for DetachParentOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detach_parent.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detach_parent.rs deleted file mode 100644 index 76b5273a6..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detach_parent.rs +++ /dev/null @@ -1,156 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/detach_parent.proto - -/// DetachParent releases a child from its parent, run against the child side, -/// recording \[ParentDetached\]. It is the repair half of DetachDelegation: the -/// two sides carry the same detach_operation_id, so a saga interrupted between -/// them converges rather than leaving one side linked. -/// -/// Write precondition At: one detach per detach_operation_id. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DetachParent { - /// The child session. - /// - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `parent_session_id` - #[serde( - rename = "parentSessionId", - alias = "parent_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub parent_session_id: ::buffa::alloc::string::String, - /// Field 3: `detach_operation_id` - #[serde( - rename = "detachOperationId", - alias = "detach_operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub detach_operation_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for DetachParent { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DetachParent") - .field("session_id", &self.session_id) - .field("parent_session_id", &self.parent_session_id) - .field("detach_operation_id", &self.detach_operation_id) - .finish() - } -} -impl DetachParent { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DetachParent"; -} -::buffa::impl_default_instance!(DetachParent); -impl ::buffa::MessageName for DetachParent { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DetachParent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DetachParent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DetachParent"; -} -impl ::buffa::Message for DetachParent { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.detach_operation_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - ::buffa::types::put_string_field(3u32, &self.detach_operation_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.parent_session_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.detach_operation_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.parent_session_id.clear(); - self.detach_operation_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for DetachParent { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DETACH_PARENT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.DetachParent", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detached_work.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detached_work.__view.rs deleted file mode 100644 index 20fbd71d6..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detached_work.__view.rs +++ /dev/null @@ -1,863 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/detached_work.proto - -/// DetachedWork records that a tool call returned a handle while its work -/// continued outside the turn. -/// -/// A development server is the ordinary case: the tool starts it, returns a URL, -/// and the turn ends while the process keeps running and keeps producing output. -/// Without this the completion is a lie of omission. `ToolCallCompleted` means -/// the call finished, a reader folds it as done, and a process nobody is -/// tracking outlives the session that started it. -/// -/// It is deliberately not a compound background-turn record. Everything durable -/// about the work already has a home: `operation_id` joins the operation ledger, -/// the eventual result arrives as `OperationOutcomeRecorded`, cancellation is -/// `OperationCancellationRequested`, and captured output is a -/// `CommandOutputReplayRef` sealed when the process ends. What was missing is -/// only the fact that the turn was released first, plus the two policies nobody -/// could otherwise infer. -#[derive(Clone, Debug, Default)] -pub struct DetachedWorkView<'a> { - /// The reserved operation this work continues under, joining to - /// OperationReserved and the eventual OperationOutcomeRecorded. - /// - /// Required here, unlike ToolCallRequested.operation_id, which is empty for a - /// call that reserves nothing. Work that outlives its turn has to be - /// addressable to be cancellable, and an unaddressable detached process is the - /// thing this message exists to prevent. - /// - /// Field 1: `operation_id` - pub operation_id: &'a str, - /// Wall-clock instant the turn was released, a real external occurrence - /// distinct from envelope append time (D10). - /// - /// Field 2: `detached_at` - pub detached_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// What happens to this work when the session reaches a terminal state. - /// - /// Field 3: `terminal_ownership` - pub terminal_ownership: ::buffa::EnumValue, - /// How long the work may go unsupervised before a runner is presumed lost. - /// - /// Field 4: `supervision` - pub supervision: ::buffa::MessageFieldView< - super::super::__buffa::view::SupervisionPolicyView<'a>, - >, - /// Where the caller can reach what was started: a URL, a socket path, a - /// container id. Empty when the work exposes nothing addressable. - /// - /// Must be credential-free, the same prohibition ExternalArtifact.source_url - /// carries (D7). A detached development server's URL is the field most likely - /// to arrive with a session token stapled to it. - /// - /// Field 5: `endpoint` - pub endpoint: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DetachedWorkView<'a> { - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `detached_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_detached_at(&self) -> bool { - self.detached_at.is_set() - } - /**Whether required field `terminal_ownership` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_terminal_ownership(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `supervision` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_supervision(&self) -> bool { - self.supervision.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for DetachedWorkView<'a> { - type Owned = super::super::DetachedWork; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.detached_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.detached_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.terminal_ownership = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.supervision.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.supervision = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.endpoint = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DetachedWork { - operation_id: self.operation_id.to_string(), - detached_at: match self.detached_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - terminal_ownership: self.terminal_ownership, - supervision: match self.supervision.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SupervisionPolicy, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - endpoint: self.endpoint.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DetachedWorkView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if self.detached_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.detached_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.terminal_ownership.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.supervision.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.supervision.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.endpoint { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.operation_id, buf); - if self.detached_at.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.detached_at.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.terminal_ownership.to_i32(), buf); - if self.supervision.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.supervision.write_to(__cache, buf); - } - if let Some(ref v) = self.endpoint { - ::buffa::types::put_string_field(5u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DetachedWorkView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("operationId", self.operation_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.detached_at.as_option() { - __map.serialize_entry("detachedAt", __v)?; - } - } - { - __map.serialize_entry("terminalOwnership", &self.terminal_ownership)?; - } - { - if let ::core::option::Option::Some(__v) = self.supervision.as_option() { - __map.serialize_entry("supervision", __v)?; - } - } - if let ::core::option::Option::Some(__v) = self.endpoint { - __map.serialize_entry("endpoint", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DetachedWorkView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DetachedWork"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DetachedWork"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DetachedWork"; -} -::buffa::impl_default_view_instance!(DetachedWorkView); -::buffa::impl_view_reborrow!(DetachedWorkView); -/** Self-contained, `'static` owned view of a `DetachedWork` message. - - Wraps [`::buffa::OwnedView`]`<`[`DetachedWorkView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DetachedWorkView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DetachedWorkOwnedView(::buffa::OwnedView>); -impl DetachedWorkOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DetachedWorkOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DetachedWorkOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DetachedWork, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DetachedWorkOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DetachedWorkView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DetachedWorkView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DetachedWork { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The reserved operation this work continues under, joining to - /// OperationReserved and the eventual OperationOutcomeRecorded. - /// - /// Required here, unlike ToolCallRequested.operation_id, which is empty for a - /// call that reserves nothing. Work that outlives its turn has to be - /// addressable to be cancellable, and an unaddressable detached process is the - /// thing this message exists to prevent. - /// - /// Field 1: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Wall-clock instant the turn was released, a real external occurrence - /// distinct from envelope append time (D10). - /// - /// Field 2: `detached_at` - #[must_use] - pub fn detached_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().detached_at - } - /// What happens to this work when the session reaches a terminal state. - /// - /// Field 3: `terminal_ownership` - #[must_use] - pub fn terminal_ownership( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().terminal_ownership - } - /// How long the work may go unsupervised before a runner is presumed lost. - /// - /// Field 4: `supervision` - #[must_use] - pub fn supervision( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SupervisionPolicyView<'_>, - > { - &self.0.reborrow().supervision - } - /// Where the caller can reach what was started: a URL, a socket path, a - /// container id. Empty when the work exposes nothing addressable. - /// - /// Must be credential-free, the same prohibition ExternalArtifact.source_url - /// carries (D7). A detached development server's URL is the field most likely - /// to arrive with a session token stapled to it. - /// - /// Field 5: `endpoint` - #[must_use] - pub fn endpoint(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().endpoint - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DetachedWorkOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DetachedWorkOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DetachedWorkOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DetachedWorkOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DetachedWork { - type View<'a> = DetachedWorkView<'a>; - type ViewHandle = DetachedWorkOwnedView; -} -impl ::serde::Serialize for DetachedWorkOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// SupervisionPolicy is how a lost runner becomes detectable. -/// -/// It records the policy and never the heartbeat. A renewal per interval would -/// be an append per interval, into a log that is never truncated -/// (ADR#0035 facet 7), and long-lived detached work is precisely the case that -/// generates the most of them. That is the same reason FX-23 keeps a downstream -/// consumer's checkpoint flood out of Session streams: liveness is live state, -/// and live state belongs in the runner registry that a projection reads, not in -/// the history that outlives it. -/// -/// What the log holds is the number a reconciler needs afterwards. Given -/// `max_unsupervised` and the last observed supervision, whether a runner is -/// lost is a question anyone can answer later without having watched. -#[derive(Clone, Debug, Default)] -pub struct SupervisionPolicyView<'a> { - /// How long the work may run without an observed supervisor before it is - /// presumed abandoned and becomes a reconciliation candidate. - /// - /// Field 1: `max_unsupervised` - pub max_unsupervised: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, - /// Identity of the runner that held the work at detach time. Opaque, and - /// recorded so a reconciler can tell work whose runner is gone from work whose - /// runner is merely quiet. - /// - /// Field 2: `runner_id` - pub runner_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SupervisionPolicyView<'a> { - /**Whether required field `max_unsupervised` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_max_unsupervised(&self) -> bool { - self.max_unsupervised.is_set() - } - /**Whether required field `runner_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_runner_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SupervisionPolicyView<'a> { - type Owned = super::super::SupervisionPolicy; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.max_unsupervised.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.max_unsupervised = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.runner_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SupervisionPolicy { - max_unsupervised: match self.max_unsupervised.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - runner_id: self.runner_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SupervisionPolicyView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.max_unsupervised.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.max_unsupervised.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.runner_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.max_unsupervised.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.max_unsupervised.write_to(__cache, buf); - } - ::buffa::types::put_string_field(2u32, &self.runner_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SupervisionPolicyView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.max_unsupervised.as_option() - { - __map.serialize_entry("maxUnsupervised", __v)?; - } - } - { - __map.serialize_entry("runnerId", self.runner_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SupervisionPolicyView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SupervisionPolicy"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SupervisionPolicy"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SupervisionPolicy"; -} -::buffa::impl_default_view_instance!(SupervisionPolicyView); -::buffa::impl_view_reborrow!(SupervisionPolicyView); -/** Self-contained, `'static` owned view of a `SupervisionPolicy` message. - - Wraps [`::buffa::OwnedView`]`<`[`SupervisionPolicyView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SupervisionPolicyView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SupervisionPolicyOwnedView( - ::buffa::OwnedView>, -); -impl SupervisionPolicyOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SupervisionPolicyOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SupervisionPolicyOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SupervisionPolicy, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SupervisionPolicyOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SupervisionPolicyView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SupervisionPolicyView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SupervisionPolicy { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// How long the work may run without an observed supervisor before it is - /// presumed abandoned and becomes a reconciliation candidate. - /// - /// Field 1: `max_unsupervised` - #[must_use] - pub fn max_unsupervised( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().max_unsupervised - } - /// Identity of the runner that held the work at detach time. Opaque, and - /// recorded so a reconciler can tell work whose runner is gone from work whose - /// runner is merely quiet. - /// - /// Field 2: `runner_id` - #[must_use] - pub fn runner_id(&self) -> &'_ str { - self.0.reborrow().runner_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SupervisionPolicyOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SupervisionPolicyOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SupervisionPolicyOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SupervisionPolicyOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SupervisionPolicy { - type View<'a> = SupervisionPolicyView<'a>; - type ViewHandle = SupervisionPolicyOwnedView; -} -impl ::serde::Serialize for SupervisionPolicyOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detached_work.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detached_work.rs deleted file mode 100644 index 4349fae6f..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.detached_work.rs +++ /dev/null @@ -1,616 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/detached_work.proto - -/// TerminalOwnership is what becomes of detached work when its session ends. -/// -/// The zero value cancels, because the two failure modes are not symmetric. -/// Cancelling work that should have survived is visible: something the user -/// wanted stopped, and they find out. Leaving work running that should have -/// stopped is invisible, and it is the orphan problem in -/// `doctor/v1alpha1/orphan.proto` with a process attached instead of a byte -/// range. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum TerminalOwnership { - /// Unknown policy. Treat as CANCEL_ON_TERMINAL. - TERMINAL_OWNERSHIP_UNSPECIFIED = 0i32, - /// Cancel the operation when the session reaches a terminal state. - TERMINAL_OWNERSHIP_CANCEL_ON_TERMINAL = 1i32, - /// Let the work continue past the session's terminal state. - /// - /// The session still owns the record of it. A terminal session with surviving - /// detached work is exactly the case `SessionView.has_unreconciled_work` - /// exists for: terminal is not the same as complete, and a reader that treats - /// them as the same will report a session as finished while its work is still - /// running. - TERMINAL_OWNERSHIP_SURVIVE_TERMINAL = 2i32, -} -impl TerminalOwnership { - ///Idiomatic alias for [`Self::TERMINAL_OWNERSHIP_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::TERMINAL_OWNERSHIP_UNSPECIFIED; - ///Idiomatic alias for [`Self::TERMINAL_OWNERSHIP_CANCEL_ON_TERMINAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const CancelOnTerminal: Self = Self::TERMINAL_OWNERSHIP_CANCEL_ON_TERMINAL; - ///Idiomatic alias for [`Self::TERMINAL_OWNERSHIP_SURVIVE_TERMINAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SurviveTerminal: Self = Self::TERMINAL_OWNERSHIP_SURVIVE_TERMINAL; -} -impl ::core::default::Default for TerminalOwnership { - fn default() -> Self { - Self::TERMINAL_OWNERSHIP_UNSPECIFIED - } -} -impl ::serde::Serialize for TerminalOwnership { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for TerminalOwnership { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = TerminalOwnership; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(TerminalOwnership) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for TerminalOwnership { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for TerminalOwnership { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::TERMINAL_OWNERSHIP_UNSPECIFIED), - 1i32 => { - ::core::option::Option::Some(Self::TERMINAL_OWNERSHIP_CANCEL_ON_TERMINAL) - } - 2i32 => { - ::core::option::Option::Some(Self::TERMINAL_OWNERSHIP_SURVIVE_TERMINAL) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::TERMINAL_OWNERSHIP_UNSPECIFIED => "TERMINAL_OWNERSHIP_UNSPECIFIED", - Self::TERMINAL_OWNERSHIP_CANCEL_ON_TERMINAL => { - "TERMINAL_OWNERSHIP_CANCEL_ON_TERMINAL" - } - Self::TERMINAL_OWNERSHIP_SURVIVE_TERMINAL => { - "TERMINAL_OWNERSHIP_SURVIVE_TERMINAL" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "TERMINAL_OWNERSHIP_UNSPECIFIED" => { - ::core::option::Option::Some(Self::TERMINAL_OWNERSHIP_UNSPECIFIED) - } - "TERMINAL_OWNERSHIP_CANCEL_ON_TERMINAL" => { - ::core::option::Option::Some(Self::TERMINAL_OWNERSHIP_CANCEL_ON_TERMINAL) - } - "TERMINAL_OWNERSHIP_SURVIVE_TERMINAL" => { - ::core::option::Option::Some(Self::TERMINAL_OWNERSHIP_SURVIVE_TERMINAL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::TERMINAL_OWNERSHIP_UNSPECIFIED, - Self::TERMINAL_OWNERSHIP_CANCEL_ON_TERMINAL, - Self::TERMINAL_OWNERSHIP_SURVIVE_TERMINAL, - ] - } -} -/// DetachedWork records that a tool call returned a handle while its work -/// continued outside the turn. -/// -/// A development server is the ordinary case: the tool starts it, returns a URL, -/// and the turn ends while the process keeps running and keeps producing output. -/// Without this the completion is a lie of omission. `ToolCallCompleted` means -/// the call finished, a reader folds it as done, and a process nobody is -/// tracking outlives the session that started it. -/// -/// It is deliberately not a compound background-turn record. Everything durable -/// about the work already has a home: `operation_id` joins the operation ledger, -/// the eventual result arrives as `OperationOutcomeRecorded`, cancellation is -/// `OperationCancellationRequested`, and captured output is a -/// `CommandOutputReplayRef` sealed when the process ends. What was missing is -/// only the fact that the turn was released first, plus the two policies nobody -/// could otherwise infer. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DetachedWork { - /// The reserved operation this work continues under, joining to - /// OperationReserved and the eventual OperationOutcomeRecorded. - /// - /// Required here, unlike ToolCallRequested.operation_id, which is empty for a - /// call that reserves nothing. Work that outlives its turn has to be - /// addressable to be cancellable, and an unaddressable detached process is the - /// thing this message exists to prevent. - /// - /// Field 1: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// Wall-clock instant the turn was released, a real external occurrence - /// distinct from envelope append time (D10). - /// - /// Field 2: `detached_at` - #[serde(rename = "detachedAt", alias = "detached_at")] - pub detached_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// What happens to this work when the session reaches a terminal state. - /// - /// Field 3: `terminal_ownership` - #[serde( - rename = "terminalOwnership", - alias = "terminal_ownership", - with = "::buffa::json_helpers::proto_enum" - )] - pub terminal_ownership: ::buffa::EnumValue, - /// How long the work may go unsupervised before a runner is presumed lost. - /// - /// Field 4: `supervision` - #[serde(rename = "supervision")] - pub supervision: ::buffa::MessageField< - SupervisionPolicy, - ::buffa::Inline, - >, - /// Where the caller can reach what was started: a URL, a socket path, a - /// container id. Empty when the work exposes nothing addressable. - /// - /// Must be credential-free, the same prohibition ExternalArtifact.source_url - /// carries (D7). A detached development server's URL is the field most likely - /// to arrive with a session token stapled to it. - /// - /// Field 5: `endpoint` - #[serde( - rename = "endpoint", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub endpoint: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for DetachedWork { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DetachedWork") - .field("operation_id", &self.operation_id) - .field("detached_at", &self.detached_at) - .field("terminal_ownership", &self.terminal_ownership) - .field("supervision", &self.supervision) - .field("endpoint", &self.endpoint) - .finish() - } -} -impl DetachedWork { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DetachedWork"; -} -impl DetachedWork { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::endpoint`] to `Some(value)`, consuming and returning `self`. - pub fn with_endpoint( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.endpoint = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(DetachedWork); -impl ::buffa::MessageName for DetachedWork { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DetachedWork"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DetachedWork"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DetachedWork"; -} -impl ::buffa::Message for DetachedWork { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if self.detached_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.detached_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.terminal_ownership.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.supervision.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.supervision.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.endpoint { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.operation_id, buf); - if self.detached_at.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.detached_at.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.terminal_ownership.to_i32(), buf); - if self.supervision.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.supervision.write_to(__cache, buf); - } - if let Some(ref v) = self.endpoint { - ::buffa::types::put_string_field(5u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.detached_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.terminal_ownership = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.supervision.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .endpoint - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.operation_id.clear(); - self.detached_at = ::buffa::MessageField::none(); - self.terminal_ownership = ::buffa::EnumValue::from(0); - self.supervision = ::buffa::MessageField::none(); - self.endpoint = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for DetachedWork { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DETACHED_WORK_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.DetachedWork", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// SupervisionPolicy is how a lost runner becomes detectable. -/// -/// It records the policy and never the heartbeat. A renewal per interval would -/// be an append per interval, into a log that is never truncated -/// (ADR#0035 facet 7), and long-lived detached work is precisely the case that -/// generates the most of them. That is the same reason FX-23 keeps a downstream -/// consumer's checkpoint flood out of Session streams: liveness is live state, -/// and live state belongs in the runner registry that a projection reads, not in -/// the history that outlives it. -/// -/// What the log holds is the number a reconciler needs afterwards. Given -/// `max_unsupervised` and the last observed supervision, whether a runner is -/// lost is a question anyone can answer later without having watched. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SupervisionPolicy { - /// How long the work may run without an observed supervisor before it is - /// presumed abandoned and becomes a reconciliation candidate. - /// - /// Field 1: `max_unsupervised` - #[serde(rename = "maxUnsupervised", alias = "max_unsupervised")] - pub max_unsupervised: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, - /// Identity of the runner that held the work at detach time. Opaque, and - /// recorded so a reconciler can tell work whose runner is gone from work whose - /// runner is merely quiet. - /// - /// Field 2: `runner_id` - #[serde( - rename = "runnerId", - alias = "runner_id", - with = "::buffa::json_helpers::proto_string" - )] - pub runner_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for SupervisionPolicy { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SupervisionPolicy") - .field("max_unsupervised", &self.max_unsupervised) - .field("runner_id", &self.runner_id) - .finish() - } -} -impl SupervisionPolicy { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SupervisionPolicy"; -} -::buffa::impl_default_instance!(SupervisionPolicy); -impl ::buffa::MessageName for SupervisionPolicy { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SupervisionPolicy"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SupervisionPolicy"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SupervisionPolicy"; -} -impl ::buffa::Message for SupervisionPolicy { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.max_unsupervised.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.max_unsupervised.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.runner_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.max_unsupervised.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.max_unsupervised.write_to(__cache, buf); - } - ::buffa::types::put_string_field(2u32, &self.runner_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.max_unsupervised.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.runner_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.max_unsupervised = ::buffa::MessageField::none(); - self.runner_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SupervisionPolicy { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SUPERVISION_POLICY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SupervisionPolicy", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.diff_summary.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.diff_summary.__view.rs deleted file mode 100644 index e5aec177e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.diff_summary.__view.rs +++ /dev/null @@ -1,377 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/diff_summary.proto - -/// DiffSummary is the precomputed shape of a recorded file change: exact line -/// counts inline, and the rendered diff out of line like any other large payload -/// (ADR#0031 §3). It exists so a change list renders from one read instead of -/// fetching both content refs and diffing them on every render, and so -/// added/removed line metrics fold from recorded facts rather than from a -/// separately maintained counter. -#[derive(Clone, Debug, Default)] -pub struct DiffSummaryView<'a> { - /// Lines added by the change. - /// - /// Field 1: `added_lines` - pub added_lines: ::core::option::Option, - /// Lines removed by the change. - /// - /// Field 2: `removed_lines` - pub removed_lines: ::core::option::Option, - /// The rendered diff omits hunks. The line counts stay exact regardless. - /// - /// Field 3: `truncated` - pub truncated: ::core::option::Option, - /// Rendered unified diff, claim-checked. Unset when only counts were computed. - /// - /// Field 4: `rendered` - pub rendered: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactRefView<'a>, - >, -} -impl<'a> ::buffa::MessageView<'a> for DiffSummaryView<'a> { - type Owned = super::super::DiffSummary; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.added_lines = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.removed_lines = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.truncated = Some(::buffa::types::decode_bool(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.rendered.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.rendered = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DiffSummary { - added_lines: self.added_lines, - removed_lines: self.removed_lines, - truncated: self.truncated, - rendered: match self.rendered.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DiffSummaryView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(v) = self.added_lines { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.removed_lines { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.truncated.is_some() { - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - } - if self.rendered.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.rendered.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(v) = self.added_lines { - ::buffa::types::put_uint64_field(1u32, v, buf); - } - if let Some(v) = self.removed_lines { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if let Some(v) = self.truncated { - ::buffa::types::put_bool_field(3u32, v, buf); - } - if self.rendered.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.rendered.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DiffSummaryView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - if let ::core::option::Option::Some(__v) = self.added_lines { - __map - .serialize_entry("addedLines", &::buffa::json_helpers::ProtoJson(&__v))?; - } - if let ::core::option::Option::Some(__v) = self.removed_lines { - __map - .serialize_entry( - "removedLines", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.truncated { - __map.serialize_entry("truncated", &__v)?; - } - { - if let ::core::option::Option::Some(__v) = self.rendered.as_option() { - __map.serialize_entry("rendered", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DiffSummaryView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DiffSummary"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DiffSummary"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DiffSummary"; -} -::buffa::impl_default_view_instance!(DiffSummaryView); -::buffa::impl_view_reborrow!(DiffSummaryView); -/** Self-contained, `'static` owned view of a `DiffSummary` message. - - Wraps [`::buffa::OwnedView`]`<`[`DiffSummaryView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DiffSummaryView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DiffSummaryOwnedView(::buffa::OwnedView>); -impl DiffSummaryOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DiffSummaryOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DiffSummaryOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DiffSummary, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DiffSummaryOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DiffSummaryView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DiffSummaryView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DiffSummary { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Lines added by the change. - /// - /// Field 1: `added_lines` - #[must_use] - pub fn added_lines(&self) -> ::core::option::Option { - self.0.reborrow().added_lines - } - /// Lines removed by the change. - /// - /// Field 2: `removed_lines` - #[must_use] - pub fn removed_lines(&self) -> ::core::option::Option { - self.0.reborrow().removed_lines - } - /// The rendered diff omits hunks. The line counts stay exact regardless. - /// - /// Field 3: `truncated` - #[must_use] - pub fn truncated(&self) -> ::core::option::Option { - self.0.reborrow().truncated - } - /// Rendered unified diff, claim-checked. Unset when only counts were computed. - /// - /// Field 4: `rendered` - #[must_use] - pub fn rendered( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().rendered - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DiffSummaryOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DiffSummaryOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DiffSummaryOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DiffSummaryOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DiffSummary { - type View<'a> = DiffSummaryView<'a>; - type ViewHandle = DiffSummaryOwnedView; -} -impl ::serde::Serialize for DiffSummaryOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.diff_summary.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.diff_summary.rs deleted file mode 100644 index d79169645..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.diff_summary.rs +++ /dev/null @@ -1,236 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/diff_summary.proto - -/// DiffSummary is the precomputed shape of a recorded file change: exact line -/// counts inline, and the rendered diff out of line like any other large payload -/// (ADR#0031 §3). It exists so a change list renders from one read instead of -/// fetching both content refs and diffing them on every render, and so -/// added/removed line metrics fold from recorded facts rather than from a -/// separately maintained counter. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DiffSummary { - /// Lines added by the change. - /// - /// Field 1: `added_lines` - #[serde( - rename = "addedLines", - alias = "added_lines", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub added_lines: ::core::option::Option, - /// Lines removed by the change. - /// - /// Field 2: `removed_lines` - #[serde( - rename = "removedLines", - alias = "removed_lines", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub removed_lines: ::core::option::Option, - /// The rendered diff omits hunks. The line counts stay exact regardless. - /// - /// Field 3: `truncated` - #[serde( - rename = "truncated", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub truncated: ::core::option::Option, - /// Rendered unified diff, claim-checked. Unset when only counts were computed. - /// - /// Field 4: `rendered` - #[serde( - rename = "rendered", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub rendered: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for DiffSummary { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DiffSummary") - .field("added_lines", &self.added_lines) - .field("removed_lines", &self.removed_lines) - .field("truncated", &self.truncated) - .field("rendered", &self.rendered) - .finish() - } -} -impl DiffSummary { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DiffSummary"; -} -impl DiffSummary { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::added_lines`] to `Some(value)`, consuming and returning `self`. - pub fn with_added_lines(mut self, value: u64) -> Self { - self.added_lines = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::removed_lines`] to `Some(value)`, consuming and returning `self`. - pub fn with_removed_lines(mut self, value: u64) -> Self { - self.removed_lines = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::truncated`] to `Some(value)`, consuming and returning `self`. - pub fn with_truncated(mut self, value: bool) -> Self { - self.truncated = Some(value); - self - } -} -::buffa::impl_default_instance!(DiffSummary); -impl ::buffa::MessageName for DiffSummary { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DiffSummary"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DiffSummary"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DiffSummary"; -} -impl ::buffa::Message for DiffSummary { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(v) = self.added_lines { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.removed_lines { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.truncated.is_some() { - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - } - if self.rendered.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.rendered.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(v) = self.added_lines { - ::buffa::types::put_uint64_field(1u32, v, buf); - } - if let Some(v) = self.removed_lines { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if let Some(v) = self.truncated { - ::buffa::types::put_bool_field(3u32, v, buf); - } - if self.rendered.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.rendered.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.added_lines = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.removed_lines = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.truncated = ::core::option::Option::Some( - ::buffa::types::decode_bool(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.rendered.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.added_lines = ::core::option::Option::None; - self.removed_lines = ::core::option::Option::None; - self.truncated = ::core::option::Option::None; - self.rendered = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for DiffSummary { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DIFF_SUMMARY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.DiffSummary", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.digest.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.digest.__view.rs deleted file mode 100644 index 0ab227a26..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.digest.__view.rs +++ /dev/null @@ -1,288 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/digest.proto - -/// Digest is a content digest over an opaque byte sequence: the algorithm that -/// produced it plus the raw digest value. It is stored beside the bytes it -/// commits to, never inside them, and verified before those bytes are decoded -/// (ADR#0031 §6). -#[derive(Clone, Debug, Default)] -pub struct DigestView<'a> { - /// Digest algorithm identifier, for example "sha256". - /// - /// Field 1: `algorithm` - pub algorithm: &'a str, - /// Raw digest bytes produced by algorithm over the committed content. - /// - /// Field 2: `value` - pub value: &'a [u8], - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DigestView<'a> { - /**Whether required field `algorithm` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_algorithm(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `value` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_value(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for DigestView<'a> { - type Owned = super::super::Digest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.algorithm = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.value = ::buffa::types::borrow_bytes(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::Digest { - algorithm: self.algorithm.to_string(), - value: (self.value).to_vec(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DigestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.algorithm) as u64; - size += 1u64 + ::buffa::types::bytes_encoded_len(&self.value) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.algorithm, buf); - ::buffa::types::put_shared_bytes_field(2u32, &self.value, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DigestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("algorithm", self.algorithm)?; - } - { - __map - .serialize_entry( - "value", - &::buffa::json_helpers::BytesJson(self.value), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DigestView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "Digest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.Digest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.Digest"; -} -::buffa::impl_default_view_instance!(DigestView); -::buffa::impl_view_reborrow!(DigestView); -/** Self-contained, `'static` owned view of a `Digest` message. - - Wraps [`::buffa::OwnedView`]`<`[`DigestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DigestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DigestOwnedView(::buffa::OwnedView>); -impl DigestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok(DigestOwnedView(::buffa::OwnedView::decode(bytes)?)) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DigestOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::Digest, - ) -> ::core::result::Result { - ::core::result::Result::Ok(DigestOwnedView(::buffa::OwnedView::from_owned(msg)?)) - } - /// Borrow the full [`DigestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DigestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::Digest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Digest algorithm identifier, for example "sha256". - /// - /// Field 1: `algorithm` - #[must_use] - pub fn algorithm(&self) -> &'_ str { - self.0.reborrow().algorithm - } - /// Raw digest bytes produced by algorithm over the committed content. - /// - /// Field 2: `value` - #[must_use] - pub fn value(&self) -> &'_ [u8] { - self.0.reborrow().value - } -} -impl ::core::convert::From<::buffa::OwnedView>> for DigestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DigestOwnedView(inner) - } -} -impl ::core::convert::From for ::buffa::OwnedView> { - fn from(wrapper: DigestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DigestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::Digest { - type View<'a> = DigestView<'a>; - type ViewHandle = DigestOwnedView; -} -impl ::serde::Serialize for DigestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.digest.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.digest.rs deleted file mode 100644 index 70cc48d61..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.digest.rs +++ /dev/null @@ -1,127 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/digest.proto - -/// Digest is a content digest over an opaque byte sequence: the algorithm that -/// produced it plus the raw digest value. It is stored beside the bytes it -/// commits to, never inside them, and verified before those bytes are decoded -/// (ADR#0031 §6). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct Digest { - /// Digest algorithm identifier, for example "sha256". - /// - /// Field 1: `algorithm` - #[serde(rename = "algorithm", with = "::buffa::json_helpers::proto_string")] - pub algorithm: ::buffa::alloc::string::String, - /// Raw digest bytes produced by algorithm over the committed content. - /// - /// Field 2: `value` - #[serde(rename = "value", with = "::buffa::json_helpers::bytes")] - pub value: ::buffa::alloc::vec::Vec, -} -impl ::core::fmt::Debug for Digest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Digest") - .field("algorithm", &self.algorithm) - .field("value", &self.value) - .finish() - } -} -impl Digest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.Digest"; -} -::buffa::impl_default_instance!(Digest); -impl ::buffa::MessageName for Digest { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "Digest"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.Digest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.Digest"; -} -impl ::buffa::Message for Digest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.algorithm) as u64; - size += 1u64 + ::buffa::types::bytes_encoded_len(&self.value) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.algorithm, buf); - ::buffa::types::put_shared_bytes_field(2u32, &self.value, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.algorithm, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes(&mut self.value, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.algorithm.clear(); - self.value.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for Digest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DIGEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.Digest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.dispatch_delegation.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.dispatch_delegation.__view.rs deleted file mode 100644 index abb773c1b..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.dispatch_delegation.__view.rs +++ /dev/null @@ -1,361 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/dispatch_delegation.proto - -/// DispatchDelegation is the delegation saga's first step, run against the -/// parent: it records \[DelegationDispatched\], naming the child and what happens -/// to it when the parent reaches a terminal state. -/// -/// Write precondition At: one dispatch per operation_id, and the parent must not -/// already be terminal. -#[derive(Clone, Debug, Default)] -pub struct DispatchDelegationView<'a> { - /// The parent session. - /// - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `operation_id` - pub operation_id: &'a str, - /// Field 3: `child_session_id` - pub child_session_id: &'a str, - /// Recorded at dispatch so an orphaned child is never a silent accident - /// (ADR#0035 facet 6). - /// - /// Field 4: `cascade_policy` - pub cascade_policy: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DispatchDelegationView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `child_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_child_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `cascade_policy` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_cascade_policy(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for DispatchDelegationView<'a> { - type Owned = super::super::DispatchDelegation; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.child_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.cascade_policy = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DispatchDelegation { - session_id: self.session_id.to_string(), - operation_id: self.operation_id.to_string(), - child_session_id: self.child_session_id.to_string(), - cascade_policy: self.cascade_policy, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DispatchDelegationView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.child_session_id) as u64; - { - let val = self.cascade_policy.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - ::buffa::types::put_string_field(3u32, &self.child_session_id, buf); - ::buffa::types::put_int32_field(4u32, self.cascade_policy.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DispatchDelegationView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("operationId", self.operation_id)?; - } - { - __map.serialize_entry("childSessionId", self.child_session_id)?; - } - { - __map.serialize_entry("cascadePolicy", &self.cascade_policy)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DispatchDelegationView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DispatchDelegation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DispatchDelegation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DispatchDelegation"; -} -::buffa::impl_default_view_instance!(DispatchDelegationView); -::buffa::impl_view_reborrow!(DispatchDelegationView); -/** Self-contained, `'static` owned view of a `DispatchDelegation` message. - - Wraps [`::buffa::OwnedView`]`<`[`DispatchDelegationView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DispatchDelegationView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DispatchDelegationOwnedView( - ::buffa::OwnedView>, -); -impl DispatchDelegationOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DispatchDelegationOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DispatchDelegationOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DispatchDelegation, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DispatchDelegationOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DispatchDelegationView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DispatchDelegationView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DispatchDelegation { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The parent session. - /// - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Field 3: `child_session_id` - #[must_use] - pub fn child_session_id(&self) -> &'_ str { - self.0.reborrow().child_session_id - } - /// Recorded at dispatch so an orphaned child is never a silent accident - /// (ADR#0035 facet 6). - /// - /// Field 4: `cascade_policy` - #[must_use] - pub fn cascade_policy(&self) -> ::buffa::EnumValue { - self.0.reborrow().cascade_policy - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DispatchDelegationOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DispatchDelegationOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DispatchDelegationOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DispatchDelegationOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DispatchDelegation { - type View<'a> = DispatchDelegationView<'a>; - type ViewHandle = DispatchDelegationOwnedView; -} -impl ::serde::Serialize for DispatchDelegationOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.dispatch_delegation.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.dispatch_delegation.rs deleted file mode 100644 index 97e1327d0..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.dispatch_delegation.rs +++ /dev/null @@ -1,179 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/dispatch_delegation.proto - -/// DispatchDelegation is the delegation saga's first step, run against the -/// parent: it records \[DelegationDispatched\], naming the child and what happens -/// to it when the parent reaches a terminal state. -/// -/// Write precondition At: one dispatch per operation_id, and the parent must not -/// already be terminal. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DispatchDelegation { - /// The parent session. - /// - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// Field 3: `child_session_id` - #[serde( - rename = "childSessionId", - alias = "child_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub child_session_id: ::buffa::alloc::string::String, - /// Recorded at dispatch so an orphaned child is never a silent accident - /// (ADR#0035 facet 6). - /// - /// Field 4: `cascade_policy` - #[serde( - rename = "cascadePolicy", - alias = "cascade_policy", - with = "::buffa::json_helpers::proto_enum" - )] - pub cascade_policy: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for DispatchDelegation { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DispatchDelegation") - .field("session_id", &self.session_id) - .field("operation_id", &self.operation_id) - .field("child_session_id", &self.child_session_id) - .field("cascade_policy", &self.cascade_policy) - .finish() - } -} -impl DispatchDelegation { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DispatchDelegation"; -} -::buffa::impl_default_instance!(DispatchDelegation); -impl ::buffa::MessageName for DispatchDelegation { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DispatchDelegation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DispatchDelegation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DispatchDelegation"; -} -impl ::buffa::Message for DispatchDelegation { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.child_session_id) as u64; - { - let val = self.cascade_policy.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - ::buffa::types::put_string_field(3u32, &self.child_session_id, buf); - ::buffa::types::put_int32_field(4u32, self.cascade_policy.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.child_session_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.cascade_policy = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.operation_id.clear(); - self.child_session_id.clear(); - self.cascade_policy = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for DispatchDelegation { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DISPATCH_DELEGATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.DispatchDelegation", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.dispatch_external_delegation.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.dispatch_external_delegation.__view.rs deleted file mode 100644 index 0671949be..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.dispatch_external_delegation.__view.rs +++ /dev/null @@ -1,496 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/dispatch_external_delegation.proto - -/// DispatchExternalDelegation hands work to an agent outside this store, -/// recording \[ExternalDelegationDispatched\]. -/// -/// Write precondition At: one dispatch per operation_id. -#[derive(Clone, Debug, Default)] -pub struct DispatchExternalDelegationView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `operation_id` - pub operation_id: &'a str, - /// Field 3: `delegate_reference` - pub delegate_reference: &'a str, - /// Field 4: `authenticated_remote_subject` - pub authenticated_remote_subject: &'a str, - /// Field 5: `authorization_reference` - pub authorization_reference: &'a str, - /// Field 6: `request_digest` - pub request_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Field 7: `correlation_id` - pub correlation_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> DispatchExternalDelegationView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `delegate_reference` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_delegate_reference(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `authenticated_remote_subject` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_authenticated_remote_subject(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `authorization_reference` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_authorization_reference(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } - /**Whether required field `request_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_request_digest(&self) -> bool { - self.request_digest.is_set() - } - /**Whether required field `correlation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_correlation_id(&self) -> bool { - self.__buffa_required_seen_0 & 32u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for DispatchExternalDelegationView<'a> { - type Owned = super::super::DispatchExternalDelegation; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.delegate_reference = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.authenticated_remote_subject = ::buffa::types::borrow_str( - &mut cur, - )?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.authorization_reference = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.request_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.request_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.correlation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 32u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::DispatchExternalDelegation, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::DispatchExternalDelegation, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::DispatchExternalDelegation { - session_id: self.session_id.to_string(), - operation_id: self.operation_id.to_string(), - delegate_reference: self.delegate_reference.to_string(), - authenticated_remote_subject: self.authenticated_remote_subject.to_string(), - authorization_reference: self.authorization_reference.to_string(), - request_digest: match self.request_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - correlation_id: self.correlation_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for DispatchExternalDelegationView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.delegate_reference) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.authenticated_remote_subject) - as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.authorization_reference) - as u64; - if self.request_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.request_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.correlation_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - ::buffa::types::put_string_field(3u32, &self.delegate_reference, buf); - ::buffa::types::put_string_field(4u32, &self.authenticated_remote_subject, buf); - ::buffa::types::put_string_field(5u32, &self.authorization_reference, buf); - if self.request_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.request_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(7u32, &self.correlation_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for DispatchExternalDelegationView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("operationId", self.operation_id)?; - } - { - __map.serialize_entry("delegateReference", self.delegate_reference)?; - } - { - __map - .serialize_entry( - "authenticatedRemoteSubject", - self.authenticated_remote_subject, - )?; - } - { - __map - .serialize_entry( - "authorizationReference", - self.authorization_reference, - )?; - } - { - if let ::core::option::Option::Some(__v) = self.request_digest.as_option() { - __map.serialize_entry("requestDigest", __v)?; - } - } - { - __map.serialize_entry("correlationId", self.correlation_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for DispatchExternalDelegationView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DispatchExternalDelegation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DispatchExternalDelegation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DispatchExternalDelegation"; -} -::buffa::impl_default_view_instance!(DispatchExternalDelegationView); -::buffa::impl_view_reborrow!(DispatchExternalDelegationView); -/** Self-contained, `'static` owned view of a `DispatchExternalDelegation` message. - - Wraps [`::buffa::OwnedView`]`<`[`DispatchExternalDelegationView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`DispatchExternalDelegationView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct DispatchExternalDelegationOwnedView( - ::buffa::OwnedView>, -); -impl DispatchExternalDelegationOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DispatchExternalDelegationOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DispatchExternalDelegationOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::DispatchExternalDelegation, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - DispatchExternalDelegationOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`DispatchExternalDelegationView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &DispatchExternalDelegationView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::DispatchExternalDelegation { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Field 3: `delegate_reference` - #[must_use] - pub fn delegate_reference(&self) -> &'_ str { - self.0.reborrow().delegate_reference - } - /// Field 4: `authenticated_remote_subject` - #[must_use] - pub fn authenticated_remote_subject(&self) -> &'_ str { - self.0.reborrow().authenticated_remote_subject - } - /// Field 5: `authorization_reference` - #[must_use] - pub fn authorization_reference(&self) -> &'_ str { - self.0.reborrow().authorization_reference - } - /// Field 6: `request_digest` - #[must_use] - pub fn request_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().request_digest - } - /// Field 7: `correlation_id` - #[must_use] - pub fn correlation_id(&self) -> &'_ str { - self.0.reborrow().correlation_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for DispatchExternalDelegationOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - DispatchExternalDelegationOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: DispatchExternalDelegationOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for DispatchExternalDelegationOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::DispatchExternalDelegation { - type View<'a> = DispatchExternalDelegationView<'a>; - type ViewHandle = DispatchExternalDelegationOwnedView; -} -impl ::serde::Serialize for DispatchExternalDelegationOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.dispatch_external_delegation.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.dispatch_external_delegation.rs deleted file mode 100644 index c67e0c451..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.dispatch_external_delegation.rs +++ /dev/null @@ -1,246 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/dispatch_external_delegation.proto - -/// DispatchExternalDelegation hands work to an agent outside this store, -/// recording \[ExternalDelegationDispatched\]. -/// -/// Write precondition At: one dispatch per operation_id. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct DispatchExternalDelegation { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// Field 3: `delegate_reference` - #[serde( - rename = "delegateReference", - alias = "delegate_reference", - with = "::buffa::json_helpers::proto_string" - )] - pub delegate_reference: ::buffa::alloc::string::String, - /// Field 4: `authenticated_remote_subject` - #[serde( - rename = "authenticatedRemoteSubject", - alias = "authenticated_remote_subject", - with = "::buffa::json_helpers::proto_string" - )] - pub authenticated_remote_subject: ::buffa::alloc::string::String, - /// Field 5: `authorization_reference` - #[serde( - rename = "authorizationReference", - alias = "authorization_reference", - with = "::buffa::json_helpers::proto_string" - )] - pub authorization_reference: ::buffa::alloc::string::String, - /// Field 6: `request_digest` - #[serde(rename = "requestDigest", alias = "request_digest")] - pub request_digest: ::buffa::MessageField>, - /// Field 7: `correlation_id` - #[serde( - rename = "correlationId", - alias = "correlation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub correlation_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for DispatchExternalDelegation { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("DispatchExternalDelegation") - .field("session_id", &self.session_id) - .field("operation_id", &self.operation_id) - .field("delegate_reference", &self.delegate_reference) - .field("authenticated_remote_subject", &self.authenticated_remote_subject) - .field("authorization_reference", &self.authorization_reference) - .field("request_digest", &self.request_digest) - .field("correlation_id", &self.correlation_id) - .finish() - } -} -impl DispatchExternalDelegation { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DispatchExternalDelegation"; -} -::buffa::impl_default_instance!(DispatchExternalDelegation); -impl ::buffa::MessageName for DispatchExternalDelegation { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "DispatchExternalDelegation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.DispatchExternalDelegation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.DispatchExternalDelegation"; -} -impl ::buffa::Message for DispatchExternalDelegation { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.delegate_reference) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.authenticated_remote_subject) - as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.authorization_reference) - as u64; - if self.request_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.request_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.correlation_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - ::buffa::types::put_string_field(3u32, &self.delegate_reference, buf); - ::buffa::types::put_string_field(4u32, &self.authenticated_remote_subject, buf); - ::buffa::types::put_string_field(5u32, &self.authorization_reference, buf); - if self.request_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.request_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(7u32, &self.correlation_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.delegate_reference, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - &mut self.authenticated_remote_subject, - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.authorization_reference, buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.request_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.correlation_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.operation_id.clear(); - self.delegate_reference.clear(); - self.authenticated_remote_subject.clear(); - self.authorization_reference.clear(); - self.request_digest = ::buffa::MessageField::none(); - self.correlation_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for DispatchExternalDelegation { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __DISPATCH_EXTERNAL_DELEGATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.DispatchExternalDelegation", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.end_execution_attempt.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.end_execution_attempt.__view.rs deleted file mode 100644 index 351d990ad..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.end_execution_attempt.__view.rs +++ /dev/null @@ -1,424 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/end_execution_attempt.proto - -/// EndExecutionAttempt releases the session from an attempt, recording -/// \[ExecutionAttemptEnded\]. -/// -/// Write precondition At: one outcome per attempt. -#[derive(Clone, Debug, Default)] -pub struct EndExecutionAttemptView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `execution_attempt_id` - pub execution_attempt_id: &'a str, - /// Field 3: `outcome` - pub outcome: ::buffa::EnumValue, - /// Field 4: `detail` - pub detail: ::core::option::Option<&'a str>, - /// Field 5: `ended_at` - pub ended_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> EndExecutionAttemptView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `execution_attempt_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_execution_attempt_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `outcome` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_outcome(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `ended_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ended_at(&self) -> bool { - self.ended_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for EndExecutionAttemptView<'a> { - type Owned = super::super::EndExecutionAttempt; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.execution_attempt_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.outcome = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.ended_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.ended_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::EndExecutionAttempt, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::EndExecutionAttempt, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::EndExecutionAttempt { - session_id: self.session_id.to_string(), - execution_attempt_id: self.execution_attempt_id.to_string(), - outcome: self.outcome, - detail: self.detail.map(|s| s.to_string()), - ended_at: match self.ended_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for EndExecutionAttemptView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - { - let val = self.outcome.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.ended_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ended_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.execution_attempt_id, buf); - ::buffa::types::put_int32_field(3u32, self.outcome.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.ended_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ended_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for EndExecutionAttemptView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("executionAttemptId", self.execution_attempt_id)?; - } - { - __map.serialize_entry("outcome", &self.outcome)?; - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.ended_at.as_option() { - __map.serialize_entry("endedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for EndExecutionAttemptView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "EndExecutionAttempt"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.EndExecutionAttempt"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.EndExecutionAttempt"; -} -::buffa::impl_default_view_instance!(EndExecutionAttemptView); -::buffa::impl_view_reborrow!(EndExecutionAttemptView); -/** Self-contained, `'static` owned view of a `EndExecutionAttempt` message. - - Wraps [`::buffa::OwnedView`]`<`[`EndExecutionAttemptView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`EndExecutionAttemptView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct EndExecutionAttemptOwnedView( - ::buffa::OwnedView>, -); -impl EndExecutionAttemptOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - EndExecutionAttemptOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - EndExecutionAttemptOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::EndExecutionAttempt, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - EndExecutionAttemptOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`EndExecutionAttemptView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &EndExecutionAttemptView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::EndExecutionAttempt { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `execution_attempt_id` - #[must_use] - pub fn execution_attempt_id(&self) -> &'_ str { - self.0.reborrow().execution_attempt_id - } - /// Field 3: `outcome` - #[must_use] - pub fn outcome(&self) -> ::buffa::EnumValue { - self.0.reborrow().outcome - } - /// Field 4: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } - /// Field 5: `ended_at` - #[must_use] - pub fn ended_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().ended_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for EndExecutionAttemptOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - EndExecutionAttemptOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: EndExecutionAttemptOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for EndExecutionAttemptOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::EndExecutionAttempt { - type View<'a> = EndExecutionAttemptView<'a>; - type ViewHandle = EndExecutionAttemptOwnedView; -} -impl ::serde::Serialize for EndExecutionAttemptOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.end_execution_attempt.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.end_execution_attempt.rs deleted file mode 100644 index a1fa0c610..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.end_execution_attempt.rs +++ /dev/null @@ -1,220 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/end_execution_attempt.proto - -/// EndExecutionAttempt releases the session from an attempt, recording -/// \[ExecutionAttemptEnded\]. -/// -/// Write precondition At: one outcome per attempt. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct EndExecutionAttempt { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `execution_attempt_id` - #[serde( - rename = "executionAttemptId", - alias = "execution_attempt_id", - with = "::buffa::json_helpers::proto_string" - )] - pub execution_attempt_id: ::buffa::alloc::string::String, - /// Field 3: `outcome` - #[serde(rename = "outcome", with = "::buffa::json_helpers::proto_enum")] - pub outcome: ::buffa::EnumValue, - /// Field 4: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 5: `ended_at` - #[serde(rename = "endedAt", alias = "ended_at")] - pub ended_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for EndExecutionAttempt { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("EndExecutionAttempt") - .field("session_id", &self.session_id) - .field("execution_attempt_id", &self.execution_attempt_id) - .field("outcome", &self.outcome) - .field("detail", &self.detail) - .field("ended_at", &self.ended_at) - .finish() - } -} -impl EndExecutionAttempt { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.EndExecutionAttempt"; -} -impl EndExecutionAttempt { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(EndExecutionAttempt); -impl ::buffa::MessageName for EndExecutionAttempt { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "EndExecutionAttempt"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.EndExecutionAttempt"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.EndExecutionAttempt"; -} -impl ::buffa::Message for EndExecutionAttempt { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - { - let val = self.outcome.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.ended_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ended_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.execution_attempt_id, buf); - ::buffa::types::put_int32_field(3u32, self.outcome.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.ended_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ended_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.execution_attempt_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.outcome = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.ended_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.execution_attempt_id.clear(); - self.outcome = ::buffa::EnumValue::from(0); - self.detail = ::core::option::Option::None; - self.ended_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for EndExecutionAttempt { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __END_EXECUTION_ATTEMPT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.EndExecutionAttempt", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.erase_artifact.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.erase_artifact.__view.rs deleted file mode 100644 index a35dad4a4..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.erase_artifact.__view.rs +++ /dev/null @@ -1,309 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/erase_artifact.proto - -/// EraseArtifact removes claim-checked bytes an event referenced, recording -/// \[ArtifactErased\]. The event that referenced them stays on the log; only the -/// out-of-line payload goes. -/// -/// Write precondition At: the artifact must exist and be claim-checked, verified -/// at the command boundary against the artifact store rather than from folded -/// state. -#[derive(Clone, Debug, Default)] -pub struct EraseArtifactView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `artifact_id` - pub artifact_id: &'a str, - /// Field 3: `reason` - pub reason: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> EraseArtifactView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `artifact_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for EraseArtifactView<'a> { - type Owned = super::super::EraseArtifact; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.artifact_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::EraseArtifact { - session_id: self.session_id.to_string(), - artifact_id: self.artifact_id.to_string(), - reason: self.reason.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for EraseArtifactView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.artifact_id, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for EraseArtifactView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("artifactId", self.artifact_id)?; - } - if let ::core::option::Option::Some(__v) = self.reason { - __map.serialize_entry("reason", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for EraseArtifactView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "EraseArtifact"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.EraseArtifact"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.EraseArtifact"; -} -::buffa::impl_default_view_instance!(EraseArtifactView); -::buffa::impl_view_reborrow!(EraseArtifactView); -/** Self-contained, `'static` owned view of a `EraseArtifact` message. - - Wraps [`::buffa::OwnedView`]`<`[`EraseArtifactView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`EraseArtifactView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct EraseArtifactOwnedView(::buffa::OwnedView>); -impl EraseArtifactOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - EraseArtifactOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - EraseArtifactOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::EraseArtifact, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - EraseArtifactOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`EraseArtifactView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &EraseArtifactView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::EraseArtifact { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `artifact_id` - #[must_use] - pub fn artifact_id(&self) -> &'_ str { - self.0.reborrow().artifact_id - } - /// Field 3: `reason` - #[must_use] - pub fn reason(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for EraseArtifactOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - EraseArtifactOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: EraseArtifactOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for EraseArtifactOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::EraseArtifact { - type View<'a> = EraseArtifactView<'a>; - type ViewHandle = EraseArtifactOwnedView; -} -impl ::serde::Serialize for EraseArtifactOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.erase_artifact.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.erase_artifact.rs deleted file mode 100644 index 96215fe6e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.erase_artifact.rs +++ /dev/null @@ -1,167 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/erase_artifact.proto - -/// EraseArtifact removes claim-checked bytes an event referenced, recording -/// \[ArtifactErased\]. The event that referenced them stays on the log; only the -/// out-of-line payload goes. -/// -/// Write precondition At: the artifact must exist and be claim-checked, verified -/// at the command boundary against the artifact store rather than from folded -/// state. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct EraseArtifact { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `artifact_id` - #[serde( - rename = "artifactId", - alias = "artifact_id", - with = "::buffa::json_helpers::proto_string" - )] - pub artifact_id: ::buffa::alloc::string::String, - /// Field 3: `reason` - #[serde(rename = "reason", skip_serializing_if = "::core::option::Option::is_none")] - pub reason: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for EraseArtifact { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("EraseArtifact") - .field("session_id", &self.session_id) - .field("artifact_id", &self.artifact_id) - .field("reason", &self.reason) - .finish() - } -} -impl EraseArtifact { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.EraseArtifact"; -} -impl EraseArtifact { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::reason`] to `Some(value)`, consuming and returning `self`. - pub fn with_reason( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.reason = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(EraseArtifact); -impl ::buffa::MessageName for EraseArtifact { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "EraseArtifact"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.EraseArtifact"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.EraseArtifact"; -} -impl ::buffa::Message for EraseArtifact { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.artifact_id) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.artifact_id, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.artifact_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.reason.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.artifact_id.clear(); - self.reason = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for EraseArtifact { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __ERASE_ARTIFACT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.EraseArtifact", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.events.__oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.events.__oneof.rs deleted file mode 100644 index bb7676496..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.events.__oneof.rs +++ /dev/null @@ -1,699 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/events.proto - -pub mod session_event { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, PartialEq, Debug)] - pub enum Event { - SessionStarted(::buffa::alloc::boxed::Box), - SessionClosed(::buffa::alloc::boxed::Box), - SessionCancelled( - ::buffa::alloc::boxed::Box, - ), - SessionFailed(::buffa::alloc::boxed::Box), - SessionHidden(::buffa::alloc::boxed::Box), - SessionForked(::buffa::alloc::boxed::Box), - SessionRewound(::buffa::alloc::boxed::Box), - SessionRecovered( - ::buffa::alloc::boxed::Box, - ), - Compacted(::buffa::alloc::boxed::Box), - UserMessageRecorded( - ::buffa::alloc::boxed::Box, - ), - AssistantMessageStarted( - ::buffa::alloc::boxed::Box, - ), - AssistantMessageCompleted( - ::buffa::alloc::boxed::Box, - ), - AssistantMessageFailed( - ::buffa::alloc::boxed::Box, - ), - ProviderToolIntentRejected( - ::buffa::alloc::boxed::Box, - ), - ToolCallRequested( - ::buffa::alloc::boxed::Box, - ), - ToolCallApproved( - ::buffa::alloc::boxed::Box, - ), - ToolCallDenied(::buffa::alloc::boxed::Box), - ToolCallStarted( - ::buffa::alloc::boxed::Box, - ), - ToolCallCompleted( - ::buffa::alloc::boxed::Box, - ), - ToolCallFailed(::buffa::alloc::boxed::Box), - ArtifactRecorded( - ::buffa::alloc::boxed::Box, - ), - FileChanged(::buffa::alloc::boxed::Box), - ExecutionAttemptStarted( - ::buffa::alloc::boxed::Box, - ), - ExecutionAttemptReady( - ::buffa::alloc::boxed::Box, - ), - ExecutionAttemptEnded( - ::buffa::alloc::boxed::Box, - ), - CheckpointProduced( - ::buffa::alloc::boxed::Box, - ), - DelegationDispatched( - ::buffa::alloc::boxed::Box, - ), - ParentLinked(::buffa::alloc::boxed::Box), - ParentTerminated( - ::buffa::alloc::boxed::Box, - ), - DelegationDetached( - ::buffa::alloc::boxed::Box, - ), - ParentHistoryInvalidated( - ::buffa::alloc::boxed::Box, - ), - ParentDetached(::buffa::alloc::boxed::Box), - ExternalDelegationDispatched( - ::buffa::alloc::boxed::Box, - ), - OperationReserved( - ::buffa::alloc::boxed::Box, - ), - OperationOutcomeRecorded( - ::buffa::alloc::boxed::Box, - ), - OperationCancellationRequested( - ::buffa::alloc::boxed::Box< - super::super::super::OperationCancellationRequested, - >, - ), - ArtifactErased(::buffa::alloc::boxed::Box), - RedactionApplied( - ::buffa::alloc::boxed::Box, - ), - SystemNoticeRecorded( - ::buffa::alloc::boxed::Box, - ), - TodoUpdated(::buffa::alloc::boxed::Box), - SessionRenamed(::buffa::alloc::boxed::Box), - SessionArchived( - ::buffa::alloc::boxed::Box, - ), - SessionUnarchived( - ::buffa::alloc::boxed::Box, - ), - } - impl ::buffa::Oneof for Event {} - impl From for Event { - fn from(v: super::super::super::SessionStarted) -> Self { - Self::SessionStarted(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::SessionStarted) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::SessionClosed) -> Self { - Self::SessionClosed(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::SessionClosed) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::SessionCancelled) -> Self { - Self::SessionCancelled(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::SessionCancelled) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::SessionFailed) -> Self { - Self::SessionFailed(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::SessionFailed) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::SessionHidden) -> Self { - Self::SessionHidden(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::SessionHidden) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::SessionForked) -> Self { - Self::SessionForked(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::SessionForked) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::SessionRewound) -> Self { - Self::SessionRewound(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::SessionRewound) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::SessionRecovered) -> Self { - Self::SessionRecovered(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::SessionRecovered) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::Compacted) -> Self { - Self::Compacted(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::Compacted) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::UserMessageRecorded) -> Self { - Self::UserMessageRecorded(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::UserMessageRecorded) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::AssistantMessageStarted) -> Self { - Self::AssistantMessageStarted(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::AssistantMessageStarted) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::AssistantMessageCompleted) -> Self { - Self::AssistantMessageCompleted(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::AssistantMessageCompleted) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::AssistantMessageFailed) -> Self { - Self::AssistantMessageFailed(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::AssistantMessageFailed) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ProviderToolIntentRejected) -> Self { - Self::ProviderToolIntentRejected(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::ProviderToolIntentRejected) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ToolCallRequested) -> Self { - Self::ToolCallRequested(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ToolCallRequested) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ToolCallApproved) -> Self { - Self::ToolCallApproved(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ToolCallApproved) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ToolCallDenied) -> Self { - Self::ToolCallDenied(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ToolCallDenied) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ToolCallStarted) -> Self { - Self::ToolCallStarted(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ToolCallStarted) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ToolCallCompleted) -> Self { - Self::ToolCallCompleted(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ToolCallCompleted) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ToolCallFailed) -> Self { - Self::ToolCallFailed(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ToolCallFailed) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ArtifactRecorded) -> Self { - Self::ArtifactRecorded(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ArtifactRecorded) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::FileChanged) -> Self { - Self::FileChanged(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::FileChanged) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ExecutionAttemptStarted) -> Self { - Self::ExecutionAttemptStarted(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::ExecutionAttemptStarted) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ExecutionAttemptReady) -> Self { - Self::ExecutionAttemptReady(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::ExecutionAttemptReady) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ExecutionAttemptEnded) -> Self { - Self::ExecutionAttemptEnded(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::ExecutionAttemptEnded) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::CheckpointProduced) -> Self { - Self::CheckpointProduced(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::CheckpointProduced) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::DelegationDispatched) -> Self { - Self::DelegationDispatched(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::DelegationDispatched) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ParentLinked) -> Self { - Self::ParentLinked(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ParentLinked) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ParentTerminated) -> Self { - Self::ParentTerminated(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ParentTerminated) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::DelegationDetached) -> Self { - Self::DelegationDetached(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::DelegationDetached) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ParentHistoryInvalidated) -> Self { - Self::ParentHistoryInvalidated(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::ParentHistoryInvalidated) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ParentDetached) -> Self { - Self::ParentDetached(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ParentDetached) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ExternalDelegationDispatched) -> Self { - Self::ExternalDelegationDispatched(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::ExternalDelegationDispatched) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::OperationReserved) -> Self { - Self::OperationReserved(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::OperationReserved) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::OperationOutcomeRecorded) -> Self { - Self::OperationOutcomeRecorded(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::OperationOutcomeRecorded) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::OperationCancellationRequested) -> Self { - Self::OperationCancellationRequested(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::OperationCancellationRequested) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::ArtifactErased) -> Self { - Self::ArtifactErased(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ArtifactErased) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::RedactionApplied) -> Self { - Self::RedactionApplied(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::RedactionApplied) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::SystemNoticeRecorded) -> Self { - Self::SystemNoticeRecorded(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::SystemNoticeRecorded) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::TodoUpdated) -> Self { - Self::TodoUpdated(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::TodoUpdated) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::SessionRenamed) -> Self { - Self::SessionRenamed(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::SessionRenamed) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::SessionArchived) -> Self { - Self::SessionArchived(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::SessionArchived) -> Self { - Self::Some(Event::from(v)) - } - } - impl From for Event { - fn from(v: super::super::super::SessionUnarchived) -> Self { - Self::SessionUnarchived(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::SessionUnarchived) -> Self { - Self::Some(Event::from(v)) - } - } - impl serde::Serialize for Event { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::SessionStarted(v) => { - map.serialize_entry("sessionStarted", v)?; - } - Self::SessionClosed(v) => { - map.serialize_entry("sessionClosed", v)?; - } - Self::SessionCancelled(v) => { - map.serialize_entry("sessionCancelled", v)?; - } - Self::SessionFailed(v) => { - map.serialize_entry("sessionFailed", v)?; - } - Self::SessionHidden(v) => { - map.serialize_entry("sessionHidden", v)?; - } - Self::SessionForked(v) => { - map.serialize_entry("sessionForked", v)?; - } - Self::SessionRewound(v) => { - map.serialize_entry("sessionRewound", v)?; - } - Self::SessionRecovered(v) => { - map.serialize_entry("sessionRecovered", v)?; - } - Self::Compacted(v) => { - map.serialize_entry("compacted", v)?; - } - Self::UserMessageRecorded(v) => { - map.serialize_entry("userMessageRecorded", v)?; - } - Self::AssistantMessageStarted(v) => { - map.serialize_entry("assistantMessageStarted", v)?; - } - Self::AssistantMessageCompleted(v) => { - map.serialize_entry("assistantMessageCompleted", v)?; - } - Self::AssistantMessageFailed(v) => { - map.serialize_entry("assistantMessageFailed", v)?; - } - Self::ProviderToolIntentRejected(v) => { - map.serialize_entry("providerToolIntentRejected", v)?; - } - Self::ToolCallRequested(v) => { - map.serialize_entry("toolCallRequested", v)?; - } - Self::ToolCallApproved(v) => { - map.serialize_entry("toolCallApproved", v)?; - } - Self::ToolCallDenied(v) => { - map.serialize_entry("toolCallDenied", v)?; - } - Self::ToolCallStarted(v) => { - map.serialize_entry("toolCallStarted", v)?; - } - Self::ToolCallCompleted(v) => { - map.serialize_entry("toolCallCompleted", v)?; - } - Self::ToolCallFailed(v) => { - map.serialize_entry("toolCallFailed", v)?; - } - Self::ArtifactRecorded(v) => { - map.serialize_entry("artifactRecorded", v)?; - } - Self::FileChanged(v) => { - map.serialize_entry("fileChanged", v)?; - } - Self::ExecutionAttemptStarted(v) => { - map.serialize_entry("executionAttemptStarted", v)?; - } - Self::ExecutionAttemptReady(v) => { - map.serialize_entry("executionAttemptReady", v)?; - } - Self::ExecutionAttemptEnded(v) => { - map.serialize_entry("executionAttemptEnded", v)?; - } - Self::CheckpointProduced(v) => { - map.serialize_entry("checkpointProduced", v)?; - } - Self::DelegationDispatched(v) => { - map.serialize_entry("delegationDispatched", v)?; - } - Self::ParentLinked(v) => { - map.serialize_entry("parentLinked", v)?; - } - Self::ParentTerminated(v) => { - map.serialize_entry("parentTerminated", v)?; - } - Self::DelegationDetached(v) => { - map.serialize_entry("delegationDetached", v)?; - } - Self::ParentHistoryInvalidated(v) => { - map.serialize_entry("parentHistoryInvalidated", v)?; - } - Self::ParentDetached(v) => { - map.serialize_entry("parentDetached", v)?; - } - Self::ExternalDelegationDispatched(v) => { - map.serialize_entry("externalDelegationDispatched", v)?; - } - Self::OperationReserved(v) => { - map.serialize_entry("operationReserved", v)?; - } - Self::OperationOutcomeRecorded(v) => { - map.serialize_entry("operationOutcomeRecorded", v)?; - } - Self::OperationCancellationRequested(v) => { - map.serialize_entry("operationCancellationRequested", v)?; - } - Self::ArtifactErased(v) => { - map.serialize_entry("artifactErased", v)?; - } - Self::RedactionApplied(v) => { - map.serialize_entry("redactionApplied", v)?; - } - Self::SystemNoticeRecorded(v) => { - map.serialize_entry("systemNoticeRecorded", v)?; - } - Self::TodoUpdated(v) => { - map.serialize_entry("todoUpdated", v)?; - } - Self::SessionRenamed(v) => { - map.serialize_entry("sessionRenamed", v)?; - } - Self::SessionArchived(v) => { - map.serialize_entry("sessionArchived", v)?; - } - Self::SessionUnarchived(v) => { - map.serialize_entry("sessionUnarchived", v)?; - } - } - map.end() - } - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.events.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.events.__view.rs deleted file mode 100644 index c422914cc..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.events.__view.rs +++ /dev/null @@ -1,3068 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/events.proto - -/// This package is v1alpha1: the contract depends on ADR#0026/0027/0028/0029 and -/// draft ADR#0031, and promotes to v1 only by a later decision once ADR#0035 and -/// its dependencies are accepted and the substrate obligations they impose are -/// met. A session is scoped by its subject alone; ADR#0027 settled that shared -/// multi-tenant deployment scopes that subject through the resolver rather than -/// through a tenant_id field on the event, so no such field is owed here (D0). -/// What a shared deployment still owes is snapshot-key scoping, which ADR#0027 -/// decision 3 leaves to the caller and which is not an event-contract concern. -/// -/// Within v1alpha1 a field may still be added as LEGACY_REQUIRED. That window is -/// open only while both conditions hold -- no deployed producer has written these -/// events, and this package has not promoted -- and it closes at whichever comes -/// first. The break a new required field causes is a current validator rejecting -/// already-stored bytes, so a producer shipping on v1alpha1 closes the window -/// early by creating those bytes, and promotion closes it regardless of producers -/// because promotion is the act of accepting the compatibility obligation. Once it -/// closes, a new required field needs a new package version. buf breaking under -/// WIRE_JSON does not catch this, because it compares fields present on both sides -/// and a field new to one side is not among them. -/// -/// SessionEvent is the session aggregate's event catalog: one oneof arm per -/// concrete event type. It is a convenience union for matching and codegen, not -/// the persisted form -- the store persists each concrete event's own bytes under -/// its stable type name and never the bytes of this wrapper (ADR#0031 §6). -#[derive(Clone, Debug, Default)] -pub struct SessionEventView<'a> { - pub event: ::core::option::Option< - super::super::__buffa::view::oneof::session_event::Event<'a>, - >, -} -impl<'a> ::buffa::MessageView<'a> for SessionEventView<'a> { - type Owned = super::super::SessionEvent; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::SessionStarted( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::SessionStarted( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::SessionClosed( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::SessionClosed( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::SessionCancelled( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::SessionCancelled( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::SessionFailed( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::SessionFailed( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::SessionHidden( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::SessionHidden( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::SessionForked( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::SessionForked( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::SessionRewound( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::SessionRewound( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 42u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::SessionRecovered( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::SessionRecovered( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::Compacted( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::Compacted( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::UserMessageRecorded( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::UserMessageRecorded( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageStarted( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageStarted( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageCompleted( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageCompleted( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 28u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageFailed( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageFailed( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 43u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ProviderToolIntentRejected( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ProviderToolIntentRejected( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ToolCallRequested( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ToolCallRequested( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ToolCallApproved( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ToolCallApproved( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 29u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ToolCallDenied( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ToolCallDenied( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 14u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ToolCallStarted( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ToolCallStarted( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 15u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ToolCallCompleted( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ToolCallCompleted( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 16u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ToolCallFailed( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ToolCallFailed( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 17u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ArtifactRecorded( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ArtifactRecorded( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 18u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::FileChanged( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::FileChanged( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 19u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptStarted( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptStarted( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 20u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptReady( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptReady( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 21u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptEnded( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptEnded( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 30u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::CheckpointProduced( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::CheckpointProduced( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 22u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::DelegationDispatched( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::DelegationDispatched( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 23u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ParentLinked( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ParentLinked( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 24u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ParentTerminated( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ParentTerminated( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 25u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::DelegationDetached( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::DelegationDetached( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 33u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ParentHistoryInvalidated( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ParentHistoryInvalidated( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 34u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ParentDetached( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ParentDetached( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 35u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ExternalDelegationDispatched( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ExternalDelegationDispatched( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 26u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::OperationReserved( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::OperationReserved( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 27u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::OperationOutcomeRecorded( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::OperationOutcomeRecorded( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 36u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::OperationCancellationRequested( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::OperationCancellationRequested( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 37u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::ArtifactErased( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::ArtifactErased( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 38u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::RedactionApplied( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::RedactionApplied( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 31u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::SystemNoticeRecorded( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::SystemNoticeRecorded( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 32u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::TodoUpdated( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::TodoUpdated( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 39u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::SessionRenamed( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::SessionRenamed( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 40u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::SessionArchived( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::SessionArchived( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 41u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::session_event::Event::SessionUnarchived( - ref mut existing, - ), - ) = view.event - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.event = Some( - super::super::__buffa::view::oneof::session_event::Event::SessionUnarchived( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionEvent { - event: match self.event.as_ref() { - ::core::option::Option::Some(v) => { - ::core::option::Option::Some( - match v { - super::super::__buffa::view::oneof::session_event::Event::SessionStarted( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::SessionStarted( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::SessionClosed( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::SessionClosed( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::SessionCancelled( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::SessionCancelled( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::SessionFailed( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::SessionFailed( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::SessionHidden( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::SessionHidden( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::SessionForked( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::SessionForked( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::SessionRewound( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::SessionRewound( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::SessionRecovered( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::SessionRecovered( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::Compacted( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::Compacted( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::UserMessageRecorded( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::UserMessageRecorded( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageStarted( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::AssistantMessageStarted( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageCompleted( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::AssistantMessageCompleted( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageFailed( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::AssistantMessageFailed( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ProviderToolIntentRejected( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ProviderToolIntentRejected( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallRequested( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ToolCallRequested( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallApproved( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ToolCallApproved( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallDenied( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ToolCallDenied( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallStarted( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ToolCallStarted( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallCompleted( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ToolCallCompleted( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallFailed( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ToolCallFailed( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ArtifactRecorded( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ArtifactRecorded( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::FileChanged( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::FileChanged( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptStarted( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ExecutionAttemptStarted( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptReady( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ExecutionAttemptReady( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptEnded( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ExecutionAttemptEnded( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::CheckpointProduced( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::CheckpointProduced( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::DelegationDispatched( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::DelegationDispatched( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ParentLinked( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ParentLinked( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ParentTerminated( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ParentTerminated( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::DelegationDetached( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::DelegationDetached( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ParentHistoryInvalidated( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ParentHistoryInvalidated( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ParentDetached( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ParentDetached( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ExternalDelegationDispatched( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ExternalDelegationDispatched( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::OperationReserved( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::OperationReserved( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::OperationOutcomeRecorded( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::OperationOutcomeRecorded( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::OperationCancellationRequested( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::OperationCancellationRequested( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::ArtifactErased( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::ArtifactErased( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::RedactionApplied( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::RedactionApplied( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::SystemNoticeRecorded( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::SystemNoticeRecorded( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::TodoUpdated( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::TodoUpdated( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::SessionRenamed( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::SessionRenamed( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::SessionArchived( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::SessionArchived( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::session_event::Event::SessionUnarchived( - v, - ) => { - super::super::__buffa::oneof::session_event::Event::SessionUnarchived( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - }, - ) - } - ::core::option::Option::None => ::core::option::Option::None, - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionEventView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let ::core::option::Option::Some(ref v) = self.event { - match v { - super::super::__buffa::view::oneof::session_event::Event::SessionStarted( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::SessionClosed( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::SessionCancelled( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::SessionFailed( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::SessionHidden( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::SessionForked( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::SessionRewound( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::SessionRecovered( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::Compacted( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::UserMessageRecorded( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageStarted( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageCompleted( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageFailed( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ProviderToolIntentRejected( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallRequested( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallApproved( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallDenied( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallStarted( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallCompleted( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallFailed( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ArtifactRecorded( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::FileChanged( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptStarted( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptReady( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptEnded( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::CheckpointProduced( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::DelegationDispatched( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ParentLinked( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ParentTerminated( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::DelegationDetached( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ParentHistoryInvalidated( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ParentDetached( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ExternalDelegationDispatched( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::OperationReserved( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::OperationOutcomeRecorded( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::OperationCancellationRequested( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::ArtifactErased( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::RedactionApplied( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::SystemNoticeRecorded( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::TodoUpdated( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::SessionRenamed( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::SessionArchived( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::session_event::Event::SessionUnarchived( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let ::core::option::Option::Some(ref v) = self.event { - match v { - super::super::__buffa::view::oneof::session_event::Event::SessionStarted( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::SessionClosed( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::SessionCancelled( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::SessionFailed( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::SessionHidden( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::SessionForked( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::SessionRewound( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::SessionRecovered( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 42u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::Compacted( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::UserMessageRecorded( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageStarted( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageCompleted( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageFailed( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 28u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ProviderToolIntentRejected( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 43u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallRequested( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallApproved( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 13u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallDenied( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 29u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallStarted( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 14u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallCompleted( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 15u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallFailed( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 16u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ArtifactRecorded( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 17u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::FileChanged( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 18u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptStarted( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 19u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptReady( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 20u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptEnded( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 21u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::CheckpointProduced( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 30u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::DelegationDispatched( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 22u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ParentLinked( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 23u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ParentTerminated( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 24u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::DelegationDetached( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 25u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ParentHistoryInvalidated( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 33u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ParentDetached( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 34u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ExternalDelegationDispatched( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 35u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::OperationReserved( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 26u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::OperationOutcomeRecorded( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 27u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::OperationCancellationRequested( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 36u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::ArtifactErased( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 37u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::RedactionApplied( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 38u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::SystemNoticeRecorded( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 31u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::TodoUpdated( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 32u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::SessionRenamed( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 39u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::SessionArchived( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 40u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::session_event::Event::SessionUnarchived( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 41u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionEventView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - if let ::core::option::Option::Some(ref __ov) = self.event { - match __ov { - super::super::__buffa::view::oneof::session_event::Event::SessionStarted( - v, - ) => { - __map.serialize_entry("sessionStarted", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::SessionClosed( - v, - ) => { - __map.serialize_entry("sessionClosed", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::SessionCancelled( - v, - ) => { - __map.serialize_entry("sessionCancelled", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::SessionFailed( - v, - ) => { - __map.serialize_entry("sessionFailed", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::SessionHidden( - v, - ) => { - __map.serialize_entry("sessionHidden", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::SessionForked( - v, - ) => { - __map.serialize_entry("sessionForked", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::SessionRewound( - v, - ) => { - __map.serialize_entry("sessionRewound", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::SessionRecovered( - v, - ) => { - __map.serialize_entry("sessionRecovered", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::Compacted( - v, - ) => { - __map.serialize_entry("compacted", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::UserMessageRecorded( - v, - ) => { - __map.serialize_entry("userMessageRecorded", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageStarted( - v, - ) => { - __map.serialize_entry("assistantMessageStarted", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageCompleted( - v, - ) => { - __map.serialize_entry("assistantMessageCompleted", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::AssistantMessageFailed( - v, - ) => { - __map.serialize_entry("assistantMessageFailed", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ProviderToolIntentRejected( - v, - ) => { - __map.serialize_entry("providerToolIntentRejected", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallRequested( - v, - ) => { - __map.serialize_entry("toolCallRequested", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallApproved( - v, - ) => { - __map.serialize_entry("toolCallApproved", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallDenied( - v, - ) => { - __map.serialize_entry("toolCallDenied", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallStarted( - v, - ) => { - __map.serialize_entry("toolCallStarted", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallCompleted( - v, - ) => { - __map.serialize_entry("toolCallCompleted", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ToolCallFailed( - v, - ) => { - __map.serialize_entry("toolCallFailed", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ArtifactRecorded( - v, - ) => { - __map.serialize_entry("artifactRecorded", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::FileChanged( - v, - ) => { - __map.serialize_entry("fileChanged", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptStarted( - v, - ) => { - __map.serialize_entry("executionAttemptStarted", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptReady( - v, - ) => { - __map.serialize_entry("executionAttemptReady", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ExecutionAttemptEnded( - v, - ) => { - __map.serialize_entry("executionAttemptEnded", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::CheckpointProduced( - v, - ) => { - __map.serialize_entry("checkpointProduced", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::DelegationDispatched( - v, - ) => { - __map.serialize_entry("delegationDispatched", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ParentLinked( - v, - ) => { - __map.serialize_entry("parentLinked", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ParentTerminated( - v, - ) => { - __map.serialize_entry("parentTerminated", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::DelegationDetached( - v, - ) => { - __map.serialize_entry("delegationDetached", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ParentHistoryInvalidated( - v, - ) => { - __map.serialize_entry("parentHistoryInvalidated", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ParentDetached( - v, - ) => { - __map.serialize_entry("parentDetached", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ExternalDelegationDispatched( - v, - ) => { - __map.serialize_entry("externalDelegationDispatched", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::OperationReserved( - v, - ) => { - __map.serialize_entry("operationReserved", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::OperationOutcomeRecorded( - v, - ) => { - __map.serialize_entry("operationOutcomeRecorded", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::OperationCancellationRequested( - v, - ) => { - __map.serialize_entry("operationCancellationRequested", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::ArtifactErased( - v, - ) => { - __map.serialize_entry("artifactErased", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::RedactionApplied( - v, - ) => { - __map.serialize_entry("redactionApplied", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::SystemNoticeRecorded( - v, - ) => { - __map.serialize_entry("systemNoticeRecorded", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::TodoUpdated( - v, - ) => { - __map.serialize_entry("todoUpdated", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::SessionRenamed( - v, - ) => { - __map.serialize_entry("sessionRenamed", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::SessionArchived( - v, - ) => { - __map.serialize_entry("sessionArchived", v)?; - } - super::super::__buffa::view::oneof::session_event::Event::SessionUnarchived( - v, - ) => { - __map.serialize_entry("sessionUnarchived", v)?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionEventView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionEvent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionEvent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionEvent"; -} -::buffa::impl_default_view_instance!(SessionEventView); -::buffa::impl_view_reborrow!(SessionEventView); -/** Self-contained, `'static` owned view of a `SessionEvent` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionEventView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionEventView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionEventOwnedView(::buffa::OwnedView>); -impl SessionEventOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionEventOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionEventOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionEvent, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionEventOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionEventView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionEventView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionEvent { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Oneof `event`. - #[must_use] - pub fn event( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::session_event::Event<'_>, - > { - self.0.reborrow().event.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionEventOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionEventOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionEventOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionEventOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionEvent { - type View<'a> = SessionEventView<'a>; - type ViewHandle = SessionEventOwnedView; -} -impl ::serde::Serialize for SessionEventOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.events.__view_oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.events.__view_oneof.rs deleted file mode 100644 index 678ec92ad..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.events.__view_oneof.rs +++ /dev/null @@ -1,241 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/events.proto - -pub mod session_event { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Event<'a> { - SessionStarted( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SessionStartedView<'a>, - >, - ), - SessionClosed( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SessionClosedView<'a>, - >, - ), - SessionCancelled( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SessionCancelledView<'a>, - >, - ), - SessionFailed( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SessionFailedView<'a>, - >, - ), - SessionHidden( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SessionHiddenView<'a>, - >, - ), - SessionForked( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SessionForkedView<'a>, - >, - ), - SessionRewound( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SessionRewoundView<'a>, - >, - ), - SessionRecovered( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SessionRecoveredView<'a>, - >, - ), - Compacted( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::CompactedView<'a>, - >, - ), - UserMessageRecorded( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::UserMessageRecordedView<'a>, - >, - ), - AssistantMessageStarted( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::AssistantMessageStartedView< - 'a, - >, - >, - ), - AssistantMessageCompleted( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::AssistantMessageCompletedView< - 'a, - >, - >, - ), - AssistantMessageFailed( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::AssistantMessageFailedView<'a>, - >, - ), - ProviderToolIntentRejected( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ProviderToolIntentRejectedView< - 'a, - >, - >, - ), - ToolCallRequested( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ToolCallRequestedView<'a>, - >, - ), - ToolCallApproved( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ToolCallApprovedView<'a>, - >, - ), - ToolCallDenied( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ToolCallDeniedView<'a>, - >, - ), - ToolCallStarted( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ToolCallStartedView<'a>, - >, - ), - ToolCallCompleted( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ToolCallCompletedView<'a>, - >, - ), - ToolCallFailed( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ToolCallFailedView<'a>, - >, - ), - ArtifactRecorded( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ArtifactRecordedView<'a>, - >, - ), - FileChanged( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::FileChangedView<'a>, - >, - ), - ExecutionAttemptStarted( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ExecutionAttemptStartedView< - 'a, - >, - >, - ), - ExecutionAttemptReady( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ExecutionAttemptReadyView<'a>, - >, - ), - ExecutionAttemptEnded( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ExecutionAttemptEndedView<'a>, - >, - ), - CheckpointProduced( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::CheckpointProducedView<'a>, - >, - ), - DelegationDispatched( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::DelegationDispatchedView<'a>, - >, - ), - ParentLinked( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ParentLinkedView<'a>, - >, - ), - ParentTerminated( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ParentTerminatedView<'a>, - >, - ), - DelegationDetached( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::DelegationDetachedView<'a>, - >, - ), - ParentHistoryInvalidated( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ParentHistoryInvalidatedView< - 'a, - >, - >, - ), - ParentDetached( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ParentDetachedView<'a>, - >, - ), - ExternalDelegationDispatched( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ExternalDelegationDispatchedView< - 'a, - >, - >, - ), - OperationReserved( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::OperationReservedView<'a>, - >, - ), - OperationOutcomeRecorded( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::OperationOutcomeRecordedView< - 'a, - >, - >, - ), - OperationCancellationRequested( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::OperationCancellationRequestedView< - 'a, - >, - >, - ), - ArtifactErased( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ArtifactErasedView<'a>, - >, - ), - RedactionApplied( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::RedactionAppliedView<'a>, - >, - ), - SystemNoticeRecorded( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SystemNoticeRecordedView<'a>, - >, - ), - TodoUpdated( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::TodoUpdatedView<'a>, - >, - ), - SessionRenamed( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SessionRenamedView<'a>, - >, - ), - SessionArchived( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SessionArchivedView<'a>, - >, - ), - SessionUnarchived( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::SessionUnarchivedView<'a>, - >, - ), - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.events.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.events.rs deleted file mode 100644 index 5330029e8..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.events.rs +++ /dev/null @@ -1,2831 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/events.proto - -/// This package is v1alpha1: the contract depends on ADR#0026/0027/0028/0029 and -/// draft ADR#0031, and promotes to v1 only by a later decision once ADR#0035 and -/// its dependencies are accepted and the substrate obligations they impose are -/// met. A session is scoped by its subject alone; ADR#0027 settled that shared -/// multi-tenant deployment scopes that subject through the resolver rather than -/// through a tenant_id field on the event, so no such field is owed here (D0). -/// What a shared deployment still owes is snapshot-key scoping, which ADR#0027 -/// decision 3 leaves to the caller and which is not an event-contract concern. -/// -/// Within v1alpha1 a field may still be added as LEGACY_REQUIRED. That window is -/// open only while both conditions hold -- no deployed producer has written these -/// events, and this package has not promoted -- and it closes at whichever comes -/// first. The break a new required field causes is a current validator rejecting -/// already-stored bytes, so a producer shipping on v1alpha1 closes the window -/// early by creating those bytes, and promotion closes it regardless of producers -/// because promotion is the act of accepting the compatibility obligation. Once it -/// closes, a new required field needs a new package version. buf breaking under -/// WIRE_JSON does not catch this, because it compares fields present on both sides -/// and a field new to one side is not among them. -/// -/// SessionEvent is the session aggregate's event catalog: one oneof arm per -/// concrete event type. It is a convenience union for matching and codegen, not -/// the persisted form -- the store persists each concrete event's own bytes under -/// its stable type name and never the bytes of this wrapper (ADR#0031 §6). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct SessionEvent { - #[serde(flatten)] - pub event: ::core::option::Option<__buffa::oneof::session_event::Event>, -} -impl ::core::fmt::Debug for SessionEvent { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionEvent").field("event", &self.event).finish() - } -} -impl SessionEvent { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionEvent"; -} -::buffa::impl_default_instance!(SessionEvent); -impl ::buffa::MessageName for SessionEvent { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionEvent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionEvent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionEvent"; -} -impl ::buffa::Message for SessionEvent { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let ::core::option::Option::Some(ref v) = self.event { - match v { - __buffa::oneof::session_event::Event::SessionStarted(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::SessionClosed(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::SessionCancelled(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::SessionFailed(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::SessionHidden(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::SessionForked(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::SessionRewound(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::SessionRecovered(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::Compacted(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::UserMessageRecorded(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::AssistantMessageStarted(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::AssistantMessageCompleted(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::AssistantMessageFailed(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ProviderToolIntentRejected(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ToolCallRequested(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ToolCallApproved(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ToolCallDenied(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ToolCallStarted(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ToolCallCompleted(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ToolCallFailed(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ArtifactRecorded(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::FileChanged(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ExecutionAttemptStarted(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ExecutionAttemptReady(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ExecutionAttemptEnded(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::CheckpointProduced(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::DelegationDispatched(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ParentLinked(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ParentTerminated(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::DelegationDetached(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ParentHistoryInvalidated(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ParentDetached(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ExternalDelegationDispatched( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::OperationReserved(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::OperationOutcomeRecorded(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::OperationCancellationRequested( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::ArtifactErased(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::RedactionApplied(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::SystemNoticeRecorded(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::TodoUpdated(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::SessionRenamed(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::SessionArchived(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::session_event::Event::SessionUnarchived(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let ::core::option::Option::Some(ref v) = self.event { - match v { - __buffa::oneof::session_event::Event::SessionStarted(x) => { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::SessionClosed(x) => { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::SessionCancelled(x) => { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::SessionFailed(x) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::SessionHidden(x) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::SessionForked(x) => { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::SessionRewound(x) => { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::SessionRecovered(x) => { - ::buffa::types::put_len_delimited_header( - 42u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::Compacted(x) => { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::UserMessageRecorded(x) => { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::AssistantMessageStarted(x) => { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::AssistantMessageCompleted(x) => { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::AssistantMessageFailed(x) => { - ::buffa::types::put_len_delimited_header( - 28u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ProviderToolIntentRejected(x) => { - ::buffa::types::put_len_delimited_header( - 43u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ToolCallRequested(x) => { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ToolCallApproved(x) => { - ::buffa::types::put_len_delimited_header( - 13u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ToolCallDenied(x) => { - ::buffa::types::put_len_delimited_header( - 29u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ToolCallStarted(x) => { - ::buffa::types::put_len_delimited_header( - 14u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ToolCallCompleted(x) => { - ::buffa::types::put_len_delimited_header( - 15u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ToolCallFailed(x) => { - ::buffa::types::put_len_delimited_header( - 16u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ArtifactRecorded(x) => { - ::buffa::types::put_len_delimited_header( - 17u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::FileChanged(x) => { - ::buffa::types::put_len_delimited_header( - 18u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ExecutionAttemptStarted(x) => { - ::buffa::types::put_len_delimited_header( - 19u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ExecutionAttemptReady(x) => { - ::buffa::types::put_len_delimited_header( - 20u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ExecutionAttemptEnded(x) => { - ::buffa::types::put_len_delimited_header( - 21u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::CheckpointProduced(x) => { - ::buffa::types::put_len_delimited_header( - 30u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::DelegationDispatched(x) => { - ::buffa::types::put_len_delimited_header( - 22u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ParentLinked(x) => { - ::buffa::types::put_len_delimited_header( - 23u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ParentTerminated(x) => { - ::buffa::types::put_len_delimited_header( - 24u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::DelegationDetached(x) => { - ::buffa::types::put_len_delimited_header( - 25u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ParentHistoryInvalidated(x) => { - ::buffa::types::put_len_delimited_header( - 33u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ParentDetached(x) => { - ::buffa::types::put_len_delimited_header( - 34u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ExternalDelegationDispatched( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 35u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::OperationReserved(x) => { - ::buffa::types::put_len_delimited_header( - 26u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::OperationOutcomeRecorded(x) => { - ::buffa::types::put_len_delimited_header( - 27u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::OperationCancellationRequested( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 36u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::ArtifactErased(x) => { - ::buffa::types::put_len_delimited_header( - 37u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::RedactionApplied(x) => { - ::buffa::types::put_len_delimited_header( - 38u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::SystemNoticeRecorded(x) => { - ::buffa::types::put_len_delimited_header( - 31u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::TodoUpdated(x) => { - ::buffa::types::put_len_delimited_header( - 32u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::SessionRenamed(x) => { - ::buffa::types::put_len_delimited_header( - 39u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::SessionArchived(x) => { - ::buffa::types::put_len_delimited_header( - 40u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::session_event::Event::SessionUnarchived(x) => { - ::buffa::types::put_len_delimited_header( - 41u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionStarted( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionStarted( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionClosed(ref mut existing), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionClosed( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionCancelled( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionCancelled( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionFailed(ref mut existing), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionFailed( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionHidden(ref mut existing), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionHidden( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionForked(ref mut existing), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionForked( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionRewound( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionRewound( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 42u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionRecovered( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionRecovered( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::Compacted(ref mut existing), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::Compacted( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::UserMessageRecorded( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::UserMessageRecorded( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::AssistantMessageStarted( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::AssistantMessageStarted( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::AssistantMessageCompleted( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::AssistantMessageCompleted( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 28u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::AssistantMessageFailed( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::AssistantMessageFailed( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 43u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ProviderToolIntentRejected( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ProviderToolIntentRejected( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ToolCallRequested( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ToolCallRequested( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ToolCallApproved( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ToolCallApproved( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 29u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ToolCallDenied( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ToolCallDenied( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 14u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ToolCallStarted( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ToolCallStarted( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 15u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ToolCallCompleted( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ToolCallCompleted( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 16u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ToolCallFailed( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ToolCallFailed( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 17u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ArtifactRecorded( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ArtifactRecorded( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 18u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::FileChanged(ref mut existing), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::FileChanged( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 19u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ExecutionAttemptStarted( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ExecutionAttemptStarted( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 20u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ExecutionAttemptReady( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ExecutionAttemptReady( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 21u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ExecutionAttemptEnded( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ExecutionAttemptEnded( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 30u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::CheckpointProduced( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::CheckpointProduced( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 22u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::DelegationDispatched( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::DelegationDispatched( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 23u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ParentLinked(ref mut existing), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ParentLinked( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 24u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ParentTerminated( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ParentTerminated( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 25u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::DelegationDetached( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::DelegationDetached( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 33u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ParentHistoryInvalidated( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ParentHistoryInvalidated( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 34u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ParentDetached( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ParentDetached( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 35u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ExternalDelegationDispatched( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ExternalDelegationDispatched( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 26u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::OperationReserved( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::OperationReserved( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 27u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::OperationOutcomeRecorded( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::OperationOutcomeRecorded( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 36u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::OperationCancellationRequested( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::OperationCancellationRequested( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 37u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ArtifactErased( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::ArtifactErased( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 38u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::RedactionApplied( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::RedactionApplied( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 31u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SystemNoticeRecorded( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SystemNoticeRecorded( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 32u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::TodoUpdated(ref mut existing), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::TodoUpdated( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 39u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionRenamed( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionRenamed( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 40u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionArchived( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionArchived( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 41u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionUnarchived( - ref mut existing, - ), - ) = self.event - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.event = ::core::option::Option::Some( - __buffa::oneof::session_event::Event::SessionUnarchived( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.event = ::core::option::Option::None; - } -} -impl<'de> serde::Deserialize<'de> for SessionEvent { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = SessionEvent; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct SessionEvent") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __oneof_event: ::core::option::Option< - __buffa::oneof::session_event::Event, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "sessionStarted" | "session_started" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SessionStarted, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::SessionStarted( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "sessionClosed" | "session_closed" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SessionClosed, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::SessionClosed( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "sessionCancelled" | "session_cancelled" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SessionCancelled, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::SessionCancelled( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "sessionFailed" | "session_failed" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SessionFailed, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::SessionFailed( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "sessionHidden" | "session_hidden" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SessionHidden, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::SessionHidden( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "sessionForked" | "session_forked" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SessionForked, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::SessionForked( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "sessionRewound" | "session_rewound" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SessionRewound, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::SessionRewound( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "sessionRecovered" | "session_recovered" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SessionRecovered, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::SessionRecovered( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "compacted" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - Compacted, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::Compacted( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "userMessageRecorded" | "user_message_recorded" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - UserMessageRecorded, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::UserMessageRecorded( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "assistantMessageStarted" | "assistant_message_started" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - AssistantMessageStarted, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::AssistantMessageStarted( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "assistantMessageCompleted" | "assistant_message_completed" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - AssistantMessageCompleted, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::AssistantMessageCompleted( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "assistantMessageFailed" | "assistant_message_failed" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - AssistantMessageFailed, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::AssistantMessageFailed( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "providerToolIntentRejected" - | "provider_tool_intent_rejected" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ProviderToolIntentRejected, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ProviderToolIntentRejected( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "toolCallRequested" | "tool_call_requested" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ToolCallRequested, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ToolCallRequested( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "toolCallApproved" | "tool_call_approved" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ToolCallApproved, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ToolCallApproved( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "toolCallDenied" | "tool_call_denied" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ToolCallDenied, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ToolCallDenied( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "toolCallStarted" | "tool_call_started" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ToolCallStarted, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ToolCallStarted( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "toolCallCompleted" | "tool_call_completed" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ToolCallCompleted, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ToolCallCompleted( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "toolCallFailed" | "tool_call_failed" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ToolCallFailed, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ToolCallFailed( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "artifactRecorded" | "artifact_recorded" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ArtifactRecorded, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ArtifactRecorded( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "fileChanged" | "file_changed" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - FileChanged, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::FileChanged( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "executionAttemptStarted" | "execution_attempt_started" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ExecutionAttemptStarted, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ExecutionAttemptStarted( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "executionAttemptReady" | "execution_attempt_ready" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ExecutionAttemptReady, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ExecutionAttemptReady( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "executionAttemptEnded" | "execution_attempt_ended" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ExecutionAttemptEnded, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ExecutionAttemptEnded( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "checkpointProduced" | "checkpoint_produced" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - CheckpointProduced, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::CheckpointProduced( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "delegationDispatched" | "delegation_dispatched" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - DelegationDispatched, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::DelegationDispatched( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "parentLinked" | "parent_linked" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ParentLinked, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ParentLinked( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "parentTerminated" | "parent_terminated" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ParentTerminated, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ParentTerminated( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "delegationDetached" | "delegation_detached" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - DelegationDetached, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::DelegationDetached( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "parentHistoryInvalidated" | "parent_history_invalidated" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ParentHistoryInvalidated, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ParentHistoryInvalidated( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "parentDetached" | "parent_detached" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ParentDetached, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ParentDetached( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "externalDelegationDispatched" - | "external_delegation_dispatched" => { - let v: ::core::option::Option< - ExternalDelegationDispatched, - > = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ExternalDelegationDispatched, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ExternalDelegationDispatched( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "operationReserved" | "operation_reserved" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - OperationReserved, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::OperationReserved( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "operationOutcomeRecorded" | "operation_outcome_recorded" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - OperationOutcomeRecorded, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::OperationOutcomeRecorded( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "operationCancellationRequested" - | "operation_cancellation_requested" => { - let v: ::core::option::Option< - OperationCancellationRequested, - > = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - OperationCancellationRequested, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::OperationCancellationRequested( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "artifactErased" | "artifact_erased" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ArtifactErased, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::ArtifactErased( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "redactionApplied" | "redaction_applied" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - RedactionApplied, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::RedactionApplied( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "systemNoticeRecorded" | "system_notice_recorded" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SystemNoticeRecorded, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::SystemNoticeRecorded( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "todoUpdated" | "todo_updated" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - TodoUpdated, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::TodoUpdated( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "sessionRenamed" | "session_renamed" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SessionRenamed, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::SessionRenamed( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "sessionArchived" | "session_archived" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SessionArchived, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::SessionArchived( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "sessionUnarchived" | "session_unarchived" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - SessionUnarchived, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_event.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'event'", - ), - ); - } - __oneof_event = Some( - __buffa::oneof::session_event::Event::SessionUnarchived( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - __r.event = __oneof_event; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionEvent { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_EVENT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionEvent", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod session_event { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::session_event::Event; - #[doc(inline)] - pub use super::__buffa::view::oneof::session_event::Event as EventView; -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_ended.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_ended.__view.rs deleted file mode 100644 index b911635a0..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_ended.__view.rs +++ /dev/null @@ -1,438 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/execution_attempt_ended.proto - -/// ExecutionAttemptEnded is a per-attempt outcome fact; ending an attempt is -/// not itself a session terminal marker (ADR#0031 §4, ADR#0035 facet 6). It -/// advances the same attempt counter's one-active-attempt invariant, so it is -/// invariant-bearing (WRITE_PRECONDITION = At), not a commuting happened-fact. -#[derive(Clone, Debug, Default)] -pub struct ExecutionAttemptEndedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `execution_attempt_id` - pub execution_attempt_id: &'a str, - /// Field 3: `outcome` - pub outcome: ::buffa::EnumValue, - /// Human-readable explanation of the outcome; empty when none. This is a - /// failure-only event (no success outcome exists), so an audit fold needs it to - /// explain, not just classify, why the attempt ended. - /// - /// Field 4: `detail` - pub detail: ::core::option::Option<&'a str>, - /// Wall-clock instant the attempt actually ended: a real external occurrence - /// distinct from envelope append time (D10). - /// - /// Field 5: `ended_at` - pub ended_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ExecutionAttemptEndedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `execution_attempt_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_execution_attempt_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `outcome` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_outcome(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `ended_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ended_at(&self) -> bool { - self.ended_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ExecutionAttemptEndedView<'a> { - type Owned = super::super::ExecutionAttemptEnded; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.execution_attempt_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.outcome = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.ended_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.ended_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ExecutionAttemptEnded, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ExecutionAttemptEnded, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ExecutionAttemptEnded { - session_id: self.session_id.to_string(), - execution_attempt_id: self.execution_attempt_id.to_string(), - outcome: self.outcome, - detail: self.detail.map(|s| s.to_string()), - ended_at: match self.ended_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ExecutionAttemptEndedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - { - let val = self.outcome.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.ended_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ended_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.execution_attempt_id, buf); - ::buffa::types::put_int32_field(3u32, self.outcome.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.ended_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ended_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ExecutionAttemptEndedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("executionAttemptId", self.execution_attempt_id)?; - } - { - __map.serialize_entry("outcome", &self.outcome)?; - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.ended_at.as_option() { - __map.serialize_entry("endedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ExecutionAttemptEndedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ExecutionAttemptEnded"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ExecutionAttemptEnded"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExecutionAttemptEnded"; -} -::buffa::impl_default_view_instance!(ExecutionAttemptEndedView); -::buffa::impl_view_reborrow!(ExecutionAttemptEndedView); -/** Self-contained, `'static` owned view of a `ExecutionAttemptEnded` message. - - Wraps [`::buffa::OwnedView`]`<`[`ExecutionAttemptEndedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ExecutionAttemptEndedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ExecutionAttemptEndedOwnedView( - ::buffa::OwnedView>, -); -impl ExecutionAttemptEndedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExecutionAttemptEndedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExecutionAttemptEndedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ExecutionAttemptEnded, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExecutionAttemptEndedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ExecutionAttemptEndedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ExecutionAttemptEndedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ExecutionAttemptEnded { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `execution_attempt_id` - #[must_use] - pub fn execution_attempt_id(&self) -> &'_ str { - self.0.reborrow().execution_attempt_id - } - /// Field 3: `outcome` - #[must_use] - pub fn outcome(&self) -> ::buffa::EnumValue { - self.0.reborrow().outcome - } - /// Human-readable explanation of the outcome; empty when none. This is a - /// failure-only event (no success outcome exists), so an audit fold needs it to - /// explain, not just classify, why the attempt ended. - /// - /// Field 4: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } - /// Wall-clock instant the attempt actually ended: a real external occurrence - /// distinct from envelope append time (D10). - /// - /// Field 5: `ended_at` - #[must_use] - pub fn ended_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().ended_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ExecutionAttemptEndedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ExecutionAttemptEndedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ExecutionAttemptEndedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ExecutionAttemptEndedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ExecutionAttemptEnded { - type View<'a> = ExecutionAttemptEndedView<'a>; - type ViewHandle = ExecutionAttemptEndedOwnedView; -} -impl ::serde::Serialize for ExecutionAttemptEndedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_ended.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_ended.rs deleted file mode 100644 index abb8fead8..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_ended.rs +++ /dev/null @@ -1,390 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/execution_attempt_ended.proto - -/// AttemptOutcome is how an execution attempt ended. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum AttemptOutcome { - ATTEMPT_OUTCOME_UNSPECIFIED = 0i32, - ATTEMPT_OUTCOME_FAILED = 1i32, - ATTEMPT_OUTCOME_CANCELLED = 2i32, - ATTEMPT_OUTCOME_TERMINATED = 3i32, -} -impl AttemptOutcome { - ///Idiomatic alias for [`Self::ATTEMPT_OUTCOME_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::ATTEMPT_OUTCOME_UNSPECIFIED; - ///Idiomatic alias for [`Self::ATTEMPT_OUTCOME_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Failed: Self = Self::ATTEMPT_OUTCOME_FAILED; - ///Idiomatic alias for [`Self::ATTEMPT_OUTCOME_CANCELLED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Cancelled: Self = Self::ATTEMPT_OUTCOME_CANCELLED; - ///Idiomatic alias for [`Self::ATTEMPT_OUTCOME_TERMINATED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Terminated: Self = Self::ATTEMPT_OUTCOME_TERMINATED; -} -impl ::core::default::Default for AttemptOutcome { - fn default() -> Self { - Self::ATTEMPT_OUTCOME_UNSPECIFIED - } -} -impl ::serde::Serialize for AttemptOutcome { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for AttemptOutcome { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = AttemptOutcome; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(AttemptOutcome) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for AttemptOutcome { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for AttemptOutcome { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::ATTEMPT_OUTCOME_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::ATTEMPT_OUTCOME_FAILED), - 2i32 => ::core::option::Option::Some(Self::ATTEMPT_OUTCOME_CANCELLED), - 3i32 => ::core::option::Option::Some(Self::ATTEMPT_OUTCOME_TERMINATED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::ATTEMPT_OUTCOME_UNSPECIFIED => "ATTEMPT_OUTCOME_UNSPECIFIED", - Self::ATTEMPT_OUTCOME_FAILED => "ATTEMPT_OUTCOME_FAILED", - Self::ATTEMPT_OUTCOME_CANCELLED => "ATTEMPT_OUTCOME_CANCELLED", - Self::ATTEMPT_OUTCOME_TERMINATED => "ATTEMPT_OUTCOME_TERMINATED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "ATTEMPT_OUTCOME_UNSPECIFIED" => { - ::core::option::Option::Some(Self::ATTEMPT_OUTCOME_UNSPECIFIED) - } - "ATTEMPT_OUTCOME_FAILED" => { - ::core::option::Option::Some(Self::ATTEMPT_OUTCOME_FAILED) - } - "ATTEMPT_OUTCOME_CANCELLED" => { - ::core::option::Option::Some(Self::ATTEMPT_OUTCOME_CANCELLED) - } - "ATTEMPT_OUTCOME_TERMINATED" => { - ::core::option::Option::Some(Self::ATTEMPT_OUTCOME_TERMINATED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::ATTEMPT_OUTCOME_UNSPECIFIED, - Self::ATTEMPT_OUTCOME_FAILED, - Self::ATTEMPT_OUTCOME_CANCELLED, - Self::ATTEMPT_OUTCOME_TERMINATED, - ] - } -} -/// ExecutionAttemptEnded is a per-attempt outcome fact; ending an attempt is -/// not itself a session terminal marker (ADR#0031 §4, ADR#0035 facet 6). It -/// advances the same attempt counter's one-active-attempt invariant, so it is -/// invariant-bearing (WRITE_PRECONDITION = At), not a commuting happened-fact. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ExecutionAttemptEnded { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `execution_attempt_id` - #[serde( - rename = "executionAttemptId", - alias = "execution_attempt_id", - with = "::buffa::json_helpers::proto_string" - )] - pub execution_attempt_id: ::buffa::alloc::string::String, - /// Field 3: `outcome` - #[serde(rename = "outcome", with = "::buffa::json_helpers::proto_enum")] - pub outcome: ::buffa::EnumValue, - /// Human-readable explanation of the outcome; empty when none. This is a - /// failure-only event (no success outcome exists), so an audit fold needs it to - /// explain, not just classify, why the attempt ended. - /// - /// Field 4: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, - /// Wall-clock instant the attempt actually ended: a real external occurrence - /// distinct from envelope append time (D10). - /// - /// Field 5: `ended_at` - #[serde(rename = "endedAt", alias = "ended_at")] - pub ended_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for ExecutionAttemptEnded { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ExecutionAttemptEnded") - .field("session_id", &self.session_id) - .field("execution_attempt_id", &self.execution_attempt_id) - .field("outcome", &self.outcome) - .field("detail", &self.detail) - .field("ended_at", &self.ended_at) - .finish() - } -} -impl ExecutionAttemptEnded { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExecutionAttemptEnded"; -} -impl ExecutionAttemptEnded { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ExecutionAttemptEnded); -impl ::buffa::MessageName for ExecutionAttemptEnded { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ExecutionAttemptEnded"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ExecutionAttemptEnded"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExecutionAttemptEnded"; -} -impl ::buffa::Message for ExecutionAttemptEnded { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - { - let val = self.outcome.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.ended_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ended_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.execution_attempt_id, buf); - ::buffa::types::put_int32_field(3u32, self.outcome.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.ended_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ended_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.execution_attempt_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.outcome = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.ended_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.execution_attempt_id.clear(); - self.outcome = ::buffa::EnumValue::from(0); - self.detail = ::core::option::Option::None; - self.ended_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ExecutionAttemptEnded { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __EXECUTION_ATTEMPT_ENDED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExecutionAttemptEnded", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_ready.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_ready.__view.rs deleted file mode 100644 index c1c93d41a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_ready.__view.rs +++ /dev/null @@ -1,476 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/execution_attempt_ready.proto - -/// ExecutionAttemptReady is admission proof that the attempt's implementation -/// and effective configuration are running (ADR#0031 §4). It advances the -/// same attempt's Ready-after-Started invariant, so it is invariant-bearing -/// (WRITE_PRECONDITION = At), not a commuting happened-fact. -#[derive(Clone, Debug, Default)] -pub struct ExecutionAttemptReadyView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `execution_attempt_id` - pub execution_attempt_id: &'a str, - /// Field 3: `ready_attestation_ref` - pub ready_attestation_ref: &'a str, - /// Field 4: `ready_attestation_digest` - pub ready_attestation_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Wall-clock instant the attempt actually became ready: a real external - /// occurrence distinct from envelope append time (D10). - /// - /// Field 5: `ready_at` - pub ready_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ExecutionAttemptReadyView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `execution_attempt_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_execution_attempt_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `ready_attestation_ref` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ready_attestation_ref(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `ready_attestation_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ready_attestation_digest(&self) -> bool { - self.ready_attestation_digest.is_set() - } - /**Whether required field `ready_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ready_at(&self) -> bool { - self.ready_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ExecutionAttemptReadyView<'a> { - type Owned = super::super::ExecutionAttemptReady; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.execution_attempt_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.ready_attestation_ref = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.ready_attestation_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.ready_attestation_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.ready_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.ready_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ExecutionAttemptReady, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ExecutionAttemptReady, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ExecutionAttemptReady { - session_id: self.session_id.to_string(), - execution_attempt_id: self.execution_attempt_id.to_string(), - ready_attestation_ref: self.ready_attestation_ref.to_string(), - ready_attestation_digest: match self.ready_attestation_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ready_at: match self.ready_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ExecutionAttemptReadyView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.ready_attestation_ref) as u64; - if self.ready_attestation_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ready_attestation_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.ready_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ready_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.execution_attempt_id, buf); - ::buffa::types::put_string_field(3u32, &self.ready_attestation_ref, buf); - if self.ready_attestation_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ready_attestation_digest.write_to(__cache, buf); - } - if self.ready_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ready_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ExecutionAttemptReadyView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("executionAttemptId", self.execution_attempt_id)?; - } - { - __map.serialize_entry("readyAttestationRef", self.ready_attestation_ref)?; - } - { - if let ::core::option::Option::Some(__v) = self - .ready_attestation_digest - .as_option() - { - __map.serialize_entry("readyAttestationDigest", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.ready_at.as_option() { - __map.serialize_entry("readyAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ExecutionAttemptReadyView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ExecutionAttemptReady"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ExecutionAttemptReady"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExecutionAttemptReady"; -} -::buffa::impl_default_view_instance!(ExecutionAttemptReadyView); -::buffa::impl_view_reborrow!(ExecutionAttemptReadyView); -/** Self-contained, `'static` owned view of a `ExecutionAttemptReady` message. - - Wraps [`::buffa::OwnedView`]`<`[`ExecutionAttemptReadyView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ExecutionAttemptReadyView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ExecutionAttemptReadyOwnedView( - ::buffa::OwnedView>, -); -impl ExecutionAttemptReadyOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExecutionAttemptReadyOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExecutionAttemptReadyOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ExecutionAttemptReady, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExecutionAttemptReadyOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ExecutionAttemptReadyView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ExecutionAttemptReadyView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ExecutionAttemptReady { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `execution_attempt_id` - #[must_use] - pub fn execution_attempt_id(&self) -> &'_ str { - self.0.reborrow().execution_attempt_id - } - /// Field 3: `ready_attestation_ref` - #[must_use] - pub fn ready_attestation_ref(&self) -> &'_ str { - self.0.reborrow().ready_attestation_ref - } - /// Field 4: `ready_attestation_digest` - #[must_use] - pub fn ready_attestation_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().ready_attestation_digest - } - /// Wall-clock instant the attempt actually became ready: a real external - /// occurrence distinct from envelope append time (D10). - /// - /// Field 5: `ready_at` - #[must_use] - pub fn ready_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().ready_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ExecutionAttemptReadyOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ExecutionAttemptReadyOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ExecutionAttemptReadyOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ExecutionAttemptReadyOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ExecutionAttemptReady { - type View<'a> = ExecutionAttemptReadyView<'a>; - type ViewHandle = ExecutionAttemptReadyOwnedView; -} -impl ::serde::Serialize for ExecutionAttemptReadyOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_ready.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_ready.rs deleted file mode 100644 index 4060abe17..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_ready.rs +++ /dev/null @@ -1,223 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/execution_attempt_ready.proto - -/// ExecutionAttemptReady is admission proof that the attempt's implementation -/// and effective configuration are running (ADR#0031 §4). It advances the -/// same attempt's Ready-after-Started invariant, so it is invariant-bearing -/// (WRITE_PRECONDITION = At), not a commuting happened-fact. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ExecutionAttemptReady { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `execution_attempt_id` - #[serde( - rename = "executionAttemptId", - alias = "execution_attempt_id", - with = "::buffa::json_helpers::proto_string" - )] - pub execution_attempt_id: ::buffa::alloc::string::String, - /// Field 3: `ready_attestation_ref` - #[serde( - rename = "readyAttestationRef", - alias = "ready_attestation_ref", - with = "::buffa::json_helpers::proto_string" - )] - pub ready_attestation_ref: ::buffa::alloc::string::String, - /// Field 4: `ready_attestation_digest` - #[serde(rename = "readyAttestationDigest", alias = "ready_attestation_digest")] - pub ready_attestation_digest: ::buffa::MessageField>, - /// Wall-clock instant the attempt actually became ready: a real external - /// occurrence distinct from envelope append time (D10). - /// - /// Field 5: `ready_at` - #[serde(rename = "readyAt", alias = "ready_at")] - pub ready_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for ExecutionAttemptReady { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ExecutionAttemptReady") - .field("session_id", &self.session_id) - .field("execution_attempt_id", &self.execution_attempt_id) - .field("ready_attestation_ref", &self.ready_attestation_ref) - .field("ready_attestation_digest", &self.ready_attestation_digest) - .field("ready_at", &self.ready_at) - .finish() - } -} -impl ExecutionAttemptReady { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExecutionAttemptReady"; -} -::buffa::impl_default_instance!(ExecutionAttemptReady); -impl ::buffa::MessageName for ExecutionAttemptReady { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ExecutionAttemptReady"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ExecutionAttemptReady"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExecutionAttemptReady"; -} -impl ::buffa::Message for ExecutionAttemptReady { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.ready_attestation_ref) as u64; - if self.ready_attestation_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ready_attestation_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.ready_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ready_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.execution_attempt_id, buf); - ::buffa::types::put_string_field(3u32, &self.ready_attestation_ref, buf); - if self.ready_attestation_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ready_attestation_digest.write_to(__cache, buf); - } - if self.ready_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ready_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.execution_attempt_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.ready_attestation_ref, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.ready_attestation_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.ready_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.execution_attempt_id.clear(); - self.ready_attestation_ref.clear(); - self.ready_attestation_digest = ::buffa::MessageField::none(); - self.ready_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ExecutionAttemptReady { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __EXECUTION_ATTEMPT_READY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExecutionAttemptReady", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_started.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_started.__view.rs deleted file mode 100644 index eb8ae33f0..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_started.__view.rs +++ /dev/null @@ -1,740 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/execution_attempt_started.proto - -/// ExecutionAttemptStarted is one attempt's start evidence under the immutable -/// session execution plan; a restart creates a new attempt, never edits the -/// prior one (ADR#0031 §4). It mints and advances this session's monotonic -/// attempt counter under a one-active-attempt invariant, so it is -/// invariant-bearing (WRITE_PRECONDITION = At), not a commuting happened-fact. -/// restored_checkpoint deliberately embeds the full Checkpoint rather than a -/// reference: it is attempt evidence of exactly what was restored, -/// digest-verified and joined unambiguously to its producing event via -/// Checkpoint.checkpoint_id. -#[derive(Clone, Debug, Default)] -pub struct ExecutionAttemptStartedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `execution_attempt_id` - pub execution_attempt_id: &'a str, - /// Field 3: `session_execution_plan_digest` - pub session_execution_plan_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Field 4: `attempt_number` - pub attempt_number: u64, - /// Immediately preceding attempt's id: empty exactly when attempt_number is 1, - /// required for every restart (attempt_number \> 1). The boundary validator - /// enforces that coupling; the exact-predecessor match is a decide-time - /// invariant checked against folded state (ADR#0035 command matrix). - /// - /// Field 5: `previous_attempt_id` - pub previous_attempt_id: ::core::option::Option<&'a str>, - /// Field 6: `restored_checkpoint` - pub restored_checkpoint: ::buffa::MessageFieldView< - super::super::__buffa::view::CheckpointView<'a>, - >, - /// Field 8: `host_artifact_ref` - pub host_artifact_ref: &'a str, - /// Field 9: `host_artifact_digest` - pub host_artifact_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Field 10: `authenticated_remote_subject` - pub authenticated_remote_subject: ::core::option::Option<&'a str>, - /// Field 11: `isolation_placement` - pub isolation_placement: ::core::option::Option<&'a str>, - /// Wall-clock instant the attempt actually started: a real external - /// occurrence distinct from envelope append time (D10). - /// - /// Field 12: `started_at` - pub started_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ExecutionAttemptStartedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `execution_attempt_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_execution_attempt_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `session_execution_plan_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_execution_plan_digest(&self) -> bool { - self.session_execution_plan_digest.is_set() - } - /**Whether required field `attempt_number` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_attempt_number(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `host_artifact_ref` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_host_artifact_ref(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `host_artifact_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_host_artifact_digest(&self) -> bool { - self.host_artifact_digest.is_set() - } - /**Whether required field `started_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_started_at(&self) -> bool { - self.started_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ExecutionAttemptStartedView<'a> { - type Owned = super::super::ExecutionAttemptStarted; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.execution_attempt_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.session_execution_plan_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.session_execution_plan_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.attempt_number = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.previous_attempt_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.restored_checkpoint.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.restored_checkpoint = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.host_artifact_ref = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.host_artifact_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.host_artifact_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.authenticated_remote_subject = Some( - ::buffa::types::borrow_str(&mut cur)?, - ); - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.isolation_placement = Some(::buffa::types::borrow_str(&mut cur)?); - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.started_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.started_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ExecutionAttemptStarted, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ExecutionAttemptStarted, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ExecutionAttemptStarted { - session_id: self.session_id.to_string(), - execution_attempt_id: self.execution_attempt_id.to_string(), - session_execution_plan_digest: match self - .session_execution_plan_digest - .as_option() - { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - attempt_number: self.attempt_number, - previous_attempt_id: self.previous_attempt_id.map(|s| s.to_string()), - restored_checkpoint: match self.restored_checkpoint.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Checkpoint, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - host_artifact_ref: self.host_artifact_ref.to_string(), - host_artifact_digest: match self.host_artifact_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - authenticated_remote_subject: self - .authenticated_remote_subject - .map(|s| s.to_string()), - isolation_placement: self.isolation_placement.map(|s| s.to_string()), - started_at: match self.started_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ExecutionAttemptStartedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - if self.session_execution_plan_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.session_execution_plan_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.attempt_number) as u64; - if let Some(ref v) = self.previous_attempt_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.restored_checkpoint.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.restored_checkpoint.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.host_artifact_ref) as u64; - if self.host_artifact_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.host_artifact_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.authenticated_remote_subject { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.isolation_placement { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.started_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.started_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.execution_attempt_id, buf); - if self.session_execution_plan_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.session_execution_plan_digest.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(4u32, self.attempt_number, buf); - if let Some(ref v) = self.previous_attempt_id { - ::buffa::types::put_string_field(5u32, v, buf); - } - if self.restored_checkpoint.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.restored_checkpoint.write_to(__cache, buf); - } - ::buffa::types::put_string_field(8u32, &self.host_artifact_ref, buf); - if self.host_artifact_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.host_artifact_digest.write_to(__cache, buf); - } - if let Some(ref v) = self.authenticated_remote_subject { - ::buffa::types::put_string_field(10u32, v, buf); - } - if let Some(ref v) = self.isolation_placement { - ::buffa::types::put_string_field(11u32, v, buf); - } - if self.started_at.is_set() { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - self.started_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ExecutionAttemptStartedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("executionAttemptId", self.execution_attempt_id)?; - } - { - if let ::core::option::Option::Some(__v) = self - .session_execution_plan_digest - .as_option() - { - __map.serialize_entry("sessionExecutionPlanDigest", __v)?; - } - } - { - __map - .serialize_entry( - "attemptNumber", - &::buffa::json_helpers::ProtoJson(&self.attempt_number), - )?; - } - if let ::core::option::Option::Some(__v) = self.previous_attempt_id { - __map.serialize_entry("previousAttemptId", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self - .restored_checkpoint - .as_option() - { - __map.serialize_entry("restoredCheckpoint", __v)?; - } - } - { - __map.serialize_entry("hostArtifactRef", self.host_artifact_ref)?; - } - { - if let ::core::option::Option::Some(__v) = self - .host_artifact_digest - .as_option() - { - __map.serialize_entry("hostArtifactDigest", __v)?; - } - } - if let ::core::option::Option::Some(__v) = self.authenticated_remote_subject { - __map.serialize_entry("authenticatedRemoteSubject", __v)?; - } - if let ::core::option::Option::Some(__v) = self.isolation_placement { - __map.serialize_entry("isolationPlacement", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.started_at.as_option() { - __map.serialize_entry("startedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ExecutionAttemptStartedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ExecutionAttemptStarted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ExecutionAttemptStarted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExecutionAttemptStarted"; -} -::buffa::impl_default_view_instance!(ExecutionAttemptStartedView); -::buffa::impl_view_reborrow!(ExecutionAttemptStartedView); -/** Self-contained, `'static` owned view of a `ExecutionAttemptStarted` message. - - Wraps [`::buffa::OwnedView`]`<`[`ExecutionAttemptStartedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ExecutionAttemptStartedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ExecutionAttemptStartedOwnedView( - ::buffa::OwnedView>, -); -impl ExecutionAttemptStartedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExecutionAttemptStartedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExecutionAttemptStartedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ExecutionAttemptStarted, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExecutionAttemptStartedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ExecutionAttemptStartedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ExecutionAttemptStartedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ExecutionAttemptStarted { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `execution_attempt_id` - #[must_use] - pub fn execution_attempt_id(&self) -> &'_ str { - self.0.reborrow().execution_attempt_id - } - /// Field 3: `session_execution_plan_digest` - #[must_use] - pub fn session_execution_plan_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().session_execution_plan_digest - } - /// Field 4: `attempt_number` - #[must_use] - pub fn attempt_number(&self) -> u64 { - self.0.reborrow().attempt_number - } - /// Immediately preceding attempt's id: empty exactly when attempt_number is 1, - /// required for every restart (attempt_number \> 1). The boundary validator - /// enforces that coupling; the exact-predecessor match is a decide-time - /// invariant checked against folded state (ADR#0035 command matrix). - /// - /// Field 5: `previous_attempt_id` - #[must_use] - pub fn previous_attempt_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().previous_attempt_id - } - /// Field 6: `restored_checkpoint` - #[must_use] - pub fn restored_checkpoint( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().restored_checkpoint - } - /// Field 8: `host_artifact_ref` - #[must_use] - pub fn host_artifact_ref(&self) -> &'_ str { - self.0.reborrow().host_artifact_ref - } - /// Field 9: `host_artifact_digest` - #[must_use] - pub fn host_artifact_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().host_artifact_digest - } - /// Field 10: `authenticated_remote_subject` - #[must_use] - pub fn authenticated_remote_subject(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().authenticated_remote_subject - } - /// Field 11: `isolation_placement` - #[must_use] - pub fn isolation_placement(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().isolation_placement - } - /// Wall-clock instant the attempt actually started: a real external - /// occurrence distinct from envelope append time (D10). - /// - /// Field 12: `started_at` - #[must_use] - pub fn started_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().started_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ExecutionAttemptStartedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ExecutionAttemptStartedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ExecutionAttemptStartedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ExecutionAttemptStartedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ExecutionAttemptStarted { - type View<'a> = ExecutionAttemptStartedView<'a>; - type ViewHandle = ExecutionAttemptStartedOwnedView; -} -impl ::serde::Serialize for ExecutionAttemptStartedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_started.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_started.rs deleted file mode 100644 index a2c40b631..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_attempt_started.rs +++ /dev/null @@ -1,442 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/execution_attempt_started.proto - -/// ExecutionAttemptStarted is one attempt's start evidence under the immutable -/// session execution plan; a restart creates a new attempt, never edits the -/// prior one (ADR#0031 §4). It mints and advances this session's monotonic -/// attempt counter under a one-active-attempt invariant, so it is -/// invariant-bearing (WRITE_PRECONDITION = At), not a commuting happened-fact. -/// restored_checkpoint deliberately embeds the full Checkpoint rather than a -/// reference: it is attempt evidence of exactly what was restored, -/// digest-verified and joined unambiguously to its producing event via -/// Checkpoint.checkpoint_id. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ExecutionAttemptStarted { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `execution_attempt_id` - #[serde( - rename = "executionAttemptId", - alias = "execution_attempt_id", - with = "::buffa::json_helpers::proto_string" - )] - pub execution_attempt_id: ::buffa::alloc::string::String, - /// Field 3: `session_execution_plan_digest` - #[serde( - rename = "sessionExecutionPlanDigest", - alias = "session_execution_plan_digest" - )] - pub session_execution_plan_digest: ::buffa::MessageField< - Digest, - ::buffa::Inline, - >, - /// Field 4: `attempt_number` - #[serde( - rename = "attemptNumber", - alias = "attempt_number", - with = "::buffa::json_helpers::uint64" - )] - pub attempt_number: u64, - /// Immediately preceding attempt's id: empty exactly when attempt_number is 1, - /// required for every restart (attempt_number \> 1). The boundary validator - /// enforces that coupling; the exact-predecessor match is a decide-time - /// invariant checked against folded state (ADR#0035 command matrix). - /// - /// Field 5: `previous_attempt_id` - #[serde( - rename = "previousAttemptId", - alias = "previous_attempt_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub previous_attempt_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 6: `restored_checkpoint` - #[serde( - rename = "restoredCheckpoint", - alias = "restored_checkpoint", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub restored_checkpoint: ::buffa::MessageField< - Checkpoint, - ::buffa::Inline, - >, - /// Field 8: `host_artifact_ref` - #[serde( - rename = "hostArtifactRef", - alias = "host_artifact_ref", - with = "::buffa::json_helpers::proto_string" - )] - pub host_artifact_ref: ::buffa::alloc::string::String, - /// Field 9: `host_artifact_digest` - #[serde(rename = "hostArtifactDigest", alias = "host_artifact_digest")] - pub host_artifact_digest: ::buffa::MessageField>, - /// Field 10: `authenticated_remote_subject` - #[serde( - rename = "authenticatedRemoteSubject", - alias = "authenticated_remote_subject", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub authenticated_remote_subject: ::core::option::Option< - ::buffa::alloc::string::String, - >, - /// Field 11: `isolation_placement` - #[serde( - rename = "isolationPlacement", - alias = "isolation_placement", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub isolation_placement: ::core::option::Option<::buffa::alloc::string::String>, - /// Wall-clock instant the attempt actually started: a real external - /// occurrence distinct from envelope append time (D10). - /// - /// Field 12: `started_at` - #[serde(rename = "startedAt", alias = "started_at")] - pub started_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for ExecutionAttemptStarted { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ExecutionAttemptStarted") - .field("session_id", &self.session_id) - .field("execution_attempt_id", &self.execution_attempt_id) - .field("session_execution_plan_digest", &self.session_execution_plan_digest) - .field("attempt_number", &self.attempt_number) - .field("previous_attempt_id", &self.previous_attempt_id) - .field("restored_checkpoint", &self.restored_checkpoint) - .field("host_artifact_ref", &self.host_artifact_ref) - .field("host_artifact_digest", &self.host_artifact_digest) - .field("authenticated_remote_subject", &self.authenticated_remote_subject) - .field("isolation_placement", &self.isolation_placement) - .field("started_at", &self.started_at) - .finish() - } -} -impl ExecutionAttemptStarted { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExecutionAttemptStarted"; -} -impl ExecutionAttemptStarted { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::previous_attempt_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_previous_attempt_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.previous_attempt_id = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::authenticated_remote_subject`] to `Some(value)`, consuming and returning `self`. - pub fn with_authenticated_remote_subject( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.authenticated_remote_subject = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::isolation_placement`] to `Some(value)`, consuming and returning `self`. - pub fn with_isolation_placement( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.isolation_placement = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ExecutionAttemptStarted); -impl ::buffa::MessageName for ExecutionAttemptStarted { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ExecutionAttemptStarted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ExecutionAttemptStarted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExecutionAttemptStarted"; -} -impl ::buffa::Message for ExecutionAttemptStarted { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - if self.session_execution_plan_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.session_execution_plan_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.attempt_number) as u64; - if let Some(ref v) = self.previous_attempt_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.restored_checkpoint.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.restored_checkpoint.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.host_artifact_ref) as u64; - if self.host_artifact_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.host_artifact_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.authenticated_remote_subject { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.isolation_placement { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.started_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.started_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.execution_attempt_id, buf); - if self.session_execution_plan_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.session_execution_plan_digest.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(4u32, self.attempt_number, buf); - if let Some(ref v) = self.previous_attempt_id { - ::buffa::types::put_string_field(5u32, v, buf); - } - if self.restored_checkpoint.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.restored_checkpoint.write_to(__cache, buf); - } - ::buffa::types::put_string_field(8u32, &self.host_artifact_ref, buf); - if self.host_artifact_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.host_artifact_digest.write_to(__cache, buf); - } - if let Some(ref v) = self.authenticated_remote_subject { - ::buffa::types::put_string_field(10u32, v, buf); - } - if let Some(ref v) = self.isolation_placement { - ::buffa::types::put_string_field(11u32, v, buf); - } - if self.started_at.is_set() { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - self.started_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.execution_attempt_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.session_execution_plan_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.attempt_number = ::buffa::types::decode_uint64(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .previous_attempt_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.restored_checkpoint.get_or_insert_default(), - buf, - ctx, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.host_artifact_ref, buf)?; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.host_artifact_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .authenticated_remote_subject - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .isolation_placement - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.started_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.execution_attempt_id.clear(); - self.session_execution_plan_digest = ::buffa::MessageField::none(); - self.attempt_number = 0u64; - self.previous_attempt_id = ::core::option::Option::None; - self.restored_checkpoint = ::buffa::MessageField::none(); - self.host_artifact_ref.clear(); - self.host_artifact_digest = ::buffa::MessageField::none(); - self.authenticated_remote_subject = ::core::option::Option::None; - self.isolation_placement = ::core::option::Option::None; - self.started_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ExecutionAttemptStarted { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __EXECUTION_ATTEMPT_STARTED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExecutionAttemptStarted", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_plan.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_plan.__view.rs deleted file mode 100644 index 847c4053e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_plan.__view.rs +++ /dev/null @@ -1,345 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/execution_plan.proto - -/// StoredSessionExecutionPlan is the canonical SessionExecutionPlan bytes plus the -/// digest computed over exactly those bytes (ADR#0031 §5, §6). SessionStarted -/// stores it once per session; readers verify plan_digest against plan_bytes -/// before decoding and never re-encode a decoded plan to recreate the digest. -#[derive(Clone, Debug, Default)] -pub struct StoredSessionExecutionPlanView<'a> { - /// Canonical, immutable SessionExecutionPlan encoding. - /// - /// Field 1: `plan_bytes` - pub plan_bytes: &'a [u8], - /// Digest over plan_bytes, stored beside the bytes it commits to. - /// - /// Field 2: `plan_digest` - pub plan_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> StoredSessionExecutionPlanView<'a> { - /**Whether required field `plan_bytes` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_plan_bytes(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `plan_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_plan_digest(&self) -> bool { - self.plan_digest.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for StoredSessionExecutionPlanView<'a> { - type Owned = super::super::StoredSessionExecutionPlan; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.plan_bytes = ::buffa::types::borrow_bytes(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.plan_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.plan_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::StoredSessionExecutionPlan, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::StoredSessionExecutionPlan, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::StoredSessionExecutionPlan { - plan_bytes: (self.plan_bytes).to_vec(), - plan_digest: match self.plan_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for StoredSessionExecutionPlanView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::bytes_encoded_len(&self.plan_bytes) as u64; - if self.plan_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.plan_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_shared_bytes_field(1u32, &self.plan_bytes, buf); - if self.plan_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.plan_digest.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for StoredSessionExecutionPlanView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "planBytes", - &::buffa::json_helpers::BytesJson(self.plan_bytes), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.plan_digest.as_option() { - __map.serialize_entry("planDigest", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for StoredSessionExecutionPlanView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "StoredSessionExecutionPlan"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.StoredSessionExecutionPlan"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StoredSessionExecutionPlan"; -} -::buffa::impl_default_view_instance!(StoredSessionExecutionPlanView); -::buffa::impl_view_reborrow!(StoredSessionExecutionPlanView); -/** Self-contained, `'static` owned view of a `StoredSessionExecutionPlan` message. - - Wraps [`::buffa::OwnedView`]`<`[`StoredSessionExecutionPlanView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`StoredSessionExecutionPlanView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct StoredSessionExecutionPlanOwnedView( - ::buffa::OwnedView>, -); -impl StoredSessionExecutionPlanOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StoredSessionExecutionPlanOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StoredSessionExecutionPlanOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::StoredSessionExecutionPlan, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StoredSessionExecutionPlanOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`StoredSessionExecutionPlanView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &StoredSessionExecutionPlanView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::StoredSessionExecutionPlan { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Canonical, immutable SessionExecutionPlan encoding. - /// - /// Field 1: `plan_bytes` - #[must_use] - pub fn plan_bytes(&self) -> &'_ [u8] { - self.0.reborrow().plan_bytes - } - /// Digest over plan_bytes, stored beside the bytes it commits to. - /// - /// Field 2: `plan_digest` - #[must_use] - pub fn plan_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().plan_digest - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for StoredSessionExecutionPlanOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - StoredSessionExecutionPlanOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: StoredSessionExecutionPlanOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for StoredSessionExecutionPlanOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::StoredSessionExecutionPlan { - type View<'a> = StoredSessionExecutionPlanView<'a>; - type ViewHandle = StoredSessionExecutionPlanOwnedView; -} -impl ::serde::Serialize for StoredSessionExecutionPlanOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_plan.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_plan.rs deleted file mode 100644 index 04358b9af..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.execution_plan.rs +++ /dev/null @@ -1,149 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/execution_plan.proto - -/// StoredSessionExecutionPlan is the canonical SessionExecutionPlan bytes plus the -/// digest computed over exactly those bytes (ADR#0031 §5, §6). SessionStarted -/// stores it once per session; readers verify plan_digest against plan_bytes -/// before decoding and never re-encode a decoded plan to recreate the digest. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct StoredSessionExecutionPlan { - /// Canonical, immutable SessionExecutionPlan encoding. - /// - /// Field 1: `plan_bytes` - #[serde( - rename = "planBytes", - alias = "plan_bytes", - with = "::buffa::json_helpers::bytes" - )] - pub plan_bytes: ::buffa::alloc::vec::Vec, - /// Digest over plan_bytes, stored beside the bytes it commits to. - /// - /// Field 2: `plan_digest` - #[serde(rename = "planDigest", alias = "plan_digest")] - pub plan_digest: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for StoredSessionExecutionPlan { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("StoredSessionExecutionPlan") - .field("plan_bytes", &self.plan_bytes) - .field("plan_digest", &self.plan_digest) - .finish() - } -} -impl StoredSessionExecutionPlan { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StoredSessionExecutionPlan"; -} -::buffa::impl_default_instance!(StoredSessionExecutionPlan); -impl ::buffa::MessageName for StoredSessionExecutionPlan { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "StoredSessionExecutionPlan"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.StoredSessionExecutionPlan"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StoredSessionExecutionPlan"; -} -impl ::buffa::Message for StoredSessionExecutionPlan { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::bytes_encoded_len(&self.plan_bytes) as u64; - if self.plan_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.plan_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_shared_bytes_field(1u32, &self.plan_bytes, buf); - if self.plan_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.plan_digest.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes(&mut self.plan_bytes, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.plan_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.plan_bytes.clear(); - self.plan_digest = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for StoredSessionExecutionPlan { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __STORED_SESSION_EXECUTION_PLAN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.StoredSessionExecutionPlan", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.external_delegation_dispatched.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.external_delegation_dispatched.__view.rs deleted file mode 100644 index 8450dd8db..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.external_delegation_dispatched.__view.rs +++ /dev/null @@ -1,528 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/external_delegation_dispatched.proto - -/// ExternalDelegationDispatched is the dispatching session's link fact recording -/// a delegation to a delegate outside this platform's session store, carrying -/// exactly the evidence ADR#0031 requires to authorize and reconcile the -/// dispatch: the authenticated remote subject and authorization reference the -/// dispatch was made under, and a digest of the exact request bytes sent -/// (ADR#0035 facet 6). It reuses the operation-ledger id to dedupe dispatch, -/// mirroring DelegationDispatched. It is an invariant-bearing transition -/// (WRITE_PRECONDITION = At), letting the dispatching command refuse to spawn -/// under an already-terminal session race-safely. -#[derive(Clone, Debug, Default)] -pub struct ExternalDelegationDispatchedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `operation_id` - pub operation_id: &'a str, - /// Locator for the external delegate the operation was dispatched to. - /// - /// Field 3: `delegate_reference` - pub delegate_reference: &'a str, - /// Authenticated remote subject the dispatch was made under. - /// - /// Field 4: `authenticated_remote_subject` - pub authenticated_remote_subject: &'a str, - /// Reference to the authorization that permitted this dispatch. - /// - /// Field 5: `authorization_reference` - pub authorization_reference: &'a str, - /// Digest over the exact request bytes sent to the delegate. - /// - /// Field 6: `request_digest` - pub request_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Correlation id for tracing this dispatch across the external system; - /// meaningful here at the dispatch event, not on the eventual outcome (the - /// outcome joins by operation_id). - /// - /// Field 7: `correlation_id` - pub correlation_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ExternalDelegationDispatchedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `delegate_reference` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_delegate_reference(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `authenticated_remote_subject` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_authenticated_remote_subject(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `authorization_reference` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_authorization_reference(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } - /**Whether required field `request_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_request_digest(&self) -> bool { - self.request_digest.is_set() - } - /**Whether required field `correlation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_correlation_id(&self) -> bool { - self.__buffa_required_seen_0 & 32u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ExternalDelegationDispatchedView<'a> { - type Owned = super::super::ExternalDelegationDispatched; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.delegate_reference = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.authenticated_remote_subject = ::buffa::types::borrow_str( - &mut cur, - )?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.authorization_reference = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.request_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.request_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.correlation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 32u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ExternalDelegationDispatched, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ExternalDelegationDispatched, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ExternalDelegationDispatched { - session_id: self.session_id.to_string(), - operation_id: self.operation_id.to_string(), - delegate_reference: self.delegate_reference.to_string(), - authenticated_remote_subject: self.authenticated_remote_subject.to_string(), - authorization_reference: self.authorization_reference.to_string(), - request_digest: match self.request_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - correlation_id: self.correlation_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ExternalDelegationDispatchedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.delegate_reference) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.authenticated_remote_subject) - as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.authorization_reference) - as u64; - if self.request_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.request_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.correlation_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - ::buffa::types::put_string_field(3u32, &self.delegate_reference, buf); - ::buffa::types::put_string_field(4u32, &self.authenticated_remote_subject, buf); - ::buffa::types::put_string_field(5u32, &self.authorization_reference, buf); - if self.request_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.request_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(7u32, &self.correlation_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ExternalDelegationDispatchedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("operationId", self.operation_id)?; - } - { - __map.serialize_entry("delegateReference", self.delegate_reference)?; - } - { - __map - .serialize_entry( - "authenticatedRemoteSubject", - self.authenticated_remote_subject, - )?; - } - { - __map - .serialize_entry( - "authorizationReference", - self.authorization_reference, - )?; - } - { - if let ::core::option::Option::Some(__v) = self.request_digest.as_option() { - __map.serialize_entry("requestDigest", __v)?; - } - } - { - __map.serialize_entry("correlationId", self.correlation_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ExternalDelegationDispatchedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ExternalDelegationDispatched"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ExternalDelegationDispatched"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExternalDelegationDispatched"; -} -::buffa::impl_default_view_instance!(ExternalDelegationDispatchedView); -::buffa::impl_view_reborrow!(ExternalDelegationDispatchedView); -/** Self-contained, `'static` owned view of a `ExternalDelegationDispatched` message. - - Wraps [`::buffa::OwnedView`]`<`[`ExternalDelegationDispatchedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ExternalDelegationDispatchedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ExternalDelegationDispatchedOwnedView( - ::buffa::OwnedView>, -); -impl ExternalDelegationDispatchedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExternalDelegationDispatchedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExternalDelegationDispatchedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ExternalDelegationDispatched, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ExternalDelegationDispatchedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ExternalDelegationDispatchedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ExternalDelegationDispatchedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ExternalDelegationDispatched { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Locator for the external delegate the operation was dispatched to. - /// - /// Field 3: `delegate_reference` - #[must_use] - pub fn delegate_reference(&self) -> &'_ str { - self.0.reborrow().delegate_reference - } - /// Authenticated remote subject the dispatch was made under. - /// - /// Field 4: `authenticated_remote_subject` - #[must_use] - pub fn authenticated_remote_subject(&self) -> &'_ str { - self.0.reborrow().authenticated_remote_subject - } - /// Reference to the authorization that permitted this dispatch. - /// - /// Field 5: `authorization_reference` - #[must_use] - pub fn authorization_reference(&self) -> &'_ str { - self.0.reborrow().authorization_reference - } - /// Digest over the exact request bytes sent to the delegate. - /// - /// Field 6: `request_digest` - #[must_use] - pub fn request_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().request_digest - } - /// Correlation id for tracing this dispatch across the external system; - /// meaningful here at the dispatch event, not on the eventual outcome (the - /// outcome joins by operation_id). - /// - /// Field 7: `correlation_id` - #[must_use] - pub fn correlation_id(&self) -> &'_ str { - self.0.reborrow().correlation_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ExternalDelegationDispatchedOwnedView { - fn from( - inner: ::buffa::OwnedView>, - ) -> Self { - ExternalDelegationDispatchedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ExternalDelegationDispatchedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef< - ::buffa::OwnedView>, -> for ExternalDelegationDispatchedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ExternalDelegationDispatched { - type View<'a> = ExternalDelegationDispatchedView<'a>; - type ViewHandle = ExternalDelegationDispatchedOwnedView; -} -impl ::serde::Serialize for ExternalDelegationDispatchedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.external_delegation_dispatched.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.external_delegation_dispatched.rs deleted file mode 100644 index 25fa084fd..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.external_delegation_dispatched.rs +++ /dev/null @@ -1,263 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/external_delegation_dispatched.proto - -/// ExternalDelegationDispatched is the dispatching session's link fact recording -/// a delegation to a delegate outside this platform's session store, carrying -/// exactly the evidence ADR#0031 requires to authorize and reconcile the -/// dispatch: the authenticated remote subject and authorization reference the -/// dispatch was made under, and a digest of the exact request bytes sent -/// (ADR#0035 facet 6). It reuses the operation-ledger id to dedupe dispatch, -/// mirroring DelegationDispatched. It is an invariant-bearing transition -/// (WRITE_PRECONDITION = At), letting the dispatching command refuse to spawn -/// under an already-terminal session race-safely. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ExternalDelegationDispatched { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// Locator for the external delegate the operation was dispatched to. - /// - /// Field 3: `delegate_reference` - #[serde( - rename = "delegateReference", - alias = "delegate_reference", - with = "::buffa::json_helpers::proto_string" - )] - pub delegate_reference: ::buffa::alloc::string::String, - /// Authenticated remote subject the dispatch was made under. - /// - /// Field 4: `authenticated_remote_subject` - #[serde( - rename = "authenticatedRemoteSubject", - alias = "authenticated_remote_subject", - with = "::buffa::json_helpers::proto_string" - )] - pub authenticated_remote_subject: ::buffa::alloc::string::String, - /// Reference to the authorization that permitted this dispatch. - /// - /// Field 5: `authorization_reference` - #[serde( - rename = "authorizationReference", - alias = "authorization_reference", - with = "::buffa::json_helpers::proto_string" - )] - pub authorization_reference: ::buffa::alloc::string::String, - /// Digest over the exact request bytes sent to the delegate. - /// - /// Field 6: `request_digest` - #[serde(rename = "requestDigest", alias = "request_digest")] - pub request_digest: ::buffa::MessageField>, - /// Correlation id for tracing this dispatch across the external system; - /// meaningful here at the dispatch event, not on the eventual outcome (the - /// outcome joins by operation_id). - /// - /// Field 7: `correlation_id` - #[serde( - rename = "correlationId", - alias = "correlation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub correlation_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for ExternalDelegationDispatched { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ExternalDelegationDispatched") - .field("session_id", &self.session_id) - .field("operation_id", &self.operation_id) - .field("delegate_reference", &self.delegate_reference) - .field("authenticated_remote_subject", &self.authenticated_remote_subject) - .field("authorization_reference", &self.authorization_reference) - .field("request_digest", &self.request_digest) - .field("correlation_id", &self.correlation_id) - .finish() - } -} -impl ExternalDelegationDispatched { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExternalDelegationDispatched"; -} -::buffa::impl_default_instance!(ExternalDelegationDispatched); -impl ::buffa::MessageName for ExternalDelegationDispatched { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ExternalDelegationDispatched"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ExternalDelegationDispatched"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExternalDelegationDispatched"; -} -impl ::buffa::Message for ExternalDelegationDispatched { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.delegate_reference) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.authenticated_remote_subject) - as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.authorization_reference) - as u64; - if self.request_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.request_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.correlation_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - ::buffa::types::put_string_field(3u32, &self.delegate_reference, buf); - ::buffa::types::put_string_field(4u32, &self.authenticated_remote_subject, buf); - ::buffa::types::put_string_field(5u32, &self.authorization_reference, buf); - if self.request_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.request_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(7u32, &self.correlation_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.delegate_reference, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - &mut self.authenticated_remote_subject, - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.authorization_reference, buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.request_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.correlation_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.operation_id.clear(); - self.delegate_reference.clear(); - self.authenticated_remote_subject.clear(); - self.authorization_reference.clear(); - self.request_digest = ::buffa::MessageField::none(); - self.correlation_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ExternalDelegationDispatched { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __EXTERNAL_DELEGATION_DISPATCHED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ExternalDelegationDispatched", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_assistant_message.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_assistant_message.__view.rs deleted file mode 100644 index 07a44a905..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_assistant_message.__view.rs +++ /dev/null @@ -1,451 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/fail_assistant_message.proto - -/// FailAssistantMessage settles an assistant turn that was interrupted, -/// cancelled, or errored, recording \[AssistantMessageFailed\], so every started -/// message has a determinable outcome. -/// -/// Write precondition Any: per message_id this competes with -/// CompleteAssistantMessage under first-terminal-outcome-wins. -#[derive(Clone, Debug, Default)] -pub struct FailAssistantMessageView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `message_id` - pub message_id: &'a str, - /// Field 3: `reason` - pub reason: ::buffa::EnumValue, - /// Field 4: `detail` - pub detail: ::core::option::Option<&'a str>, - /// Tokens billed for the partial turn, so a cost fold does not undercount - /// a turn that failed mid-generation. - /// - /// Field 5: `usage` - pub usage: ::buffa::MessageFieldView< - super::super::__buffa::view::TokenUsageView<'a>, - >, - /// Field 6: `turn_id` - pub turn_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> FailAssistantMessageView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `message_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for FailAssistantMessageView<'a> { - type Owned = super::super::FailAssistantMessage; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.message_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.usage.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.usage = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::FailAssistantMessage, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::FailAssistantMessage, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::FailAssistantMessage { - session_id: self.session_id.to_string(), - message_id: self.message_id.to_string(), - reason: self.reason, - detail: self.detail.map(|s| s.to_string()), - usage: match self.usage.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::TokenUsage, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - turn_id: self.turn_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for FailAssistantMessageView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.usage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.usage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.message_id, buf); - ::buffa::types::put_int32_field(3u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.usage.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.usage.write_to(__cache, buf); - } - ::buffa::types::put_string_field(6u32, &self.turn_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for FailAssistantMessageView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("messageId", self.message_id)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.usage.as_option() { - __map.serialize_entry("usage", __v)?; - } - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for FailAssistantMessageView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "FailAssistantMessage"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.FailAssistantMessage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.FailAssistantMessage"; -} -::buffa::impl_default_view_instance!(FailAssistantMessageView); -::buffa::impl_view_reborrow!(FailAssistantMessageView); -/** Self-contained, `'static` owned view of a `FailAssistantMessage` message. - - Wraps [`::buffa::OwnedView`]`<`[`FailAssistantMessageView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`FailAssistantMessageView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct FailAssistantMessageOwnedView( - ::buffa::OwnedView>, -); -impl FailAssistantMessageOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FailAssistantMessageOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FailAssistantMessageOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::FailAssistantMessage, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FailAssistantMessageOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`FailAssistantMessageView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &FailAssistantMessageView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::FailAssistantMessage { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `message_id` - #[must_use] - pub fn message_id(&self) -> &'_ str { - self.0.reborrow().message_id - } - /// Field 3: `reason` - #[must_use] - pub fn reason( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// Field 4: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } - /// Tokens billed for the partial turn, so a cost fold does not undercount - /// a turn that failed mid-generation. - /// - /// Field 5: `usage` - #[must_use] - pub fn usage( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().usage - } - /// Field 6: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for FailAssistantMessageOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - FailAssistantMessageOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: FailAssistantMessageOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for FailAssistantMessageOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::FailAssistantMessage { - type View<'a> = FailAssistantMessageView<'a>; - type ViewHandle = FailAssistantMessageOwnedView; -} -impl ::serde::Serialize for FailAssistantMessageOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_assistant_message.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_assistant_message.rs deleted file mode 100644 index 7e802a360..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_assistant_message.rs +++ /dev/null @@ -1,241 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/fail_assistant_message.proto - -/// FailAssistantMessage settles an assistant turn that was interrupted, -/// cancelled, or errored, recording \[AssistantMessageFailed\], so every started -/// message has a determinable outcome. -/// -/// Write precondition Any: per message_id this competes with -/// CompleteAssistantMessage under first-terminal-outcome-wins. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct FailAssistantMessage { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `message_id` - #[serde( - rename = "messageId", - alias = "message_id", - with = "::buffa::json_helpers::proto_string" - )] - pub message_id: ::buffa::alloc::string::String, - /// Field 3: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// Field 4: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, - /// Tokens billed for the partial turn, so a cost fold does not undercount - /// a turn that failed mid-generation. - /// - /// Field 5: `usage` - #[serde( - rename = "usage", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub usage: ::buffa::MessageField>, - /// Field 6: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for FailAssistantMessage { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("FailAssistantMessage") - .field("session_id", &self.session_id) - .field("message_id", &self.message_id) - .field("reason", &self.reason) - .field("detail", &self.detail) - .field("usage", &self.usage) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl FailAssistantMessage { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.FailAssistantMessage"; -} -impl FailAssistantMessage { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(FailAssistantMessage); -impl ::buffa::MessageName for FailAssistantMessage { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "FailAssistantMessage"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.FailAssistantMessage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.FailAssistantMessage"; -} -impl ::buffa::Message for FailAssistantMessage { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.usage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.usage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.message_id, buf); - ::buffa::types::put_int32_field(3u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.usage.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.usage.write_to(__cache, buf); - } - ::buffa::types::put_string_field(6u32, &self.turn_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.message_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.usage.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.message_id.clear(); - self.reason = ::buffa::EnumValue::from(0); - self.detail = ::core::option::Option::None; - self.usage = ::buffa::MessageField::none(); - self.turn_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for FailAssistantMessage { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __FAIL_ASSISTANT_MESSAGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.FailAssistantMessage", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_session.__view.rs deleted file mode 100644 index 23ed85341..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_session.__view.rs +++ /dev/null @@ -1,310 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/fail_session.proto - -/// FailSession seals a session as failed, recording \[SessionFailed\]. -/// -/// Write precondition At: rejected if the session is already terminal. -#[derive(Clone, Debug, Default)] -pub struct FailSessionView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `reason` - pub reason: ::buffa::EnumValue, - /// Field 3: `detail` - pub detail: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> FailSessionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for FailSessionView<'a> { - type Owned = super::super::FailSession; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::FailSession { - session_id: self.session_id.to_string(), - reason: self.reason, - detail: self.detail.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for FailSessionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for FailSessionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for FailSessionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "FailSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.FailSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.FailSession"; -} -::buffa::impl_default_view_instance!(FailSessionView); -::buffa::impl_view_reborrow!(FailSessionView); -/** Self-contained, `'static` owned view of a `FailSession` message. - - Wraps [`::buffa::OwnedView`]`<`[`FailSessionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`FailSessionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct FailSessionOwnedView(::buffa::OwnedView>); -impl FailSessionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FailSessionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FailSessionOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::FailSession, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FailSessionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`FailSessionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &FailSessionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::FailSession { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// Field 3: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for FailSessionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - FailSessionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: FailSessionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for FailSessionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::FailSession { - type View<'a> = FailSessionView<'a>; - type ViewHandle = FailSessionOwnedView; -} -impl ::serde::Serialize for FailSessionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_session.rs deleted file mode 100644 index ba05fc840..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_session.rs +++ /dev/null @@ -1,164 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/fail_session.proto - -/// FailSession seals a session as failed, recording \[SessionFailed\]. -/// -/// Write precondition At: rejected if the session is already terminal. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct FailSession { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// Field 3: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for FailSession { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("FailSession") - .field("session_id", &self.session_id) - .field("reason", &self.reason) - .field("detail", &self.detail) - .finish() - } -} -impl FailSession { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.FailSession"; -} -impl FailSession { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(FailSession); -impl ::buffa::MessageName for FailSession { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "FailSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.FailSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.FailSession"; -} -impl ::buffa::Message for FailSession { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.reason = ::buffa::EnumValue::from(0); - self.detail = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for FailSession { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __FAIL_SESSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.FailSession", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_tool_call.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_tool_call.__view.rs deleted file mode 100644 index 769321f94..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_tool_call.__view.rs +++ /dev/null @@ -1,406 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/fail_tool_call.proto - -/// FailToolCall settles a call with an error, recording \[ToolCallFailed\]. It is -/// how a reconciler rejects a call it found interrupted, with reason -/// TOOL_CALL_FAILURE_REASON_INTERRUPTED. -/// -/// Write precondition Any: first-terminal-outcome-wins against CompleteToolCall, -/// keyed on tool_execution_id. -#[derive(Clone, Debug, Default)] -pub struct FailToolCallView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Field 3: `tool_execution_id` - pub tool_execution_id: &'a str, - /// Field 4: `error` - pub error: &'a str, - /// Field 5: `reason` - pub reason: ::buffa::EnumValue, - /// Field 6: `turn_id` - pub turn_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> FailToolCallView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_execution_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_execution_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `error` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_error(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 32u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for FailToolCallView<'a> { - type Owned = super::super::FailToolCall; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_execution_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.error = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 16u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 32u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::FailToolCall { - session_id: self.session_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - tool_execution_id: self.tool_execution_id.to_string(), - error: self.error.to_string(), - reason: self.reason, - turn_id: self.turn_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for FailToolCallView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.error) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.error, buf); - ::buffa::types::put_int32_field(5u32, self.reason.to_i32(), buf); - ::buffa::types::put_string_field(6u32, &self.turn_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for FailToolCallView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolExecutionId", self.tool_execution_id)?; - } - { - __map.serialize_entry("error", self.error)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for FailToolCallView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "FailToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.FailToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.FailToolCall"; -} -::buffa::impl_default_view_instance!(FailToolCallView); -::buffa::impl_view_reborrow!(FailToolCallView); -/** Self-contained, `'static` owned view of a `FailToolCall` message. - - Wraps [`::buffa::OwnedView`]`<`[`FailToolCallView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`FailToolCallView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct FailToolCallOwnedView(::buffa::OwnedView>); -impl FailToolCallOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FailToolCallOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FailToolCallOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::FailToolCall, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FailToolCallOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`FailToolCallView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &FailToolCallView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::FailToolCall { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Field 3: `tool_execution_id` - #[must_use] - pub fn tool_execution_id(&self) -> &'_ str { - self.0.reborrow().tool_execution_id - } - /// Field 4: `error` - #[must_use] - pub fn error(&self) -> &'_ str { - self.0.reborrow().error - } - /// Field 5: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// Field 6: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for FailToolCallOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - FailToolCallOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: FailToolCallOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for FailToolCallOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::FailToolCall { - type View<'a> = FailToolCallView<'a>; - type ViewHandle = FailToolCallOwnedView; -} -impl ::serde::Serialize for FailToolCallOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_tool_call.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_tool_call.rs deleted file mode 100644 index e4f296286..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fail_tool_call.rs +++ /dev/null @@ -1,203 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/fail_tool_call.proto - -/// FailToolCall settles a call with an error, recording \[ToolCallFailed\]. It is -/// how a reconciler rejects a call it found interrupted, with reason -/// TOOL_CALL_FAILURE_REASON_INTERRUPTED. -/// -/// Write precondition Any: first-terminal-outcome-wins against CompleteToolCall, -/// keyed on tool_execution_id. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct FailToolCall { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Field 3: `tool_execution_id` - #[serde( - rename = "toolExecutionId", - alias = "tool_execution_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_execution_id: ::buffa::alloc::string::String, - /// Field 4: `error` - #[serde(rename = "error", with = "::buffa::json_helpers::proto_string")] - pub error: ::buffa::alloc::string::String, - /// Field 5: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// Field 6: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for FailToolCall { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("FailToolCall") - .field("session_id", &self.session_id) - .field("tool_call_id", &self.tool_call_id) - .field("tool_execution_id", &self.tool_execution_id) - .field("error", &self.error) - .field("reason", &self.reason) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl FailToolCall { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.FailToolCall"; -} -::buffa::impl_default_instance!(FailToolCall); -impl ::buffa::MessageName for FailToolCall { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "FailToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.FailToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.FailToolCall"; -} -impl ::buffa::Message for FailToolCall { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.error) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.error, buf); - ::buffa::types::put_int32_field(5u32, self.reason.to_i32(), buf); - ::buffa::types::put_string_field(6u32, &self.turn_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_execution_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.error, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.tool_call_id.clear(); - self.tool_execution_id.clear(); - self.error.clear(); - self.reason = ::buffa::EnumValue::from(0); - self.turn_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for FailToolCall { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __FAIL_TOOL_CALL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.FailToolCall", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.file_change.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.file_change.rs deleted file mode 100644 index e43f95168..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.file_change.rs +++ /dev/null @@ -1,190 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/file_change.proto - -/// FileChangeKind classifies a recorded file change. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum FileChangeKind { - FILE_CHANGE_KIND_UNSPECIFIED = 0i32, - FILE_CHANGE_KIND_CREATED = 1i32, - FILE_CHANGE_KIND_MODIFIED = 2i32, - FILE_CHANGE_KIND_DELETED = 3i32, - FILE_CHANGE_KIND_RENAMED = 4i32, - /// Content duplicated from another path, which still exists. Recorded instead - /// of FILE_CHANGE_KIND_CREATED rather than alongside it, so the destination has - /// exactly one kind and two facts about the same change cannot disagree. The - /// source file did not change and produces no FileChanged of its own. - FILE_CHANGE_KIND_COPIED = 5i32, -} -impl FileChangeKind { - ///Idiomatic alias for [`Self::FILE_CHANGE_KIND_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::FILE_CHANGE_KIND_UNSPECIFIED; - ///Idiomatic alias for [`Self::FILE_CHANGE_KIND_CREATED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Created: Self = Self::FILE_CHANGE_KIND_CREATED; - ///Idiomatic alias for [`Self::FILE_CHANGE_KIND_MODIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Modified: Self = Self::FILE_CHANGE_KIND_MODIFIED; - ///Idiomatic alias for [`Self::FILE_CHANGE_KIND_DELETED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Deleted: Self = Self::FILE_CHANGE_KIND_DELETED; - ///Idiomatic alias for [`Self::FILE_CHANGE_KIND_RENAMED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Renamed: Self = Self::FILE_CHANGE_KIND_RENAMED; - ///Idiomatic alias for [`Self::FILE_CHANGE_KIND_COPIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Copied: Self = Self::FILE_CHANGE_KIND_COPIED; -} -impl ::core::default::Default for FileChangeKind { - fn default() -> Self { - Self::FILE_CHANGE_KIND_UNSPECIFIED - } -} -impl ::serde::Serialize for FileChangeKind { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for FileChangeKind { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = FileChangeKind; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(FileChangeKind) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for FileChangeKind { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for FileChangeKind { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::FILE_CHANGE_KIND_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::FILE_CHANGE_KIND_CREATED), - 2i32 => ::core::option::Option::Some(Self::FILE_CHANGE_KIND_MODIFIED), - 3i32 => ::core::option::Option::Some(Self::FILE_CHANGE_KIND_DELETED), - 4i32 => ::core::option::Option::Some(Self::FILE_CHANGE_KIND_RENAMED), - 5i32 => ::core::option::Option::Some(Self::FILE_CHANGE_KIND_COPIED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::FILE_CHANGE_KIND_UNSPECIFIED => "FILE_CHANGE_KIND_UNSPECIFIED", - Self::FILE_CHANGE_KIND_CREATED => "FILE_CHANGE_KIND_CREATED", - Self::FILE_CHANGE_KIND_MODIFIED => "FILE_CHANGE_KIND_MODIFIED", - Self::FILE_CHANGE_KIND_DELETED => "FILE_CHANGE_KIND_DELETED", - Self::FILE_CHANGE_KIND_RENAMED => "FILE_CHANGE_KIND_RENAMED", - Self::FILE_CHANGE_KIND_COPIED => "FILE_CHANGE_KIND_COPIED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "FILE_CHANGE_KIND_UNSPECIFIED" => { - ::core::option::Option::Some(Self::FILE_CHANGE_KIND_UNSPECIFIED) - } - "FILE_CHANGE_KIND_CREATED" => { - ::core::option::Option::Some(Self::FILE_CHANGE_KIND_CREATED) - } - "FILE_CHANGE_KIND_MODIFIED" => { - ::core::option::Option::Some(Self::FILE_CHANGE_KIND_MODIFIED) - } - "FILE_CHANGE_KIND_DELETED" => { - ::core::option::Option::Some(Self::FILE_CHANGE_KIND_DELETED) - } - "FILE_CHANGE_KIND_RENAMED" => { - ::core::option::Option::Some(Self::FILE_CHANGE_KIND_RENAMED) - } - "FILE_CHANGE_KIND_COPIED" => { - ::core::option::Option::Some(Self::FILE_CHANGE_KIND_COPIED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::FILE_CHANGE_KIND_UNSPECIFIED, - Self::FILE_CHANGE_KIND_CREATED, - Self::FILE_CHANGE_KIND_MODIFIED, - Self::FILE_CHANGE_KIND_DELETED, - Self::FILE_CHANGE_KIND_RENAMED, - Self::FILE_CHANGE_KIND_COPIED, - ] - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.file_changed.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.file_changed.__view.rs deleted file mode 100644 index 359d141db..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.file_changed.__view.rs +++ /dev/null @@ -1,710 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/file_changed.proto - -/// FileChanged records that a file changed, in arrival order. It is a commuting -/// happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -/// -/// Every recorded change is attributed to the tool call that caused it. A change -/// with no proximate call is not a FileChanged at all: it surfaces as a -/// ResourceObservation whose digest differs from the last one recorded for that -/// resource, which is the signal that something outside the session moved -/// underneath it, and which must not be attributed to the session's own work. -#[derive(Clone, Debug, Default)] -pub struct FileChangedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Workspace-relative path to the changed file (forward slashes, no leading - /// slash). A projection joins this to ResourceObservation.uri by resolving - /// workspace.uri + "/" + path against the session's WorkspaceRef.uri - /// (ADR#0035): that is how it tells whether a later digest change for the - /// same resource was session-authored. A resource with no workspace path -- - /// a fetched URL, an MCP resource -- is only ever a ResourceObservation, - /// with no FileChanged to join against. - /// - /// Field 2: `path` - pub path: &'a str, - /// Field 3: `change_kind` - pub change_kind: ::buffa::EnumValue, - /// Where a renamed file used to be, in the same workspace-relative form as - /// path. Rename only: a copy sets copied_from instead, because a previous path - /// asserts the file is no longer there. - /// - /// Field 4: `previous_path` - pub previous_path: ::core::option::Option<&'a str>, - /// Claim-check to the file's content before the change; unset for a create or - /// when content was not captured. Recorded because our checkpoints are opaque, - /// so "what changed" is not re-derivable by diffing them after the fact. - /// - /// Field 5: `before_ref` - pub before_ref: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactRefView<'a>, - >, - /// Claim-check to the file's content after the change; unset for a delete or - /// when content was not captured. - /// - /// Field 6: `after_ref` - pub after_ref: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactRefView<'a>, - >, - /// The tool call that caused the change, joining to ToolCallCompleted. Without - /// it, "which call touched this file" is only answerable by correlating - /// adjacency in fold order, which concurrent Any-precondition appends make - /// unsound. - /// - /// Field 7: `tool_call_id` - pub tool_call_id: &'a str, - /// Turn the causing call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 8: `turn_id` - pub turn_id: &'a str, - /// Precomputed line counts and rendered diff; unset when no diff was computed. - /// - /// Field 9: `diff` - pub diff: ::buffa::MessageFieldView< - super::super::__buffa::view::DiffSummaryView<'a>, - >, - /// Where the content came from, set only for FILE_CHANGE_KIND_COPIED. - /// - /// Field 10: `copied_from` - pub copied_from: ::buffa::MessageFieldView< - super::super::__buffa::view::CopySourceView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> FileChangedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `path` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_path(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `change_kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_change_kind(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for FileChangedView<'a> { - type Owned = super::super::FileChanged; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.path = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.change_kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.previous_path = Some(::buffa::types::borrow_str(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.before_ref.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.before_ref = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.after_ref.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.after_ref = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.diff.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.diff = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.copied_from.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.copied_from = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::FileChanged { - session_id: self.session_id.to_string(), - path: self.path.to_string(), - change_kind: self.change_kind, - previous_path: self.previous_path.map(|s| s.to_string()), - before_ref: match self.before_ref.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - after_ref: match self.after_ref.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - tool_call_id: self.tool_call_id.to_string(), - turn_id: self.turn_id.to_string(), - diff: match self.diff.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::DiffSummary, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - copied_from: match self.copied_from.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CopySource, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for FileChangedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.path) as u64; - { - let val = self.change_kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.previous_path { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.before_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.before_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.after_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.after_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if self.diff.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.diff.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.copied_from.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.copied_from.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.path, buf); - ::buffa::types::put_int32_field(3u32, self.change_kind.to_i32(), buf); - if let Some(ref v) = self.previous_path { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.before_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.before_ref.write_to(__cache, buf); - } - if self.after_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.after_ref.write_to(__cache, buf); - } - ::buffa::types::put_string_field(7u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(8u32, &self.turn_id, buf); - if self.diff.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.diff.write_to(__cache, buf); - } - if self.copied_from.is_set() { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - self.copied_from.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for FileChangedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("path", self.path)?; - } - { - __map.serialize_entry("changeKind", &self.change_kind)?; - } - if let ::core::option::Option::Some(__v) = self.previous_path { - __map.serialize_entry("previousPath", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.before_ref.as_option() { - __map.serialize_entry("beforeRef", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.after_ref.as_option() { - __map.serialize_entry("afterRef", __v)?; - } - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.diff.as_option() { - __map.serialize_entry("diff", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.copied_from.as_option() { - __map.serialize_entry("copiedFrom", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for FileChangedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "FileChanged"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.FileChanged"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.FileChanged"; -} -::buffa::impl_default_view_instance!(FileChangedView); -::buffa::impl_view_reborrow!(FileChangedView); -/** Self-contained, `'static` owned view of a `FileChanged` message. - - Wraps [`::buffa::OwnedView`]`<`[`FileChangedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`FileChangedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct FileChangedOwnedView(::buffa::OwnedView>); -impl FileChangedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FileChangedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FileChangedOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::FileChanged, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - FileChangedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`FileChangedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &FileChangedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::FileChanged { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Workspace-relative path to the changed file (forward slashes, no leading - /// slash). A projection joins this to ResourceObservation.uri by resolving - /// workspace.uri + "/" + path against the session's WorkspaceRef.uri - /// (ADR#0035): that is how it tells whether a later digest change for the - /// same resource was session-authored. A resource with no workspace path -- - /// a fetched URL, an MCP resource -- is only ever a ResourceObservation, - /// with no FileChanged to join against. - /// - /// Field 2: `path` - #[must_use] - pub fn path(&self) -> &'_ str { - self.0.reborrow().path - } - /// Field 3: `change_kind` - #[must_use] - pub fn change_kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().change_kind - } - /// Where a renamed file used to be, in the same workspace-relative form as - /// path. Rename only: a copy sets copied_from instead, because a previous path - /// asserts the file is no longer there. - /// - /// Field 4: `previous_path` - #[must_use] - pub fn previous_path(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().previous_path - } - /// Claim-check to the file's content before the change; unset for a create or - /// when content was not captured. Recorded because our checkpoints are opaque, - /// so "what changed" is not re-derivable by diffing them after the fact. - /// - /// Field 5: `before_ref` - #[must_use] - pub fn before_ref( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().before_ref - } - /// Claim-check to the file's content after the change; unset for a delete or - /// when content was not captured. - /// - /// Field 6: `after_ref` - #[must_use] - pub fn after_ref( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().after_ref - } - /// The tool call that caused the change, joining to ToolCallCompleted. Without - /// it, "which call touched this file" is only answerable by correlating - /// adjacency in fold order, which concurrent Any-precondition appends make - /// unsound. - /// - /// Field 7: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Turn the causing call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 8: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } - /// Precomputed line counts and rendered diff; unset when no diff was computed. - /// - /// Field 9: `diff` - #[must_use] - pub fn diff( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().diff - } - /// Where the content came from, set only for FILE_CHANGE_KIND_COPIED. - /// - /// Field 10: `copied_from` - #[must_use] - pub fn copied_from( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().copied_from - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for FileChangedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - FileChangedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: FileChangedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for FileChangedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::FileChanged { - type View<'a> = FileChangedView<'a>; - type ViewHandle = FileChangedOwnedView; -} -impl ::serde::Serialize for FileChangedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.file_changed.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.file_changed.rs deleted file mode 100644 index acd37f628..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.file_changed.rs +++ /dev/null @@ -1,402 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/file_changed.proto - -/// FileChanged records that a file changed, in arrival order. It is a commuting -/// happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -/// -/// Every recorded change is attributed to the tool call that caused it. A change -/// with no proximate call is not a FileChanged at all: it surfaces as a -/// ResourceObservation whose digest differs from the last one recorded for that -/// resource, which is the signal that something outside the session moved -/// underneath it, and which must not be attributed to the session's own work. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct FileChanged { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Workspace-relative path to the changed file (forward slashes, no leading - /// slash). A projection joins this to ResourceObservation.uri by resolving - /// workspace.uri + "/" + path against the session's WorkspaceRef.uri - /// (ADR#0035): that is how it tells whether a later digest change for the - /// same resource was session-authored. A resource with no workspace path -- - /// a fetched URL, an MCP resource -- is only ever a ResourceObservation, - /// with no FileChanged to join against. - /// - /// Field 2: `path` - #[serde(rename = "path", with = "::buffa::json_helpers::proto_string")] - pub path: ::buffa::alloc::string::String, - /// Field 3: `change_kind` - #[serde( - rename = "changeKind", - alias = "change_kind", - with = "::buffa::json_helpers::proto_enum" - )] - pub change_kind: ::buffa::EnumValue, - /// Where a renamed file used to be, in the same workspace-relative form as - /// path. Rename only: a copy sets copied_from instead, because a previous path - /// asserts the file is no longer there. - /// - /// Field 4: `previous_path` - #[serde( - rename = "previousPath", - alias = "previous_path", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub previous_path: ::core::option::Option<::buffa::alloc::string::String>, - /// Claim-check to the file's content before the change; unset for a create or - /// when content was not captured. Recorded because our checkpoints are opaque, - /// so "what changed" is not re-derivable by diffing them after the fact. - /// - /// Field 5: `before_ref` - #[serde( - rename = "beforeRef", - alias = "before_ref", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub before_ref: ::buffa::MessageField>, - /// Claim-check to the file's content after the change; unset for a delete or - /// when content was not captured. - /// - /// Field 6: `after_ref` - #[serde( - rename = "afterRef", - alias = "after_ref", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub after_ref: ::buffa::MessageField>, - /// The tool call that caused the change, joining to ToolCallCompleted. Without - /// it, "which call touched this file" is only answerable by correlating - /// adjacency in fold order, which concurrent Any-precondition appends make - /// unsound. - /// - /// Field 7: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Turn the causing call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 8: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, - /// Precomputed line counts and rendered diff; unset when no diff was computed. - /// - /// Field 9: `diff` - #[serde( - rename = "diff", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub diff: ::buffa::MessageField>, - /// Where the content came from, set only for FILE_CHANGE_KIND_COPIED. - /// - /// Field 10: `copied_from` - #[serde( - rename = "copiedFrom", - alias = "copied_from", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub copied_from: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for FileChanged { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("FileChanged") - .field("session_id", &self.session_id) - .field("path", &self.path) - .field("change_kind", &self.change_kind) - .field("previous_path", &self.previous_path) - .field("before_ref", &self.before_ref) - .field("after_ref", &self.after_ref) - .field("tool_call_id", &self.tool_call_id) - .field("turn_id", &self.turn_id) - .field("diff", &self.diff) - .field("copied_from", &self.copied_from) - .finish() - } -} -impl FileChanged { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.FileChanged"; -} -impl FileChanged { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::previous_path`] to `Some(value)`, consuming and returning `self`. - pub fn with_previous_path( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.previous_path = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(FileChanged); -impl ::buffa::MessageName for FileChanged { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "FileChanged"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.FileChanged"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.FileChanged"; -} -impl ::buffa::Message for FileChanged { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.path) as u64; - { - let val = self.change_kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.previous_path { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.before_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.before_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.after_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.after_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if self.diff.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.diff.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.copied_from.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.copied_from.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.path, buf); - ::buffa::types::put_int32_field(3u32, self.change_kind.to_i32(), buf); - if let Some(ref v) = self.previous_path { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.before_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.before_ref.write_to(__cache, buf); - } - if self.after_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.after_ref.write_to(__cache, buf); - } - ::buffa::types::put_string_field(7u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(8u32, &self.turn_id, buf); - if self.diff.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.diff.write_to(__cache, buf); - } - if self.copied_from.is_set() { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - self.copied_from.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.path, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.change_kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .previous_path - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.before_ref.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.after_ref.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.diff.get_or_insert_default(), - buf, - ctx, - )?; - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.copied_from.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.path.clear(); - self.change_kind = ::buffa::EnumValue::from(0); - self.previous_path = ::core::option::Option::None; - self.before_ref = ::buffa::MessageField::none(); - self.after_ref = ::buffa::MessageField::none(); - self.tool_call_id.clear(); - self.turn_id.clear(); - self.diff = ::buffa::MessageField::none(); - self.copied_from = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for FileChanged { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __FILE_CHANGED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.FileChanged", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fork_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fork_session.__view.rs deleted file mode 100644 index 50fabb757..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fork_session.__view.rs +++ /dev/null @@ -1,545 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/fork_session.proto - -/// ForkSession opens a child stream that inherits a prefix of another session's -/// context, recording \[SessionStarted, SessionForked\] as one batch. -/// -/// Write precondition NoStream on the new stream. The source's existence is -/// checked at the command boundary, not by the fold: the source is a different -/// aggregate and this decider never reads it. The plan and workspace are carried -/// rather than inherited for the same reason. -#[derive(Clone, Debug, Default)] -pub struct ForkSessionView<'a> { - /// The new session's own id. - /// - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `execution_plan` - pub execution_plan: ::buffa::MessageFieldView< - super::super::__buffa::view::StoredSessionExecutionPlanView<'a>, - >, - /// Field 3: `workspace` - pub workspace: ::buffa::MessageFieldView< - super::super::__buffa::view::WorkspaceRefView<'a>, - >, - /// Field 4: `source_session_id` - pub source_session_id: &'a str, - /// The source's own ordinal the inherited prefix ends at. - /// - /// Field 5: `context_prefix_boundary` - pub context_prefix_boundary: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 6: `reason` - pub reason: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ForkSessionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `execution_plan` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_execution_plan(&self) -> bool { - self.execution_plan.is_set() - } - /**Whether required field `workspace` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_workspace(&self) -> bool { - self.workspace.is_set() - } - /**Whether required field `source_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `context_prefix_boundary` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_context_prefix_boundary(&self) -> bool { - self.context_prefix_boundary.is_set() - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ForkSessionView<'a> { - type Owned = super::super::ForkSession; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.execution_plan.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.execution_plan = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.workspace.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.workspace = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.context_prefix_boundary.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.context_prefix_boundary = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ForkSession { - session_id: self.session_id.to_string(), - execution_plan: match self.execution_plan.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::StoredSessionExecutionPlan, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - workspace: match self.workspace.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::WorkspaceRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - source_session_id: self.source_session_id.to_string(), - context_prefix_boundary: match self.context_prefix_boundary.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - reason: self.reason, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ForkSessionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.execution_plan.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.execution_plan.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.workspace.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.workspace.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.context_prefix_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.context_prefix_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.execution_plan.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.execution_plan.write_to(__cache, buf); - } - if self.workspace.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.workspace.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.source_session_id, buf); - if self.context_prefix_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.context_prefix_boundary.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(6u32, self.reason.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ForkSessionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.execution_plan.as_option() { - __map.serialize_entry("executionPlan", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.workspace.as_option() { - __map.serialize_entry("workspace", __v)?; - } - } - { - __map.serialize_entry("sourceSessionId", self.source_session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self - .context_prefix_boundary - .as_option() - { - __map.serialize_entry("contextPrefixBoundary", __v)?; - } - } - { - __map.serialize_entry("reason", &self.reason)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ForkSessionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ForkSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ForkSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ForkSession"; -} -::buffa::impl_default_view_instance!(ForkSessionView); -::buffa::impl_view_reborrow!(ForkSessionView); -/** Self-contained, `'static` owned view of a `ForkSession` message. - - Wraps [`::buffa::OwnedView`]`<`[`ForkSessionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ForkSessionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ForkSessionOwnedView(::buffa::OwnedView>); -impl ForkSessionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ForkSessionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ForkSessionOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ForkSession, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ForkSessionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ForkSessionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ForkSessionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ForkSession { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The new session's own id. - /// - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `execution_plan` - #[must_use] - pub fn execution_plan( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::StoredSessionExecutionPlanView<'_>, - > { - &self.0.reborrow().execution_plan - } - /// Field 3: `workspace` - #[must_use] - pub fn workspace( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().workspace - } - /// Field 4: `source_session_id` - #[must_use] - pub fn source_session_id(&self) -> &'_ str { - self.0.reborrow().source_session_id - } - /// The source's own ordinal the inherited prefix ends at. - /// - /// Field 5: `context_prefix_boundary` - #[must_use] - pub fn context_prefix_boundary( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().context_prefix_boundary - } - /// Field 6: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ForkSessionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ForkSessionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ForkSessionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ForkSessionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ForkSession { - type View<'a> = ForkSessionView<'a>; - type ViewHandle = ForkSessionOwnedView; -} -impl ::serde::Serialize for ForkSessionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fork_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fork_session.rs deleted file mode 100644 index a342a5adb..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.fork_session.rs +++ /dev/null @@ -1,260 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/fork_session.proto - -/// ForkSession opens a child stream that inherits a prefix of another session's -/// context, recording \[SessionStarted, SessionForked\] as one batch. -/// -/// Write precondition NoStream on the new stream. The source's existence is -/// checked at the command boundary, not by the fold: the source is a different -/// aggregate and this decider never reads it. The plan and workspace are carried -/// rather than inherited for the same reason. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ForkSession { - /// The new session's own id. - /// - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `execution_plan` - #[serde(rename = "executionPlan", alias = "execution_plan")] - pub execution_plan: ::buffa::MessageField< - StoredSessionExecutionPlan, - ::buffa::Inline, - >, - /// Field 3: `workspace` - #[serde(rename = "workspace")] - pub workspace: ::buffa::MessageField>, - /// Field 4: `source_session_id` - #[serde( - rename = "sourceSessionId", - alias = "source_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub source_session_id: ::buffa::alloc::string::String, - /// The source's own ordinal the inherited prefix ends at. - /// - /// Field 5: `context_prefix_boundary` - #[serde(rename = "contextPrefixBoundary", alias = "context_prefix_boundary")] - pub context_prefix_boundary: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Field 6: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for ForkSession { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ForkSession") - .field("session_id", &self.session_id) - .field("execution_plan", &self.execution_plan) - .field("workspace", &self.workspace) - .field("source_session_id", &self.source_session_id) - .field("context_prefix_boundary", &self.context_prefix_boundary) - .field("reason", &self.reason) - .finish() - } -} -impl ForkSession { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ForkSession"; -} -::buffa::impl_default_instance!(ForkSession); -impl ::buffa::MessageName for ForkSession { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ForkSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ForkSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ForkSession"; -} -impl ::buffa::Message for ForkSession { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.execution_plan.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.execution_plan.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.workspace.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.workspace.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.context_prefix_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.context_prefix_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.execution_plan.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.execution_plan.write_to(__cache, buf); - } - if self.workspace.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.workspace.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.source_session_id, buf); - if self.context_prefix_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.context_prefix_boundary.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(6u32, self.reason.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.execution_plan.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.workspace.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.source_session_id, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.context_prefix_boundary.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.execution_plan = ::buffa::MessageField::none(); - self.workspace = ::buffa::MessageField::none(); - self.source_session_id.clear(); - self.context_prefix_boundary = ::buffa::MessageField::none(); - self.reason = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ForkSession { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __FORK_SESSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ForkSession", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.hide_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.hide_session.__view.rs deleted file mode 100644 index f67cccebd..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.hide_session.__view.rs +++ /dev/null @@ -1,287 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/hide_session.proto - -/// HideSession seals a session as hidden, recording \[SessionHidden\]. Hiding is a -/// terminal marker, not a deletion: no bytes are removed (ADR#0035 facet 5). -/// -/// Write precondition At. -#[derive(Clone, Debug, Default)] -pub struct HideSessionView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `reason` - pub reason: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> HideSessionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for HideSessionView<'a> { - type Owned = super::super::HideSession; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::HideSession { - session_id: self.session_id.to_string(), - reason: self.reason, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for HideSessionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.reason.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for HideSessionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for HideSessionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "HideSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.HideSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.HideSession"; -} -::buffa::impl_default_view_instance!(HideSessionView); -::buffa::impl_view_reborrow!(HideSessionView); -/** Self-contained, `'static` owned view of a `HideSession` message. - - Wraps [`::buffa::OwnedView`]`<`[`HideSessionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`HideSessionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct HideSessionOwnedView(::buffa::OwnedView>); -impl HideSessionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - HideSessionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - HideSessionOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::HideSession, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - HideSessionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`HideSessionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &HideSessionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::HideSession { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for HideSessionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - HideSessionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: HideSessionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for HideSessionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::HideSession { - type View<'a> = HideSessionView<'a>; - type ViewHandle = HideSessionOwnedView; -} -impl ::serde::Serialize for HideSessionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.hide_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.hide_session.rs deleted file mode 100644 index 4bce8c956..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.hide_session.rs +++ /dev/null @@ -1,132 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/hide_session.proto - -/// HideSession seals a session as hidden, recording \[SessionHidden\]. Hiding is a -/// terminal marker, not a deletion: no bytes are removed (ADR#0035 facet 5). -/// -/// Write precondition At. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct HideSession { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for HideSession { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("HideSession") - .field("session_id", &self.session_id) - .field("reason", &self.reason) - .finish() - } -} -impl HideSession { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.HideSession"; -} -::buffa::impl_default_instance!(HideSession); -impl ::buffa::MessageName for HideSession { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "HideSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.HideSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.HideSession"; -} -impl ::buffa::Message for HideSession { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.reason.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.reason = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for HideSession { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __HIDE_SESSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.HideSession", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.mark_execution_attempt_ready.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.mark_execution_attempt_ready.__view.rs deleted file mode 100644 index e63a0f550..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.mark_execution_attempt_ready.__view.rs +++ /dev/null @@ -1,471 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/mark_execution_attempt_ready.proto - -/// MarkExecutionAttemptReady publishes an attempt's ready attestation, recording -/// \[ExecutionAttemptReady\]. -/// -/// Write precondition At: Ready only after Started, and for a restore only after -/// verified artifact recovery plus effective-tail replay through the start head. -#[derive(Clone, Debug, Default)] -pub struct MarkExecutionAttemptReadyView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `execution_attempt_id` - pub execution_attempt_id: &'a str, - /// Field 3: `ready_attestation_ref` - pub ready_attestation_ref: &'a str, - /// Field 4: `ready_attestation_digest` - pub ready_attestation_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Field 5: `ready_at` - pub ready_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> MarkExecutionAttemptReadyView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `execution_attempt_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_execution_attempt_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `ready_attestation_ref` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ready_attestation_ref(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `ready_attestation_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ready_attestation_digest(&self) -> bool { - self.ready_attestation_digest.is_set() - } - /**Whether required field `ready_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ready_at(&self) -> bool { - self.ready_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for MarkExecutionAttemptReadyView<'a> { - type Owned = super::super::MarkExecutionAttemptReady; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.execution_attempt_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.ready_attestation_ref = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.ready_attestation_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.ready_attestation_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.ready_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.ready_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::MarkExecutionAttemptReady, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::MarkExecutionAttemptReady, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::MarkExecutionAttemptReady { - session_id: self.session_id.to_string(), - execution_attempt_id: self.execution_attempt_id.to_string(), - ready_attestation_ref: self.ready_attestation_ref.to_string(), - ready_attestation_digest: match self.ready_attestation_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ready_at: match self.ready_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for MarkExecutionAttemptReadyView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.ready_attestation_ref) as u64; - if self.ready_attestation_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ready_attestation_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.ready_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ready_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.execution_attempt_id, buf); - ::buffa::types::put_string_field(3u32, &self.ready_attestation_ref, buf); - if self.ready_attestation_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ready_attestation_digest.write_to(__cache, buf); - } - if self.ready_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ready_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for MarkExecutionAttemptReadyView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("executionAttemptId", self.execution_attempt_id)?; - } - { - __map.serialize_entry("readyAttestationRef", self.ready_attestation_ref)?; - } - { - if let ::core::option::Option::Some(__v) = self - .ready_attestation_digest - .as_option() - { - __map.serialize_entry("readyAttestationDigest", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.ready_at.as_option() { - __map.serialize_entry("readyAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for MarkExecutionAttemptReadyView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "MarkExecutionAttemptReady"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.MarkExecutionAttemptReady"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.MarkExecutionAttemptReady"; -} -::buffa::impl_default_view_instance!(MarkExecutionAttemptReadyView); -::buffa::impl_view_reborrow!(MarkExecutionAttemptReadyView); -/** Self-contained, `'static` owned view of a `MarkExecutionAttemptReady` message. - - Wraps [`::buffa::OwnedView`]`<`[`MarkExecutionAttemptReadyView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`MarkExecutionAttemptReadyView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct MarkExecutionAttemptReadyOwnedView( - ::buffa::OwnedView>, -); -impl MarkExecutionAttemptReadyOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MarkExecutionAttemptReadyOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MarkExecutionAttemptReadyOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::MarkExecutionAttemptReady, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - MarkExecutionAttemptReadyOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`MarkExecutionAttemptReadyView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &MarkExecutionAttemptReadyView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::MarkExecutionAttemptReady { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `execution_attempt_id` - #[must_use] - pub fn execution_attempt_id(&self) -> &'_ str { - self.0.reborrow().execution_attempt_id - } - /// Field 3: `ready_attestation_ref` - #[must_use] - pub fn ready_attestation_ref(&self) -> &'_ str { - self.0.reborrow().ready_attestation_ref - } - /// Field 4: `ready_attestation_digest` - #[must_use] - pub fn ready_attestation_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().ready_attestation_digest - } - /// Field 5: `ready_at` - #[must_use] - pub fn ready_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().ready_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for MarkExecutionAttemptReadyOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - MarkExecutionAttemptReadyOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: MarkExecutionAttemptReadyOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for MarkExecutionAttemptReadyOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::MarkExecutionAttemptReady { - type View<'a> = MarkExecutionAttemptReadyView<'a>; - type ViewHandle = MarkExecutionAttemptReadyOwnedView; -} -impl ::serde::Serialize for MarkExecutionAttemptReadyOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.mark_execution_attempt_ready.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.mark_execution_attempt_ready.rs deleted file mode 100644 index 64b1ae257..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.mark_execution_attempt_ready.rs +++ /dev/null @@ -1,221 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/mark_execution_attempt_ready.proto - -/// MarkExecutionAttemptReady publishes an attempt's ready attestation, recording -/// \[ExecutionAttemptReady\]. -/// -/// Write precondition At: Ready only after Started, and for a restore only after -/// verified artifact recovery plus effective-tail replay through the start head. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct MarkExecutionAttemptReady { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `execution_attempt_id` - #[serde( - rename = "executionAttemptId", - alias = "execution_attempt_id", - with = "::buffa::json_helpers::proto_string" - )] - pub execution_attempt_id: ::buffa::alloc::string::String, - /// Field 3: `ready_attestation_ref` - #[serde( - rename = "readyAttestationRef", - alias = "ready_attestation_ref", - with = "::buffa::json_helpers::proto_string" - )] - pub ready_attestation_ref: ::buffa::alloc::string::String, - /// Field 4: `ready_attestation_digest` - #[serde(rename = "readyAttestationDigest", alias = "ready_attestation_digest")] - pub ready_attestation_digest: ::buffa::MessageField>, - /// Field 5: `ready_at` - #[serde(rename = "readyAt", alias = "ready_at")] - pub ready_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for MarkExecutionAttemptReady { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("MarkExecutionAttemptReady") - .field("session_id", &self.session_id) - .field("execution_attempt_id", &self.execution_attempt_id) - .field("ready_attestation_ref", &self.ready_attestation_ref) - .field("ready_attestation_digest", &self.ready_attestation_digest) - .field("ready_at", &self.ready_at) - .finish() - } -} -impl MarkExecutionAttemptReady { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.MarkExecutionAttemptReady"; -} -::buffa::impl_default_instance!(MarkExecutionAttemptReady); -impl ::buffa::MessageName for MarkExecutionAttemptReady { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "MarkExecutionAttemptReady"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.MarkExecutionAttemptReady"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.MarkExecutionAttemptReady"; -} -impl ::buffa::Message for MarkExecutionAttemptReady { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.ready_attestation_ref) as u64; - if self.ready_attestation_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ready_attestation_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.ready_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ready_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.execution_attempt_id, buf); - ::buffa::types::put_string_field(3u32, &self.ready_attestation_ref, buf); - if self.ready_attestation_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ready_attestation_digest.write_to(__cache, buf); - } - if self.ready_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ready_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.execution_attempt_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.ready_attestation_ref, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.ready_attestation_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.ready_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.execution_attempt_id.clear(); - self.ready_attestation_ref.clear(); - self.ready_attestation_digest = ::buffa::MessageField::none(); - self.ready_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for MarkExecutionAttemptReady { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __MARK_EXECUTION_ATTEMPT_READY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.MarkExecutionAttemptReady", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.message.__oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.message.__oneof.rs deleted file mode 100644 index 16eee5b41..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.message.__oneof.rs +++ /dev/null @@ -1,142 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/message.proto - -pub mod content_block { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, PartialEq, Debug)] - pub enum Kind { - Text(::buffa::alloc::string::String), - ArtifactRef(::buffa::alloc::boxed::Box), - Thinking(::buffa::alloc::boxed::Box), - ToolUse(::buffa::alloc::boxed::Box), - ToolResult(::buffa::alloc::boxed::Box), - RedactedThinking(::buffa::alloc::vec::Vec), - Provider(::buffa::alloc::boxed::Box), - } - impl ::buffa::Oneof for Kind {} - impl From for Kind { - fn from(v: super::super::super::ArtifactRef) -> Self { - Self::ArtifactRef(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ArtifactRef) -> Self { - Self::Some(Kind::from(v)) - } - } - impl From for Kind { - fn from(v: super::super::super::ThinkingBlock) -> Self { - Self::Thinking(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ThinkingBlock) -> Self { - Self::Some(Kind::from(v)) - } - } - impl From for Kind { - fn from(v: super::super::super::ToolUseBlock) -> Self { - Self::ToolUse(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ToolUseBlock) -> Self { - Self::Some(Kind::from(v)) - } - } - impl From for Kind { - fn from(v: super::super::super::ToolResultBlock) -> Self { - Self::ToolResult(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ToolResultBlock) -> Self { - Self::Some(Kind::from(v)) - } - } - impl From for Kind { - fn from(v: super::super::super::ProviderBlock) -> Self { - Self::Provider(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ProviderBlock) -> Self { - Self::Some(Kind::from(v)) - } - } - impl serde::Serialize for Kind { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::Text(v) => { - map.serialize_entry("text", v)?; - } - Self::ArtifactRef(v) => { - map.serialize_entry("artifactRef", v)?; - } - Self::Thinking(v) => { - map.serialize_entry("thinking", v)?; - } - Self::ToolUse(v) => { - map.serialize_entry("toolUse", v)?; - } - Self::ToolResult(v) => { - map.serialize_entry("toolResult", v)?; - } - Self::RedactedThinking(v) => { - map.serialize_entry( - "redactedThinking", - &::buffa::json_helpers::ProtoJson(v), - )?; - } - Self::Provider(v) => { - map.serialize_entry("provider", v)?; - } - } - map.end() - } - } -} -pub mod provider_block { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, PartialEq, Debug)] - pub enum Payload { - Inline(::buffa::alloc::vec::Vec), - Ref(::buffa::alloc::boxed::Box), - } - impl ::buffa::Oneof for Payload {} - impl From for Payload { - fn from(v: super::super::super::ArtifactRef) -> Self { - Self::Ref(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ArtifactRef) -> Self { - Self::Some(Payload::from(v)) - } - } - impl serde::Serialize for Payload { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::Inline(v) => { - map.serialize_entry("inline", &::buffa::json_helpers::ProtoJson(v))?; - } - Self::Ref(v) => { - map.serialize_entry("ref", v)?; - } - } - map.end() - } - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.message.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.message.__view.rs deleted file mode 100644 index 6d0b4584e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.message.__view.rs +++ /dev/null @@ -1,2516 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/message.proto - -/// CanonicalMessage is one conversation message in its normalized, model-agnostic -/// form. It is the durable shape a UserMessageRecorded or AssistantMessageCompleted -/// event carries; streamed token deltas are delivered out of band and never -/// appended per token (ADR#0035 facet 2). -#[derive(Clone, Debug, Default)] -pub struct CanonicalMessageView<'a> { - /// Stable message id. - /// - /// Field 1: `message_id` - pub message_id: &'a str, - /// Conversation role. - /// - /// Field 2: `role` - pub role: ::buffa::EnumValue, - /// Ordered content blocks making up the message. - /// - /// Field 3: `content` - pub content: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::ContentBlockView<'a>, - >, - /// Exact model that produced an assistant message; empty when not applicable. - /// - /// Field 4: `model` - pub model: ::core::option::Option<&'a str>, - /// Token accounting and cost for the message; unset when not applicable. - /// - /// Field 5: `usage` - pub usage: ::buffa::MessageFieldView< - super::super::__buffa::view::TokenUsageView<'a>, - >, - /// Wall-clock instant the message was created: a real external occurrence - /// distinct from envelope append time (D10). - /// - /// Field 6: `created_at` - pub created_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CanonicalMessageView<'a> { - /**Whether required field `message_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `role` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_role(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `created_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_created_at(&self) -> bool { - self.created_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for CanonicalMessageView<'a> { - type Owned = super::super::CanonicalMessage; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.message_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.role = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.model = Some(::buffa::types::borrow_str(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.usage.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.usage = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.created_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.created_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::ContentBlockView, - >(), - )?; - view.content - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::CanonicalMessage { - message_id: self.message_id.to_string(), - role: self.role, - content: self - .content - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - model: self.model.map(|s| s.to_string()), - usage: match self.usage.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::TokenUsage, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - created_at: match self.created_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CanonicalMessageView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - { - let val = self.role.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - for v in &self.content { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.model { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.usage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.usage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.created_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.created_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.message_id, buf); - ::buffa::types::put_int32_field(2u32, self.role.to_i32(), buf); - for v in &self.content { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if let Some(ref v) = self.model { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.usage.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.usage.write_to(__cache, buf); - } - if self.created_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.created_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CanonicalMessageView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("messageId", self.message_id)?; - } - { - __map.serialize_entry("role", &self.role)?; - } - if !self.content.is_empty() { - __map.serialize_entry("content", &*self.content)?; - } - if let ::core::option::Option::Some(__v) = self.model { - __map.serialize_entry("model", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.usage.as_option() { - __map.serialize_entry("usage", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.created_at.as_option() { - __map.serialize_entry("createdAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CanonicalMessageView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CanonicalMessage"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CanonicalMessage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CanonicalMessage"; -} -::buffa::impl_default_view_instance!(CanonicalMessageView); -::buffa::impl_view_reborrow!(CanonicalMessageView); -/** Self-contained, `'static` owned view of a `CanonicalMessage` message. - - Wraps [`::buffa::OwnedView`]`<`[`CanonicalMessageView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CanonicalMessageView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CanonicalMessageOwnedView(::buffa::OwnedView>); -impl CanonicalMessageOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CanonicalMessageOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CanonicalMessageOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::CanonicalMessage, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CanonicalMessageOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`CanonicalMessageView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CanonicalMessageView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::CanonicalMessage { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Stable message id. - /// - /// Field 1: `message_id` - #[must_use] - pub fn message_id(&self) -> &'_ str { - self.0.reborrow().message_id - } - /// Conversation role. - /// - /// Field 2: `role` - #[must_use] - pub fn role(&self) -> ::buffa::EnumValue { - self.0.reborrow().role - } - /// Ordered content blocks making up the message. - /// - /// Field 3: `content` - #[must_use] - pub fn content( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::ContentBlockView<'_>> { - &self.0.reborrow().content - } - /// Exact model that produced an assistant message; empty when not applicable. - /// - /// Field 4: `model` - #[must_use] - pub fn model(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().model - } - /// Token accounting and cost for the message; unset when not applicable. - /// - /// Field 5: `usage` - #[must_use] - pub fn usage( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().usage - } - /// Wall-clock instant the message was created: a real external occurrence - /// distinct from envelope append time (D10). - /// - /// Field 6: `created_at` - #[must_use] - pub fn created_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().created_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for CanonicalMessageOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CanonicalMessageOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: CanonicalMessageOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for CanonicalMessageOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::CanonicalMessage { - type View<'a> = CanonicalMessageView<'a>; - type ViewHandle = CanonicalMessageOwnedView; -} -impl ::serde::Serialize for CanonicalMessageOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ContentBlock is one typed block inside a CanonicalMessage. -#[derive(Clone, Debug, Default)] -pub struct ContentBlockView<'a> { - pub kind: ::core::option::Option< - super::super::__buffa::view::oneof::content_block::Kind<'a>, - >, -} -impl<'a> ::buffa::MessageView<'a> for ContentBlockView<'a> { - type Owned = super::super::ContentBlock; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.kind = Some( - super::super::__buffa::view::oneof::content_block::Kind::Text( - ::buffa::types::borrow_str(&mut cur)?, - ), - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::content_block::Kind::ArtifactRef( - ref mut existing, - ), - ) = view.kind - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.kind = Some( - super::super::__buffa::view::oneof::content_block::Kind::ArtifactRef( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::content_block::Kind::Thinking( - ref mut existing, - ), - ) = view.kind - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.kind = Some( - super::super::__buffa::view::oneof::content_block::Kind::Thinking( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::content_block::Kind::ToolUse( - ref mut existing, - ), - ) = view.kind - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.kind = Some( - super::super::__buffa::view::oneof::content_block::Kind::ToolUse( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::content_block::Kind::ToolResult( - ref mut existing, - ), - ) = view.kind - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.kind = Some( - super::super::__buffa::view::oneof::content_block::Kind::ToolResult( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.kind = Some( - super::super::__buffa::view::oneof::content_block::Kind::RedactedThinking( - ::buffa::types::borrow_bytes(&mut cur)?, - ), - ); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::content_block::Kind::Provider( - ref mut existing, - ), - ) = view.kind - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.kind = Some( - super::super::__buffa::view::oneof::content_block::Kind::Provider( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ContentBlock { - kind: match self.kind.as_ref() { - ::core::option::Option::Some(v) => { - ::core::option::Option::Some( - match v { - super::super::__buffa::view::oneof::content_block::Kind::Text( - v, - ) => { - super::super::__buffa::oneof::content_block::Kind::Text( - v.to_string(), - ) - } - super::super::__buffa::view::oneof::content_block::Kind::ArtifactRef( - v, - ) => { - super::super::__buffa::oneof::content_block::Kind::ArtifactRef( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::content_block::Kind::Thinking( - v, - ) => { - super::super::__buffa::oneof::content_block::Kind::Thinking( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::content_block::Kind::ToolUse( - v, - ) => { - super::super::__buffa::oneof::content_block::Kind::ToolUse( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::content_block::Kind::ToolResult( - v, - ) => { - super::super::__buffa::oneof::content_block::Kind::ToolResult( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::content_block::Kind::RedactedThinking( - v, - ) => { - super::super::__buffa::oneof::content_block::Kind::RedactedThinking( - (v).to_vec(), - ) - } - super::super::__buffa::view::oneof::content_block::Kind::Provider( - v, - ) => { - super::super::__buffa::oneof::content_block::Kind::Provider( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - }, - ) - } - ::core::option::Option::None => ::core::option::Option::None, - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ContentBlockView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let ::core::option::Option::Some(ref v) = self.kind { - match v { - super::super::__buffa::view::oneof::content_block::Kind::Text(x) => { - size += 1u64 + ::buffa::types::string_encoded_len(x) as u64; - } - super::super::__buffa::view::oneof::content_block::Kind::ArtifactRef( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::content_block::Kind::Thinking(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::content_block::Kind::ToolUse(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::content_block::Kind::ToolResult( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::content_block::Kind::RedactedThinking( - x, - ) => { - size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64; - } - super::super::__buffa::view::oneof::content_block::Kind::Provider(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let ::core::option::Option::Some(ref v) = self.kind { - match v { - super::super::__buffa::view::oneof::content_block::Kind::Text(x) => { - ::buffa::types::put_string_field(1u32, x, buf); - } - super::super::__buffa::view::oneof::content_block::Kind::ArtifactRef( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::content_block::Kind::Thinking(x) => { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::content_block::Kind::ToolUse(x) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::content_block::Kind::ToolResult( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::content_block::Kind::RedactedThinking( - x, - ) => { - ::buffa::types::put_shared_bytes_field(6u32, x, buf); - } - super::super::__buffa::view::oneof::content_block::Kind::Provider(x) => { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ContentBlockView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - if let ::core::option::Option::Some(ref __ov) = self.kind { - match __ov { - super::super::__buffa::view::oneof::content_block::Kind::Text(v) => { - __map.serialize_entry("text", v)?; - } - super::super::__buffa::view::oneof::content_block::Kind::ArtifactRef( - v, - ) => { - __map.serialize_entry("artifactRef", v)?; - } - super::super::__buffa::view::oneof::content_block::Kind::Thinking(v) => { - __map.serialize_entry("thinking", v)?; - } - super::super::__buffa::view::oneof::content_block::Kind::ToolUse(v) => { - __map.serialize_entry("toolUse", v)?; - } - super::super::__buffa::view::oneof::content_block::Kind::ToolResult( - v, - ) => { - __map.serialize_entry("toolResult", v)?; - } - super::super::__buffa::view::oneof::content_block::Kind::RedactedThinking( - v, - ) => { - __map - .serialize_entry( - "redactedThinking", - &::buffa::json_helpers::BytesJson(v), - )?; - } - super::super::__buffa::view::oneof::content_block::Kind::Provider(v) => { - __map.serialize_entry("provider", v)?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ContentBlockView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ContentBlock"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ContentBlock"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ContentBlock"; -} -::buffa::impl_default_view_instance!(ContentBlockView); -::buffa::impl_view_reborrow!(ContentBlockView); -/** Self-contained, `'static` owned view of a `ContentBlock` message. - - Wraps [`::buffa::OwnedView`]`<`[`ContentBlockView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ContentBlockView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ContentBlockOwnedView(::buffa::OwnedView>); -impl ContentBlockOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContentBlockOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContentBlockOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ContentBlock, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ContentBlockOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ContentBlockView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ContentBlockView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ContentBlock { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Oneof `kind`. - #[must_use] - pub fn kind( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::content_block::Kind<'_>, - > { - self.0.reborrow().kind.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ContentBlockOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ContentBlockOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ContentBlockOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ContentBlockOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ContentBlock { - type View<'a> = ContentBlockView<'a>; - type ViewHandle = ContentBlockOwnedView; -} -impl ::serde::Serialize for ContentBlockOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ProviderBlock is a content block this package does not model, kept verbatim so -/// a provider that ships a new block type does not force a schema change before a -/// session using it can be recorded or replayed. It is the same concession -/// ThinkingBlock.signature already makes, generalized: the alternative is -/// dropping the block, which silently corrupts replay of the turn that contained -/// it. -/// -/// Write-verbatim, read-never. A projection must never interpret this payload; a -/// block that any reader needs to understand is a block that has earned its own -/// arm in the oneof. Treating this as an extension point for our own data would -/// turn the canonical form back into an untyped provider blob. -#[derive(Clone, Debug, Default)] -pub struct ProviderBlockView<'a> { - /// Provider that emitted the block, for example "anthropic". - /// - /// Field 1: `provider` - pub provider: &'a str, - /// The provider's own discriminator for the block, verbatim. - /// - /// Field 2: `block_type` - pub block_type: &'a str, - pub payload: ::core::option::Option< - super::super::__buffa::view::oneof::provider_block::Payload<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ProviderBlockView<'a> { - /**Whether required field `provider` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_provider(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `block_type` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_block_type(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ProviderBlockView<'a> { - type Owned = super::super::ProviderBlock; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.provider = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.block_type = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.payload = Some( - super::super::__buffa::view::oneof::provider_block::Payload::Inline( - ::buffa::types::borrow_bytes(&mut cur)?, - ), - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::provider_block::Payload::Ref( - ref mut existing, - ), - ) = view.payload - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.payload = Some( - super::super::__buffa::view::oneof::provider_block::Payload::Ref( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ProviderBlock { - provider: self.provider.to_string(), - block_type: self.block_type.to_string(), - payload: match self.payload.as_ref() { - ::core::option::Option::Some(v) => { - ::core::option::Option::Some( - match v { - super::super::__buffa::view::oneof::provider_block::Payload::Inline( - v, - ) => { - super::super::__buffa::oneof::provider_block::Payload::Inline( - (v).to_vec(), - ) - } - super::super::__buffa::view::oneof::provider_block::Payload::Ref( - v, - ) => { - super::super::__buffa::oneof::provider_block::Payload::Ref( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - }, - ) - } - ::core::option::Option::None => ::core::option::Option::None, - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ProviderBlockView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.provider) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.block_type) as u64; - if let ::core::option::Option::Some(ref v) = self.payload { - match v { - super::super::__buffa::view::oneof::provider_block::Payload::Inline( - x, - ) => { - size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64; - } - super::super::__buffa::view::oneof::provider_block::Payload::Ref(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.provider, buf); - ::buffa::types::put_string_field(2u32, &self.block_type, buf); - if let ::core::option::Option::Some(ref v) = self.payload { - match v { - super::super::__buffa::view::oneof::provider_block::Payload::Inline( - x, - ) => { - ::buffa::types::put_shared_bytes_field(3u32, x, buf); - } - super::super::__buffa::view::oneof::provider_block::Payload::Ref(x) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ProviderBlockView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("provider", self.provider)?; - } - { - __map.serialize_entry("blockType", self.block_type)?; - } - if let ::core::option::Option::Some(ref __ov) = self.payload { - match __ov { - super::super::__buffa::view::oneof::provider_block::Payload::Inline( - v, - ) => { - __map - .serialize_entry( - "inline", - &::buffa::json_helpers::BytesJson(v), - )?; - } - super::super::__buffa::view::oneof::provider_block::Payload::Ref(v) => { - __map.serialize_entry("ref", v)?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ProviderBlockView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ProviderBlock"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ProviderBlock"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ProviderBlock"; -} -::buffa::impl_default_view_instance!(ProviderBlockView); -::buffa::impl_view_reborrow!(ProviderBlockView); -/** Self-contained, `'static` owned view of a `ProviderBlock` message. - - Wraps [`::buffa::OwnedView`]`<`[`ProviderBlockView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ProviderBlockView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ProviderBlockOwnedView(::buffa::OwnedView>); -impl ProviderBlockOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProviderBlockOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProviderBlockOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ProviderBlock, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProviderBlockOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ProviderBlockView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ProviderBlockView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ProviderBlock { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Provider that emitted the block, for example "anthropic". - /// - /// Field 1: `provider` - #[must_use] - pub fn provider(&self) -> &'_ str { - self.0.reborrow().provider - } - /// The provider's own discriminator for the block, verbatim. - /// - /// Field 2: `block_type` - #[must_use] - pub fn block_type(&self) -> &'_ str { - self.0.reborrow().block_type - } - /// Oneof `payload`. - #[must_use] - pub fn payload( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::provider_block::Payload<'_>, - > { - self.0.reborrow().payload.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ProviderBlockOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ProviderBlockOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ProviderBlockOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ProviderBlockOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ProviderBlock { - type View<'a> = ProviderBlockView<'a>; - type ViewHandle = ProviderBlockOwnedView; -} -impl ::serde::Serialize for ProviderBlockOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ThinkingBlock is visible model reasoning plus the provider's opaque -/// continuation/verification signature, kept so a thinking-bearing turn can be -/// resumed or forked faithfully. -#[derive(Clone, Debug, Default)] -pub struct ThinkingBlockView<'a> { - /// Field 1: `text` - pub text: &'a str, - /// Provider signature over the reasoning; empty when the provider emits none. - /// - /// Field 2: `signature` - pub signature: ::core::option::Option<&'a [u8]>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ThinkingBlockView<'a> { - /**Whether required field `text` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_text(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ThinkingBlockView<'a> { - type Owned = super::super::ThinkingBlock; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.text = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.signature = Some(::buffa::types::borrow_bytes(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ThinkingBlock { - text: self.text.to_string(), - signature: self.signature.map(|b| (b).to_vec()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ThinkingBlockView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - if let Some(ref v) = self.signature { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.text, buf); - if let Some(ref v) = self.signature { - ::buffa::types::put_shared_bytes_field(2u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ThinkingBlockView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("text", self.text)?; - } - if let ::core::option::Option::Some(__v) = self.signature { - __map.serialize_entry("signature", &::buffa::json_helpers::BytesJson(__v))?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ThinkingBlockView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ThinkingBlock"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ThinkingBlock"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ThinkingBlock"; -} -::buffa::impl_default_view_instance!(ThinkingBlockView); -::buffa::impl_view_reborrow!(ThinkingBlockView); -/** Self-contained, `'static` owned view of a `ThinkingBlock` message. - - Wraps [`::buffa::OwnedView`]`<`[`ThinkingBlockView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ThinkingBlockView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ThinkingBlockOwnedView(::buffa::OwnedView>); -impl ThinkingBlockOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ThinkingBlockOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ThinkingBlockOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ThinkingBlock, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ThinkingBlockOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ThinkingBlockView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ThinkingBlockView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ThinkingBlock { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `text` - #[must_use] - pub fn text(&self) -> &'_ str { - self.0.reborrow().text - } - /// Provider signature over the reasoning; empty when the provider emits none. - /// - /// Field 2: `signature` - #[must_use] - pub fn signature(&self) -> ::core::option::Option<&'_ [u8]> { - self.0.reborrow().signature - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ThinkingBlockOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ThinkingBlockOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ThinkingBlockOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ThinkingBlockOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ThinkingBlock { - type View<'a> = ThinkingBlockView<'a>; - type ViewHandle = ThinkingBlockOwnedView; -} -impl ::serde::Serialize for ThinkingBlockOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ToolUseBlock is a model request to invoke a tool, embedded in message content. -/// It owns the provider-visible transcript form: the exact block the model -/// emitted, required for faithful provider replay, distinct from -/// ToolCallRequested, which owns the execution-request record (what the -/// platform was asked to run). The two join by tool_call_id/id; equality is -/// expected but not structurally required, since normalization may differ, and -/// no atomic ordering is guaranteed between them -- each is a self-contained -/// Any fact (D11). -#[derive(Clone, Debug, Default)] -pub struct ToolUseBlockView<'a> { - /// Field 1: `id` - pub id: &'a str, - /// Field 2: `name` - pub name: &'a str, - /// Tool input arguments as a JSON document. - /// - /// Field 3: `input_json` - pub input_json: &'a str, - /// Parent tool-use id for nested calls; empty when top-level. - /// - /// Field 4: `parent_tool_use_id` - pub parent_tool_use_id: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ToolUseBlockView<'a> { - /**Whether required field `id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `name` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_name(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `input_json` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_input_json(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ToolUseBlockView<'a> { - type Owned = super::super::ToolUseBlock; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.name = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.input_json = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.parent_tool_use_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ToolUseBlock { - id: self.id.to_string(), - name: self.name.to_string(), - input_json: self.input_json.to_string(), - parent_tool_use_id: self.parent_tool_use_id.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ToolUseBlockView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.input_json) as u64; - if let Some(ref v) = self.parent_tool_use_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.id, buf); - ::buffa::types::put_string_field(2u32, &self.name, buf); - ::buffa::types::put_string_field(3u32, &self.input_json, buf); - if let Some(ref v) = self.parent_tool_use_id { - ::buffa::types::put_string_field(4u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ToolUseBlockView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("id", self.id)?; - } - { - __map.serialize_entry("name", self.name)?; - } - { - __map.serialize_entry("inputJson", self.input_json)?; - } - if let ::core::option::Option::Some(__v) = self.parent_tool_use_id { - __map.serialize_entry("parentToolUseId", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ToolUseBlockView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolUseBlock"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolUseBlock"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolUseBlock"; -} -::buffa::impl_default_view_instance!(ToolUseBlockView); -::buffa::impl_view_reborrow!(ToolUseBlockView); -/** Self-contained, `'static` owned view of a `ToolUseBlock` message. - - Wraps [`::buffa::OwnedView`]`<`[`ToolUseBlockView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ToolUseBlockView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ToolUseBlockOwnedView(::buffa::OwnedView>); -impl ToolUseBlockOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolUseBlockOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolUseBlockOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ToolUseBlock, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolUseBlockOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ToolUseBlockView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ToolUseBlockView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ToolUseBlock { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `id` - #[must_use] - pub fn id(&self) -> &'_ str { - self.0.reborrow().id - } - /// Field 2: `name` - #[must_use] - pub fn name(&self) -> &'_ str { - self.0.reborrow().name - } - /// Tool input arguments as a JSON document. - /// - /// Field 3: `input_json` - #[must_use] - pub fn input_json(&self) -> &'_ str { - self.0.reborrow().input_json - } - /// Parent tool-use id for nested calls; empty when top-level. - /// - /// Field 4: `parent_tool_use_id` - #[must_use] - pub fn parent_tool_use_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().parent_tool_use_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ToolUseBlockOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ToolUseBlockOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ToolUseBlockOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ToolUseBlockOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ToolUseBlock { - type View<'a> = ToolUseBlockView<'a>; - type ViewHandle = ToolUseBlockOwnedView; -} -impl ::serde::Serialize for ToolUseBlockOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ToolResultBlock carries a tool result back into message content. It owns -/// the provider-visible transcript form: the exact block the model receives, -/// required for faithful provider replay, distinct from ToolCallCompleted/ -/// ToolCallFailed, which own the execution/audit fold. It joins to its -/// ToolUseBlock by tool_use_id (D11). -#[derive(Clone, Debug, Default)] -pub struct ToolResultBlockView<'a> { - /// Field 1: `tool_use_id` - pub tool_use_id: &'a str, - /// Field 2: `result` - pub result: ::buffa::MessageFieldView< - super::super::__buffa::view::ToolCallResultView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ToolResultBlockView<'a> { - /**Whether required field `tool_use_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_use_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `result` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_result(&self) -> bool { - self.result.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ToolResultBlockView<'a> { - type Owned = super::super::ToolResultBlock; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_use_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.result.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.result = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ToolResultBlock { - tool_use_id: self.tool_use_id.to_string(), - result: match self.result.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ToolCallResult, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ToolResultBlockView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_use_id) as u64; - if self.result.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.result.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.tool_use_id, buf); - if self.result.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.result.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ToolResultBlockView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("toolUseId", self.tool_use_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.result.as_option() { - __map.serialize_entry("result", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ToolResultBlockView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolResultBlock"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolResultBlock"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolResultBlock"; -} -::buffa::impl_default_view_instance!(ToolResultBlockView); -::buffa::impl_view_reborrow!(ToolResultBlockView); -/** Self-contained, `'static` owned view of a `ToolResultBlock` message. - - Wraps [`::buffa::OwnedView`]`<`[`ToolResultBlockView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ToolResultBlockView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ToolResultBlockOwnedView(::buffa::OwnedView>); -impl ToolResultBlockOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolResultBlockOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolResultBlockOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ToolResultBlock, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolResultBlockOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ToolResultBlockView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ToolResultBlockView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ToolResultBlock { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `tool_use_id` - #[must_use] - pub fn tool_use_id(&self) -> &'_ str { - self.0.reborrow().tool_use_id - } - /// Field 2: `result` - #[must_use] - pub fn result( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ToolCallResultView<'_>, - > { - &self.0.reborrow().result - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ToolResultBlockOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ToolResultBlockOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ToolResultBlockOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ToolResultBlockOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ToolResultBlock { - type View<'a> = ToolResultBlockView<'a>; - type ViewHandle = ToolResultBlockOwnedView; -} -impl ::serde::Serialize for ToolResultBlockOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.message.__view_oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.message.__view_oneof.rs deleted file mode 100644 index a226836eb..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.message.__view_oneof.rs +++ /dev/null @@ -1,50 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/message.proto - -pub mod content_block { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Kind<'a> { - Text(&'a str), - ArtifactRef( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ArtifactRefView<'a>, - >, - ), - Thinking( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ThinkingBlockView<'a>, - >, - ), - ToolUse( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ToolUseBlockView<'a>, - >, - ), - ToolResult( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ToolResultBlockView<'a>, - >, - ), - RedactedThinking(&'a [u8]), - Provider( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ProviderBlockView<'a>, - >, - ), - } -} -pub mod provider_block { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Payload<'a> { - Inline(&'a [u8]), - Ref( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ArtifactRefView<'a>, - >, - ), - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.message.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.message.rs deleted file mode 100644 index 94e6785cd..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.message.rs +++ /dev/null @@ -1,1781 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/message.proto - -/// MessageRole is the closed set of conversation roles. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum MessageRole { - MESSAGE_ROLE_UNSPECIFIED = 0i32, - MESSAGE_ROLE_USER = 1i32, - MESSAGE_ROLE_ASSISTANT = 2i32, -} -impl MessageRole { - ///Idiomatic alias for [`Self::MESSAGE_ROLE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::MESSAGE_ROLE_UNSPECIFIED; - ///Idiomatic alias for [`Self::MESSAGE_ROLE_USER`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const User: Self = Self::MESSAGE_ROLE_USER; - ///Idiomatic alias for [`Self::MESSAGE_ROLE_ASSISTANT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Assistant: Self = Self::MESSAGE_ROLE_ASSISTANT; -} -impl ::core::default::Default for MessageRole { - fn default() -> Self { - Self::MESSAGE_ROLE_UNSPECIFIED - } -} -impl ::serde::Serialize for MessageRole { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for MessageRole { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = MessageRole; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(MessageRole)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for MessageRole { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for MessageRole { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::MESSAGE_ROLE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::MESSAGE_ROLE_USER), - 2i32 => ::core::option::Option::Some(Self::MESSAGE_ROLE_ASSISTANT), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::MESSAGE_ROLE_UNSPECIFIED => "MESSAGE_ROLE_UNSPECIFIED", - Self::MESSAGE_ROLE_USER => "MESSAGE_ROLE_USER", - Self::MESSAGE_ROLE_ASSISTANT => "MESSAGE_ROLE_ASSISTANT", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "MESSAGE_ROLE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::MESSAGE_ROLE_UNSPECIFIED) - } - "MESSAGE_ROLE_USER" => ::core::option::Option::Some(Self::MESSAGE_ROLE_USER), - "MESSAGE_ROLE_ASSISTANT" => { - ::core::option::Option::Some(Self::MESSAGE_ROLE_ASSISTANT) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::MESSAGE_ROLE_UNSPECIFIED, - Self::MESSAGE_ROLE_USER, - Self::MESSAGE_ROLE_ASSISTANT, - ] - } -} -/// CanonicalMessage is one conversation message in its normalized, model-agnostic -/// form. It is the durable shape a UserMessageRecorded or AssistantMessageCompleted -/// event carries; streamed token deltas are delivered out of band and never -/// appended per token (ADR#0035 facet 2). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct CanonicalMessage { - /// Stable message id. - /// - /// Field 1: `message_id` - #[serde( - rename = "messageId", - alias = "message_id", - with = "::buffa::json_helpers::proto_string" - )] - pub message_id: ::buffa::alloc::string::String, - /// Conversation role. - /// - /// Field 2: `role` - #[serde(rename = "role", with = "::buffa::json_helpers::proto_enum")] - pub role: ::buffa::EnumValue, - /// Ordered content blocks making up the message. - /// - /// Field 3: `content` - #[serde( - rename = "content", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub content: ::buffa::alloc::vec::Vec, - /// Exact model that produced an assistant message; empty when not applicable. - /// - /// Field 4: `model` - #[serde(rename = "model", skip_serializing_if = "::core::option::Option::is_none")] - pub model: ::core::option::Option<::buffa::alloc::string::String>, - /// Token accounting and cost for the message; unset when not applicable. - /// - /// Field 5: `usage` - #[serde( - rename = "usage", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub usage: ::buffa::MessageField>, - /// Wall-clock instant the message was created: a real external occurrence - /// distinct from envelope append time (D10). - /// - /// Field 6: `created_at` - #[serde(rename = "createdAt", alias = "created_at")] - pub created_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for CanonicalMessage { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("CanonicalMessage") - .field("message_id", &self.message_id) - .field("role", &self.role) - .field("content", &self.content) - .field("model", &self.model) - .field("usage", &self.usage) - .field("created_at", &self.created_at) - .finish() - } -} -impl CanonicalMessage { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CanonicalMessage"; -} -impl CanonicalMessage { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::model`] to `Some(value)`, consuming and returning `self`. - pub fn with_model( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.model = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(CanonicalMessage); -impl ::buffa::MessageName for CanonicalMessage { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "CanonicalMessage"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.CanonicalMessage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.CanonicalMessage"; -} -impl ::buffa::Message for CanonicalMessage { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - { - let val = self.role.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - for v in &self.content { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.model { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.usage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.usage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.created_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.created_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.message_id, buf); - ::buffa::types::put_int32_field(2u32, self.role.to_i32(), buf); - for v in &self.content { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if let Some(ref v) = self.model { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.usage.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.usage.write_to(__cache, buf); - } - if self.created_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.created_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.message_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.role = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.content.push(elem); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.model.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.usage.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.created_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.message_id.clear(); - self.role = ::buffa::EnumValue::from(0); - self.content.clear(); - self.model = ::core::option::Option::None; - self.usage = ::buffa::MessageField::none(); - self.created_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for CanonicalMessage { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CANONICAL_MESSAGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.CanonicalMessage", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ContentBlock is one typed block inside a CanonicalMessage. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct ContentBlock { - #[serde(flatten)] - pub kind: ::core::option::Option<__buffa::oneof::content_block::Kind>, -} -impl ::core::fmt::Debug for ContentBlock { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ContentBlock").field("kind", &self.kind).finish() - } -} -impl ContentBlock { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ContentBlock"; -} -::buffa::impl_default_instance!(ContentBlock); -impl ::buffa::MessageName for ContentBlock { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ContentBlock"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ContentBlock"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ContentBlock"; -} -impl ::buffa::Message for ContentBlock { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let ::core::option::Option::Some(ref v) = self.kind { - match v { - __buffa::oneof::content_block::Kind::Text(x) => { - size += 1u64 + ::buffa::types::string_encoded_len(x) as u64; - } - __buffa::oneof::content_block::Kind::ArtifactRef(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::content_block::Kind::Thinking(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::content_block::Kind::ToolUse(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::content_block::Kind::ToolResult(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::content_block::Kind::RedactedThinking(x) => { - size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64; - } - __buffa::oneof::content_block::Kind::Provider(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let ::core::option::Option::Some(ref v) = self.kind { - match v { - __buffa::oneof::content_block::Kind::Text(x) => { - ::buffa::types::put_string_field(1u32, x, buf); - } - __buffa::oneof::content_block::Kind::ArtifactRef(x) => { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::content_block::Kind::Thinking(x) => { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::content_block::Kind::ToolUse(x) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::content_block::Kind::ToolResult(x) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::content_block::Kind::RedactedThinking(x) => { - ::buffa::types::put_shared_bytes_field(6u32, x, buf); - } - __buffa::oneof::content_block::Kind::Provider(x) => { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - self.kind = ::core::option::Option::Some( - __buffa::oneof::content_block::Kind::Text( - ::buffa::types::decode_string(buf)?, - ), - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::content_block::Kind::ArtifactRef(ref mut existing), - ) = self.kind - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.kind = ::core::option::Option::Some( - __buffa::oneof::content_block::Kind::ArtifactRef( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::content_block::Kind::Thinking(ref mut existing), - ) = self.kind - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.kind = ::core::option::Option::Some( - __buffa::oneof::content_block::Kind::Thinking( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::content_block::Kind::ToolUse(ref mut existing), - ) = self.kind - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.kind = ::core::option::Option::Some( - __buffa::oneof::content_block::Kind::ToolUse( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::content_block::Kind::ToolResult(ref mut existing), - ) = self.kind - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.kind = ::core::option::Option::Some( - __buffa::oneof::content_block::Kind::ToolResult( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - self.kind = ::core::option::Option::Some( - __buffa::oneof::content_block::Kind::RedactedThinking( - ::buffa::types::decode_bytes(buf)?, - ), - ); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::content_block::Kind::Provider(ref mut existing), - ) = self.kind - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.kind = ::core::option::Option::Some( - __buffa::oneof::content_block::Kind::Provider( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.kind = ::core::option::Option::None; - } -} -impl<'de> serde::Deserialize<'de> for ContentBlock { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = ContentBlock; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct ContentBlock") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __oneof_kind: ::core::option::Option< - __buffa::oneof::content_block::Kind, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "text" => { - let v: ::core::option::Option< - ::buffa::alloc::string::String, - > = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ::buffa::alloc::string::String, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_kind.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'kind'", - ), - ); - } - __oneof_kind = Some( - __buffa::oneof::content_block::Kind::Text(v), - ); - } - } - "artifactRef" | "artifact_ref" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ArtifactRef, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_kind.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'kind'", - ), - ); - } - __oneof_kind = Some( - __buffa::oneof::content_block::Kind::ArtifactRef( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "thinking" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ThinkingBlock, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_kind.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'kind'", - ), - ); - } - __oneof_kind = Some( - __buffa::oneof::content_block::Kind::Thinking( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "toolUse" | "tool_use" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ToolUseBlock, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_kind.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'kind'", - ), - ); - } - __oneof_kind = Some( - __buffa::oneof::content_block::Kind::ToolUse( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "toolResult" | "tool_result" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ToolResultBlock, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_kind.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'kind'", - ), - ); - } - __oneof_kind = Some( - __buffa::oneof::content_block::Kind::ToolResult( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "redactedThinking" | "redacted_thinking" => { - struct _DeserSeed; - impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed { - type Value = ::buffa::alloc::vec::Vec; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::vec::Vec, - D::Error, - > { - ::buffa::json_helpers::bytes::deserialize(d) - } - } - let v: ::core::option::Option< - ::buffa::alloc::vec::Vec, - > = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed), - )?; - if let Some(v) = v { - if __oneof_kind.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'kind'", - ), - ); - } - __oneof_kind = Some( - __buffa::oneof::content_block::Kind::RedactedThinking(v), - ); - } - } - "provider" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ProviderBlock, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_kind.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'kind'", - ), - ); - } - __oneof_kind = Some( - __buffa::oneof::content_block::Kind::Provider( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - __r.kind = __oneof_kind; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ContentBlock { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CONTENT_BLOCK_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ContentBlock", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod content_block { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::content_block::Kind; - #[doc(inline)] - pub use super::__buffa::view::oneof::content_block::Kind as KindView; -} -/// ProviderBlock is a content block this package does not model, kept verbatim so -/// a provider that ships a new block type does not force a schema change before a -/// session using it can be recorded or replayed. It is the same concession -/// ThinkingBlock.signature already makes, generalized: the alternative is -/// dropping the block, which silently corrupts replay of the turn that contained -/// it. -/// -/// Write-verbatim, read-never. A projection must never interpret this payload; a -/// block that any reader needs to understand is a block that has earned its own -/// arm in the oneof. Treating this as an extension point for our own data would -/// turn the canonical form back into an untyped provider blob. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct ProviderBlock { - /// Provider that emitted the block, for example "anthropic". - /// - /// Field 1: `provider` - #[serde(rename = "provider", with = "::buffa::json_helpers::proto_string")] - pub provider: ::buffa::alloc::string::String, - /// The provider's own discriminator for the block, verbatim. - /// - /// Field 2: `block_type` - #[serde( - rename = "blockType", - alias = "block_type", - with = "::buffa::json_helpers::proto_string" - )] - pub block_type: ::buffa::alloc::string::String, - #[serde(flatten)] - pub payload: ::core::option::Option<__buffa::oneof::provider_block::Payload>, -} -impl ::core::fmt::Debug for ProviderBlock { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ProviderBlock") - .field("provider", &self.provider) - .field("block_type", &self.block_type) - .field("payload", &self.payload) - .finish() - } -} -impl ProviderBlock { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ProviderBlock"; -} -::buffa::impl_default_instance!(ProviderBlock); -impl ::buffa::MessageName for ProviderBlock { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ProviderBlock"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ProviderBlock"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ProviderBlock"; -} -impl ::buffa::Message for ProviderBlock { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.provider) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.block_type) as u64; - if let ::core::option::Option::Some(ref v) = self.payload { - match v { - __buffa::oneof::provider_block::Payload::Inline(x) => { - size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64; - } - __buffa::oneof::provider_block::Payload::Ref(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.provider, buf); - ::buffa::types::put_string_field(2u32, &self.block_type, buf); - if let ::core::option::Option::Some(ref v) = self.payload { - match v { - __buffa::oneof::provider_block::Payload::Inline(x) => { - ::buffa::types::put_shared_bytes_field(3u32, x, buf); - } - __buffa::oneof::provider_block::Payload::Ref(x) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.provider, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.block_type, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - self.payload = ::core::option::Option::Some( - __buffa::oneof::provider_block::Payload::Inline( - ::buffa::types::decode_bytes(buf)?, - ), - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::provider_block::Payload::Ref(ref mut existing), - ) = self.payload - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.payload = ::core::option::Option::Some( - __buffa::oneof::provider_block::Payload::Ref( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.provider.clear(); - self.block_type.clear(); - self.payload = ::core::option::Option::None; - } -} -impl<'de> serde::Deserialize<'de> for ProviderBlock { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = ProviderBlock; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct ProviderBlock") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __f_provider: ::core::option::Option< - ::buffa::alloc::string::String, - > = None; - let mut __f_block_type: ::core::option::Option< - ::buffa::alloc::string::String, - > = None; - let mut __oneof_payload: ::core::option::Option< - __buffa::oneof::provider_block::Payload, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "provider" => { - __f_provider = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::alloc::string::String; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::string::String, - D::Error, - > { - ::buffa::json_helpers::proto_string::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "blockType" | "block_type" => { - __f_block_type = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::alloc::string::String; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::string::String, - D::Error, - > { - ::buffa::json_helpers::proto_string::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "inline" => { - struct _DeserSeed; - impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed { - type Value = ::buffa::alloc::vec::Vec; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::vec::Vec, - D::Error, - > { - ::buffa::json_helpers::bytes::deserialize(d) - } - } - let v: ::core::option::Option< - ::buffa::alloc::vec::Vec, - > = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed), - )?; - if let Some(v) = v { - if __oneof_payload.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'payload'", - ), - ); - } - __oneof_payload = Some( - __buffa::oneof::provider_block::Payload::Inline(v), - ); - } - } - "ref" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ArtifactRef, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_payload.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'payload'", - ), - ); - } - __oneof_payload = Some( - __buffa::oneof::provider_block::Payload::Ref( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - if let ::core::option::Option::Some(v) = __f_provider { - __r.provider = v; - } - if let ::core::option::Option::Some(v) = __f_block_type { - __r.block_type = v; - } - __r.payload = __oneof_payload; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ProviderBlock { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PROVIDER_BLOCK_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ProviderBlock", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod provider_block { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::provider_block::Payload; - #[doc(inline)] - pub use super::__buffa::view::oneof::provider_block::Payload as PayloadView; -} -/// ThinkingBlock is visible model reasoning plus the provider's opaque -/// continuation/verification signature, kept so a thinking-bearing turn can be -/// resumed or forked faithfully. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ThinkingBlock { - /// Field 1: `text` - #[serde(rename = "text", with = "::buffa::json_helpers::proto_string")] - pub text: ::buffa::alloc::string::String, - /// Provider signature over the reasoning; empty when the provider emits none. - /// - /// Field 2: `signature` - #[serde( - rename = "signature", - with = "::buffa::json_helpers::opt_bytes", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub signature: ::core::option::Option<::buffa::alloc::vec::Vec>, -} -impl ::core::fmt::Debug for ThinkingBlock { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ThinkingBlock") - .field("text", &self.text) - .field("signature", &self.signature) - .finish() - } -} -impl ThinkingBlock { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ThinkingBlock"; -} -impl ThinkingBlock { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::signature`] to `Some(value)`, consuming and returning `self`. - pub fn with_signature( - mut self, - value: impl Into<::buffa::alloc::vec::Vec>, - ) -> Self { - self.signature = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ThinkingBlock); -impl ::buffa::MessageName for ThinkingBlock { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ThinkingBlock"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ThinkingBlock"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ThinkingBlock"; -} -impl ::buffa::Message for ThinkingBlock { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - if let Some(ref v) = self.signature { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.text, buf); - if let Some(ref v) = self.signature { - ::buffa::types::put_shared_bytes_field(2u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.text, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes( - self.signature.get_or_insert_with(::buffa::alloc::vec::Vec::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.text.clear(); - self.signature = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ThinkingBlock { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __THINKING_BLOCK_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ThinkingBlock", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ToolUseBlock is a model request to invoke a tool, embedded in message content. -/// It owns the provider-visible transcript form: the exact block the model -/// emitted, required for faithful provider replay, distinct from -/// ToolCallRequested, which owns the execution-request record (what the -/// platform was asked to run). The two join by tool_call_id/id; equality is -/// expected but not structurally required, since normalization may differ, and -/// no atomic ordering is guaranteed between them -- each is a self-contained -/// Any fact (D11). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ToolUseBlock { - /// Field 1: `id` - #[serde(rename = "id", with = "::buffa::json_helpers::proto_string")] - pub id: ::buffa::alloc::string::String, - /// Field 2: `name` - #[serde(rename = "name", with = "::buffa::json_helpers::proto_string")] - pub name: ::buffa::alloc::string::String, - /// Tool input arguments as a JSON document. - /// - /// Field 3: `input_json` - #[serde( - rename = "inputJson", - alias = "input_json", - with = "::buffa::json_helpers::proto_string" - )] - pub input_json: ::buffa::alloc::string::String, - /// Parent tool-use id for nested calls; empty when top-level. - /// - /// Field 4: `parent_tool_use_id` - #[serde( - rename = "parentToolUseId", - alias = "parent_tool_use_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub parent_tool_use_id: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for ToolUseBlock { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ToolUseBlock") - .field("id", &self.id) - .field("name", &self.name) - .field("input_json", &self.input_json) - .field("parent_tool_use_id", &self.parent_tool_use_id) - .finish() - } -} -impl ToolUseBlock { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolUseBlock"; -} -impl ToolUseBlock { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::parent_tool_use_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_parent_tool_use_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.parent_tool_use_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ToolUseBlock); -impl ::buffa::MessageName for ToolUseBlock { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolUseBlock"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolUseBlock"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolUseBlock"; -} -impl ::buffa::Message for ToolUseBlock { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.input_json) as u64; - if let Some(ref v) = self.parent_tool_use_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.id, buf); - ::buffa::types::put_string_field(2u32, &self.name, buf); - ::buffa::types::put_string_field(3u32, &self.input_json, buf); - if let Some(ref v) = self.parent_tool_use_id { - ::buffa::types::put_string_field(4u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.name, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.input_json, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .parent_tool_use_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.id.clear(); - self.name.clear(); - self.input_json.clear(); - self.parent_tool_use_id = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolUseBlock { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TOOL_USE_BLOCK_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolUseBlock", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ToolResultBlock carries a tool result back into message content. It owns -/// the provider-visible transcript form: the exact block the model receives, -/// required for faithful provider replay, distinct from ToolCallCompleted/ -/// ToolCallFailed, which own the execution/audit fold. It joins to its -/// ToolUseBlock by tool_use_id (D11). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ToolResultBlock { - /// Field 1: `tool_use_id` - #[serde( - rename = "toolUseId", - alias = "tool_use_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_use_id: ::buffa::alloc::string::String, - /// Field 2: `result` - #[serde(rename = "result")] - pub result: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for ToolResultBlock { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ToolResultBlock") - .field("tool_use_id", &self.tool_use_id) - .field("result", &self.result) - .finish() - } -} -impl ToolResultBlock { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolResultBlock"; -} -::buffa::impl_default_instance!(ToolResultBlock); -impl ::buffa::MessageName for ToolResultBlock { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolResultBlock"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolResultBlock"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolResultBlock"; -} -impl ::buffa::Message for ToolResultBlock { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_use_id) as u64; - if self.result.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.result.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.tool_use_id, buf); - if self.result.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.result.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_use_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.result.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.tool_use_id.clear(); - self.result = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolResultBlock { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TOOL_RESULT_BLOCK_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolResultBlock", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.mod.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.mod.rs deleted file mode 100644 index 8f8fbb9a0..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.mod.rs +++ /dev/null @@ -1,972 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. - -include!("trogonai.session.sessions.v1alpha1.apply_redaction.rs"); -include!("trogonai.session.sessions.v1alpha1.approve_tool_call.rs"); -include!("trogonai.session.sessions.v1alpha1.archive_session.rs"); -include!("trogonai.session.sessions.v1alpha1.digest.rs"); -include!("trogonai.session.sessions.v1alpha1.content_chunks.rs"); -include!("trogonai.session.sessions.v1alpha1.artifact.rs"); -include!("trogonai.session.sessions.v1alpha1.artifact_erased.rs"); -include!("trogonai.session.sessions.v1alpha1.artifact_recorded.rs"); -include!("trogonai.session.sessions.v1alpha1.token_usage.rs"); -include!("trogonai.session.sessions.v1alpha1.tool_call.rs"); -include!("trogonai.session.sessions.v1alpha1.message.rs"); -include!("trogonai.session.sessions.v1alpha1.assistant_message_completed.rs"); -include!("trogonai.session.sessions.v1alpha1.assistant_message_failed.rs"); -include!("trogonai.session.sessions.v1alpha1.model_settings.rs"); -include!("trogonai.session.sessions.v1alpha1.assistant_message_started.rs"); -include!("trogonai.session.sessions.v1alpha1.session_cancelled.rs"); -include!("trogonai.session.sessions.v1alpha1.cancel_session.rs"); -include!("trogonai.session.sessions.v1alpha1.cascade_policy.rs"); -include!("trogonai.session.sessions.v1alpha1.session_ordinal.rs"); -include!("trogonai.session.sessions.v1alpha1.checkpoint.rs"); -include!("trogonai.session.sessions.v1alpha1.checkpoint_produced.rs"); -include!("trogonai.session.sessions.v1alpha1.close_session.rs"); -include!("trogonai.session.sessions.v1alpha1.command_output_replay.rs"); -include!("trogonai.session.sessions.v1alpha1.command_termination.rs"); -include!("trogonai.session.sessions.v1alpha1.compacted.rs"); -include!("trogonai.session.sessions.v1alpha1.compact_session.rs"); -include!("trogonai.session.sessions.v1alpha1.complete_assistant_message.rs"); -include!("trogonai.session.sessions.v1alpha1.detached_work.rs"); -include!("trogonai.session.sessions.v1alpha1.resource_access.rs"); -include!("trogonai.session.sessions.v1alpha1.resource_observation.rs"); -include!("trogonai.session.sessions.v1alpha1.target_outcome.rs"); -include!("trogonai.session.sessions.v1alpha1.complete_tool_call.rs"); -include!("trogonai.session.sessions.v1alpha1.copy_source.rs"); -include!("trogonai.session.sessions.v1alpha1.execution_plan.rs"); -include!("trogonai.session.sessions.v1alpha1.workspace.rs"); -include!("trogonai.session.sessions.v1alpha1.create_child_session.rs"); -include!("trogonai.session.sessions.v1alpha1.create_session.rs"); -include!("trogonai.session.sessions.v1alpha1.delegation_detached.rs"); -include!("trogonai.session.sessions.v1alpha1.delegation_dispatched.rs"); -include!("trogonai.session.sessions.v1alpha1.deny_tool_call.rs"); -include!("trogonai.session.sessions.v1alpha1.detach_delegation.rs"); -include!("trogonai.session.sessions.v1alpha1.detach_parent.rs"); -include!("trogonai.session.sessions.v1alpha1.diff_summary.rs"); -include!("trogonai.session.sessions.v1alpha1.dispatch_delegation.rs"); -include!("trogonai.session.sessions.v1alpha1.dispatch_external_delegation.rs"); -include!("trogonai.session.sessions.v1alpha1.execution_attempt_ended.rs"); -include!("trogonai.session.sessions.v1alpha1.end_execution_attempt.rs"); -include!("trogonai.session.sessions.v1alpha1.erase_artifact.rs"); -include!("trogonai.session.sessions.v1alpha1.execution_attempt_ready.rs"); -include!("trogonai.session.sessions.v1alpha1.execution_attempt_started.rs"); -include!("trogonai.session.sessions.v1alpha1.external_delegation_dispatched.rs"); -include!("trogonai.session.sessions.v1alpha1.file_change.rs"); -include!("trogonai.session.sessions.v1alpha1.file_changed.rs"); -include!("trogonai.session.sessions.v1alpha1.operation_cancellation_requested.rs"); -include!("trogonai.session.sessions.v1alpha1.operation_outcome_recorded.rs"); -include!("trogonai.session.sessions.v1alpha1.operation_reserved.rs"); -include!("trogonai.session.sessions.v1alpha1.parent_detached.rs"); -include!("trogonai.session.sessions.v1alpha1.parent_history_invalidated.rs"); -include!("trogonai.session.sessions.v1alpha1.parent_linked.rs"); -include!("trogonai.session.sessions.v1alpha1.parent_terminated.rs"); -include!("trogonai.session.sessions.v1alpha1.provider_tool_intent_rejected.rs"); -include!("trogonai.session.sessions.v1alpha1.redaction_applied.rs"); -include!("trogonai.session.sessions.v1alpha1.session_archived.rs"); -include!("trogonai.session.sessions.v1alpha1.session_closed.rs"); -include!("trogonai.session.sessions.v1alpha1.session_failed.rs"); -include!("trogonai.session.sessions.v1alpha1.session_forked.rs"); -include!("trogonai.session.sessions.v1alpha1.session_hidden.rs"); -include!("trogonai.session.sessions.v1alpha1.session_recovered.rs"); -include!("trogonai.session.sessions.v1alpha1.session_renamed.rs"); -include!("trogonai.session.sessions.v1alpha1.session_rewound.rs"); -include!("trogonai.session.sessions.v1alpha1.session_started.rs"); -include!("trogonai.session.sessions.v1alpha1.session_unarchived.rs"); -include!("trogonai.session.sessions.v1alpha1.system_notice_recorded.rs"); -include!("trogonai.session.sessions.v1alpha1.todo_updated.rs"); -include!("trogonai.session.sessions.v1alpha1.tool_call_approved.rs"); -include!("trogonai.session.sessions.v1alpha1.tool_call_completed.rs"); -include!("trogonai.session.sessions.v1alpha1.tool_call_denied.rs"); -include!("trogonai.session.sessions.v1alpha1.tool_call_failed.rs"); -include!("trogonai.session.sessions.v1alpha1.tool_call_requested.rs"); -include!("trogonai.session.sessions.v1alpha1.tool_call_started.rs"); -include!("trogonai.session.sessions.v1alpha1.user_message_recorded.rs"); -include!("trogonai.session.sessions.v1alpha1.events.rs"); -include!("trogonai.session.sessions.v1alpha1.fail_assistant_message.rs"); -include!("trogonai.session.sessions.v1alpha1.fail_session.rs"); -include!("trogonai.session.sessions.v1alpha1.fail_tool_call.rs"); -include!("trogonai.session.sessions.v1alpha1.fork_session.rs"); -include!("trogonai.session.sessions.v1alpha1.hide_session.rs"); -include!("trogonai.session.sessions.v1alpha1.mark_execution_attempt_ready.rs"); -include!("trogonai.session.sessions.v1alpha1.produce_checkpoint.rs"); -include!("trogonai.session.sessions.v1alpha1.reconcile_parent_rewind.rs"); -include!("trogonai.session.sessions.v1alpha1.reconcile_parent_terminal.rs"); -include!("trogonai.session.sessions.v1alpha1.record_artifact.rs"); -include!("trogonai.session.sessions.v1alpha1.record_file_change.rs"); -include!("trogonai.session.sessions.v1alpha1.record_operation_outcome.rs"); -include!("trogonai.session.sessions.v1alpha1.record_system_notice.rs"); -include!("trogonai.session.sessions.v1alpha1.record_user_message.rs"); -include!("trogonai.session.sessions.v1alpha1.recover_session.rs"); -include!("trogonai.session.sessions.v1alpha1.reject_provider_tool_intent.rs"); -include!("trogonai.session.sessions.v1alpha1.rename_session.rs"); -include!("trogonai.session.sessions.v1alpha1.request_operation_cancellation.rs"); -include!("trogonai.session.sessions.v1alpha1.request_tool_call.rs"); -include!("trogonai.session.sessions.v1alpha1.reserve_operation.rs"); -include!("trogonai.session.sessions.v1alpha1.rewind_session.rs"); -include!("trogonai.session.sessions.v1alpha1.start_assistant_message.rs"); -include!("trogonai.session.sessions.v1alpha1.start_execution_attempt.rs"); -include!("trogonai.session.sessions.v1alpha1.start_tool_call.rs"); -include!("trogonai.session.sessions.v1alpha1.unarchive_session.rs"); -include!("trogonai.session.sessions.v1alpha1.update_todo.rs"); -include!("trogonai.session.sessions.v1alpha1.write_outcome.rs"); -#[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception -)] -pub mod __buffa { - #[allow(unused_imports)] - use super::*; - pub mod view { - #[allow(unused_imports)] - use super::*; - include!("trogonai.session.sessions.v1alpha1.apply_redaction.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.approve_tool_call.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.archive_session.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.digest.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.content_chunks.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.artifact.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.artifact_erased.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.artifact_recorded.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.token_usage.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.tool_call.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.message.__view.rs"); - include!( - "trogonai.session.sessions.v1alpha1.assistant_message_completed.__view.rs" - ); - include!( - "trogonai.session.sessions.v1alpha1.assistant_message_failed.__view.rs" - ); - include!("trogonai.session.sessions.v1alpha1.model_settings.__view.rs"); - include!( - "trogonai.session.sessions.v1alpha1.assistant_message_started.__view.rs" - ); - include!("trogonai.session.sessions.v1alpha1.session_cancelled.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.cancel_session.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.session_ordinal.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.checkpoint.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.checkpoint_produced.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.close_session.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.command_output_replay.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.command_termination.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.compacted.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.compact_session.__view.rs"); - include!( - "trogonai.session.sessions.v1alpha1.complete_assistant_message.__view.rs" - ); - include!("trogonai.session.sessions.v1alpha1.detached_work.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.resource_access.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.resource_observation.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.target_outcome.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.complete_tool_call.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.copy_source.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.execution_plan.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.workspace.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.create_child_session.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.create_session.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.delegation_detached.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.delegation_dispatched.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.deny_tool_call.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.detach_delegation.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.detach_parent.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.diff_summary.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.dispatch_delegation.__view.rs"); - include!( - "trogonai.session.sessions.v1alpha1.dispatch_external_delegation.__view.rs" - ); - include!("trogonai.session.sessions.v1alpha1.execution_attempt_ended.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.end_execution_attempt.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.erase_artifact.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.execution_attempt_ready.__view.rs"); - include!( - "trogonai.session.sessions.v1alpha1.execution_attempt_started.__view.rs" - ); - include!( - "trogonai.session.sessions.v1alpha1.external_delegation_dispatched.__view.rs" - ); - include!("trogonai.session.sessions.v1alpha1.file_changed.__view.rs"); - include!( - "trogonai.session.sessions.v1alpha1.operation_cancellation_requested.__view.rs" - ); - include!( - "trogonai.session.sessions.v1alpha1.operation_outcome_recorded.__view.rs" - ); - include!("trogonai.session.sessions.v1alpha1.operation_reserved.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.parent_detached.__view.rs"); - include!( - "trogonai.session.sessions.v1alpha1.parent_history_invalidated.__view.rs" - ); - include!("trogonai.session.sessions.v1alpha1.parent_linked.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.parent_terminated.__view.rs"); - include!( - "trogonai.session.sessions.v1alpha1.provider_tool_intent_rejected.__view.rs" - ); - include!("trogonai.session.sessions.v1alpha1.redaction_applied.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.session_archived.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.session_closed.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.session_failed.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.session_forked.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.session_hidden.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.session_recovered.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.session_renamed.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.session_rewound.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.session_started.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.session_unarchived.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.system_notice_recorded.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.todo_updated.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.tool_call_approved.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.tool_call_completed.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.tool_call_denied.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.tool_call_failed.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.tool_call_requested.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.tool_call_started.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.user_message_recorded.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.events.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.fail_assistant_message.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.fail_session.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.fail_tool_call.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.fork_session.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.hide_session.__view.rs"); - include!( - "trogonai.session.sessions.v1alpha1.mark_execution_attempt_ready.__view.rs" - ); - include!("trogonai.session.sessions.v1alpha1.produce_checkpoint.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.reconcile_parent_rewind.__view.rs"); - include!( - "trogonai.session.sessions.v1alpha1.reconcile_parent_terminal.__view.rs" - ); - include!("trogonai.session.sessions.v1alpha1.record_artifact.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.record_file_change.__view.rs"); - include!( - "trogonai.session.sessions.v1alpha1.record_operation_outcome.__view.rs" - ); - include!("trogonai.session.sessions.v1alpha1.record_system_notice.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.record_user_message.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.recover_session.__view.rs"); - include!( - "trogonai.session.sessions.v1alpha1.reject_provider_tool_intent.__view.rs" - ); - include!("trogonai.session.sessions.v1alpha1.rename_session.__view.rs"); - include!( - "trogonai.session.sessions.v1alpha1.request_operation_cancellation.__view.rs" - ); - include!("trogonai.session.sessions.v1alpha1.request_tool_call.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.reserve_operation.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.rewind_session.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.start_assistant_message.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.start_execution_attempt.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.start_tool_call.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.unarchive_session.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.update_todo.__view.rs"); - include!("trogonai.session.sessions.v1alpha1.write_outcome.__view.rs"); - pub mod oneof { - #[allow(unused_imports)] - use super::*; - include!("trogonai.session.sessions.v1alpha1.artifact.__view_oneof.rs"); - include!("trogonai.session.sessions.v1alpha1.tool_call.__view_oneof.rs"); - include!("trogonai.session.sessions.v1alpha1.message.__view_oneof.rs"); - include!( - "trogonai.session.sessions.v1alpha1.command_termination.__view_oneof.rs" - ); - include!("trogonai.session.sessions.v1alpha1.compacted.__view_oneof.rs"); - include!( - "trogonai.session.sessions.v1alpha1.resource_observation.__view_oneof.rs" - ); - include!( - "trogonai.session.sessions.v1alpha1.operation_outcome_recorded.__view_oneof.rs" - ); - include!("trogonai.session.sessions.v1alpha1.events.__view_oneof.rs"); - include!( - "trogonai.session.sessions.v1alpha1.record_operation_outcome.__view_oneof.rs" - ); - } - } - pub mod oneof { - #[allow(unused_imports)] - use super::*; - include!("trogonai.session.sessions.v1alpha1.artifact.__oneof.rs"); - include!("trogonai.session.sessions.v1alpha1.tool_call.__oneof.rs"); - include!("trogonai.session.sessions.v1alpha1.message.__oneof.rs"); - include!("trogonai.session.sessions.v1alpha1.command_termination.__oneof.rs"); - include!("trogonai.session.sessions.v1alpha1.compacted.__oneof.rs"); - include!("trogonai.session.sessions.v1alpha1.resource_observation.__oneof.rs"); - include!( - "trogonai.session.sessions.v1alpha1.operation_outcome_recorded.__oneof.rs" - ); - include!("trogonai.session.sessions.v1alpha1.events.__oneof.rs"); - include!( - "trogonai.session.sessions.v1alpha1.record_operation_outcome.__oneof.rs" - ); - } - /// Register this package's `Any` type entries and extension entries. - pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) { - reg.register_json_any(super::__APPLY_REDACTION_JSON_ANY); - reg.register_json_any(super::__APPROVE_TOOL_CALL_JSON_ANY); - reg.register_json_any(super::__ARCHIVE_SESSION_JSON_ANY); - reg.register_json_any(super::__DIGEST_JSON_ANY); - reg.register_json_any(super::__CONTENT_CHUNKS_JSON_ANY); - reg.register_json_any(super::__ARTIFACT_REF_JSON_ANY); - reg.register_json_any(super::__ARTIFACT_METADATA_JSON_ANY); - reg.register_json_any(super::__STORED_ARTIFACT_JSON_ANY); - reg.register_json_any(super::__EXTERNAL_ARTIFACT_JSON_ANY); - reg.register_json_any(super::__ARTIFACT_ERASED_JSON_ANY); - reg.register_json_any(super::__ARTIFACT_RECORDED_JSON_ANY); - reg.register_json_any(super::__TOKEN_USAGE_JSON_ANY); - reg.register_json_any(super::__COST_JSON_ANY); - reg.register_json_any(super::__TOOL_CALL_RESULT_JSON_ANY); - reg.register_json_any(super::__TEXT_TOOL_RESULT_JSON_ANY); - reg.register_json_any(super::__CANONICAL_MESSAGE_JSON_ANY); - reg.register_json_any(super::__CONTENT_BLOCK_JSON_ANY); - reg.register_json_any(super::__PROVIDER_BLOCK_JSON_ANY); - reg.register_json_any(super::__THINKING_BLOCK_JSON_ANY); - reg.register_json_any(super::__TOOL_USE_BLOCK_JSON_ANY); - reg.register_json_any(super::__TOOL_RESULT_BLOCK_JSON_ANY); - reg.register_json_any(super::__ASSISTANT_MESSAGE_COMPLETED_JSON_ANY); - reg.register_json_any(super::__ASSISTANT_MESSAGE_FAILED_JSON_ANY); - reg.register_json_any(super::__MODEL_SETTINGS_JSON_ANY); - reg.register_json_any(super::__ASSISTANT_MESSAGE_STARTED_JSON_ANY); - reg.register_json_any(super::__SESSION_CANCELLED_JSON_ANY); - reg.register_json_any(super::__CANCEL_SESSION_JSON_ANY); - reg.register_json_any(super::__SESSION_ORDINAL_JSON_ANY); - reg.register_json_any(super::__CHECKPOINT_JSON_ANY); - reg.register_json_any(super::__CHECKPOINT_PRODUCED_JSON_ANY); - reg.register_json_any(super::__CLOSE_SESSION_JSON_ANY); - reg.register_json_any(super::__COMMAND_OUTPUT_REPLAY_REF_JSON_ANY); - reg.register_json_any(super::__REPLAY_COMPLETENESS_JSON_ANY); - reg.register_json_any(super::__COMMAND_TERMINATION_JSON_ANY); - reg.register_json_any(super::__COMPACTED_JSON_ANY); - reg.register_json_any(super::__COMPACTION_CONTEXT_ROOT_JSON_ANY); - reg.register_json_any(super::__COMPACTION_SESSION_START_JSON_ANY); - reg.register_json_any(super::__COMPACTION_INHERITED_PREFIX_JSON_ANY); - reg.register_json_any(super::__COMPACTION_PRODUCER_JSON_ANY); - reg.register_json_any(super::__COMPACT_SESSION_JSON_ANY); - reg.register_json_any(super::__COMPLETE_ASSISTANT_MESSAGE_JSON_ANY); - reg.register_json_any(super::__DETACHED_WORK_JSON_ANY); - reg.register_json_any(super::__SUPERVISION_POLICY_JSON_ANY); - reg.register_json_any(super::__RESOURCE_ACCESS_RECORD_JSON_ANY); - reg.register_json_any(super::__RESOURCE_OBSERVATION_JSON_ANY); - reg.register_json_any(super::__RESOURCE_ABSENT_JSON_ANY); - reg.register_json_any(super::__BYTE_RANGE_JSON_ANY); - reg.register_json_any(super::__TARGET_OUTCOME_JSON_ANY); - reg.register_json_any(super::__COMPLETE_TOOL_CALL_JSON_ANY); - reg.register_json_any(super::__COPY_SOURCE_JSON_ANY); - reg.register_json_any(super::__STORED_SESSION_EXECUTION_PLAN_JSON_ANY); - reg.register_json_any(super::__WORKSPACE_REF_JSON_ANY); - reg.register_json_any(super::__CREATE_CHILD_SESSION_JSON_ANY); - reg.register_json_any(super::__CREATE_SESSION_JSON_ANY); - reg.register_json_any(super::__DELEGATION_DETACHED_JSON_ANY); - reg.register_json_any(super::__DELEGATION_DISPATCHED_JSON_ANY); - reg.register_json_any(super::__DENY_TOOL_CALL_JSON_ANY); - reg.register_json_any(super::__DETACH_DELEGATION_JSON_ANY); - reg.register_json_any(super::__DETACH_PARENT_JSON_ANY); - reg.register_json_any(super::__DIFF_SUMMARY_JSON_ANY); - reg.register_json_any(super::__DISPATCH_DELEGATION_JSON_ANY); - reg.register_json_any(super::__DISPATCH_EXTERNAL_DELEGATION_JSON_ANY); - reg.register_json_any(super::__EXECUTION_ATTEMPT_ENDED_JSON_ANY); - reg.register_json_any(super::__END_EXECUTION_ATTEMPT_JSON_ANY); - reg.register_json_any(super::__ERASE_ARTIFACT_JSON_ANY); - reg.register_json_any(super::__EXECUTION_ATTEMPT_READY_JSON_ANY); - reg.register_json_any(super::__EXECUTION_ATTEMPT_STARTED_JSON_ANY); - reg.register_json_any(super::__EXTERNAL_DELEGATION_DISPATCHED_JSON_ANY); - reg.register_json_any(super::__FILE_CHANGED_JSON_ANY); - reg.register_json_any(super::__OPERATION_CANCELLATION_REQUESTED_JSON_ANY); - reg.register_json_any(super::__OPERATION_OUTCOME_RECORDED_JSON_ANY); - reg.register_json_any(super::__OPERATION_SUCCEEDED_JSON_ANY); - reg.register_json_any(super::__OPERATION_FAILED_JSON_ANY); - reg.register_json_any(super::__OPERATION_CANCELLED_JSON_ANY); - reg.register_json_any(super::__OPERATION_UNKNOWN_JSON_ANY); - reg.register_json_any(super::__OPERATION_RESERVED_JSON_ANY); - reg.register_json_any(super::__PARENT_DETACHED_JSON_ANY); - reg.register_json_any(super::__PARENT_HISTORY_INVALIDATED_JSON_ANY); - reg.register_json_any(super::__PARENT_LINKED_JSON_ANY); - reg.register_json_any(super::__PARENT_TERMINATED_JSON_ANY); - reg.register_json_any(super::__PROVIDER_TOOL_INTENT_REJECTED_JSON_ANY); - reg.register_json_any(super::__REDACTION_APPLIED_JSON_ANY); - reg.register_json_any(super::__SESSION_ARCHIVED_JSON_ANY); - reg.register_json_any(super::__SESSION_CLOSED_JSON_ANY); - reg.register_json_any(super::__SESSION_FAILED_JSON_ANY); - reg.register_json_any(super::__SESSION_FORKED_JSON_ANY); - reg.register_json_any(super::__SESSION_HIDDEN_JSON_ANY); - reg.register_json_any(super::__SESSION_RECOVERED_JSON_ANY); - reg.register_json_any(super::__SESSION_RENAMED_JSON_ANY); - reg.register_json_any(super::__SESSION_REWOUND_JSON_ANY); - reg.register_json_any(super::__SESSION_STARTED_JSON_ANY); - reg.register_json_any(super::__SESSION_UNARCHIVED_JSON_ANY); - reg.register_json_any(super::__SYSTEM_NOTICE_RECORDED_JSON_ANY); - reg.register_json_any(super::__TODO_UPDATED_JSON_ANY); - reg.register_json_any(super::__TODO_ITEM_JSON_ANY); - reg.register_json_any(super::__TOOL_CALL_APPROVED_JSON_ANY); - reg.register_json_any(super::__TOOL_CALL_COMPLETED_JSON_ANY); - reg.register_json_any(super::__TOOL_CALL_DENIED_JSON_ANY); - reg.register_json_any(super::__TOOL_CALL_FAILED_JSON_ANY); - reg.register_json_any(super::__TOOL_CALL_REQUESTED_JSON_ANY); - reg.register_json_any(super::__TOOL_CALL_STARTED_JSON_ANY); - reg.register_json_any(super::__USER_MESSAGE_RECORDED_JSON_ANY); - reg.register_json_any(super::__SESSION_EVENT_JSON_ANY); - reg.register_json_any(super::__FAIL_ASSISTANT_MESSAGE_JSON_ANY); - reg.register_json_any(super::__FAIL_SESSION_JSON_ANY); - reg.register_json_any(super::__FAIL_TOOL_CALL_JSON_ANY); - reg.register_json_any(super::__FORK_SESSION_JSON_ANY); - reg.register_json_any(super::__HIDE_SESSION_JSON_ANY); - reg.register_json_any(super::__MARK_EXECUTION_ATTEMPT_READY_JSON_ANY); - reg.register_json_any(super::__PRODUCE_CHECKPOINT_JSON_ANY); - reg.register_json_any(super::__RECONCILE_PARENT_REWIND_JSON_ANY); - reg.register_json_any(super::__RECONCILE_PARENT_TERMINAL_JSON_ANY); - reg.register_json_any(super::__RECORD_ARTIFACT_JSON_ANY); - reg.register_json_any(super::__RECORD_FILE_CHANGE_JSON_ANY); - reg.register_json_any(super::__RECORD_OPERATION_OUTCOME_JSON_ANY); - reg.register_json_any(super::__RECORD_SYSTEM_NOTICE_JSON_ANY); - reg.register_json_any(super::__RECORD_USER_MESSAGE_JSON_ANY); - reg.register_json_any(super::__RECOVER_SESSION_JSON_ANY); - reg.register_json_any(super::__REJECT_PROVIDER_TOOL_INTENT_JSON_ANY); - reg.register_json_any(super::__RENAME_SESSION_JSON_ANY); - reg.register_json_any(super::__REQUEST_OPERATION_CANCELLATION_JSON_ANY); - reg.register_json_any(super::__REQUEST_TOOL_CALL_JSON_ANY); - reg.register_json_any(super::__RESERVE_OPERATION_JSON_ANY); - reg.register_json_any(super::__REWIND_SESSION_JSON_ANY); - reg.register_json_any(super::__START_ASSISTANT_MESSAGE_JSON_ANY); - reg.register_json_any(super::__START_EXECUTION_ATTEMPT_JSON_ANY); - reg.register_json_any(super::__START_TOOL_CALL_JSON_ANY); - reg.register_json_any(super::__UNARCHIVE_SESSION_JSON_ANY); - reg.register_json_any(super::__UPDATE_TODO_JSON_ANY); - reg.register_json_any(super::__WRITE_OUTCOME_JSON_ANY); - reg.register_json_any(super::__INDETERMINATE_WRITE_JSON_ANY); - reg.register_json_any(super::__WRITE_CONFLICT_JSON_ANY); - } -} -#[doc(inline)] -pub use self::__buffa::view::ApplyRedactionView; -#[doc(inline)] -pub use self::__buffa::view::ApplyRedactionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ApproveToolCallView; -#[doc(inline)] -pub use self::__buffa::view::ApproveToolCallOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ArchiveSessionView; -#[doc(inline)] -pub use self::__buffa::view::ArchiveSessionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DigestView; -#[doc(inline)] -pub use self::__buffa::view::DigestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ContentChunksView; -#[doc(inline)] -pub use self::__buffa::view::ContentChunksOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ArtifactRefView; -#[doc(inline)] -pub use self::__buffa::view::ArtifactRefOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ArtifactMetadataView; -#[doc(inline)] -pub use self::__buffa::view::ArtifactMetadataOwnedView; -#[doc(inline)] -pub use self::__buffa::view::StoredArtifactView; -#[doc(inline)] -pub use self::__buffa::view::StoredArtifactOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ExternalArtifactView; -#[doc(inline)] -pub use self::__buffa::view::ExternalArtifactOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ArtifactErasedView; -#[doc(inline)] -pub use self::__buffa::view::ArtifactErasedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ArtifactRecordedView; -#[doc(inline)] -pub use self::__buffa::view::ArtifactRecordedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::TokenUsageView; -#[doc(inline)] -pub use self::__buffa::view::TokenUsageOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CostView; -#[doc(inline)] -pub use self::__buffa::view::CostOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallResultView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallResultOwnedView; -#[doc(inline)] -pub use self::__buffa::view::TextToolResultView; -#[doc(inline)] -pub use self::__buffa::view::TextToolResultOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CanonicalMessageView; -#[doc(inline)] -pub use self::__buffa::view::CanonicalMessageOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ContentBlockView; -#[doc(inline)] -pub use self::__buffa::view::ContentBlockOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ProviderBlockView; -#[doc(inline)] -pub use self::__buffa::view::ProviderBlockOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ThinkingBlockView; -#[doc(inline)] -pub use self::__buffa::view::ThinkingBlockOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ToolUseBlockView; -#[doc(inline)] -pub use self::__buffa::view::ToolUseBlockOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ToolResultBlockView; -#[doc(inline)] -pub use self::__buffa::view::ToolResultBlockOwnedView; -#[doc(inline)] -pub use self::__buffa::view::AssistantMessageCompletedView; -#[doc(inline)] -pub use self::__buffa::view::AssistantMessageCompletedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::AssistantMessageFailedView; -#[doc(inline)] -pub use self::__buffa::view::AssistantMessageFailedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ModelSettingsView; -#[doc(inline)] -pub use self::__buffa::view::ModelSettingsOwnedView; -#[doc(inline)] -pub use self::__buffa::view::AssistantMessageStartedView; -#[doc(inline)] -pub use self::__buffa::view::AssistantMessageStartedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionCancelledView; -#[doc(inline)] -pub use self::__buffa::view::SessionCancelledOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CancelSessionView; -#[doc(inline)] -pub use self::__buffa::view::CancelSessionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionOrdinalView; -#[doc(inline)] -pub use self::__buffa::view::SessionOrdinalOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CheckpointView; -#[doc(inline)] -pub use self::__buffa::view::CheckpointOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CheckpointProducedView; -#[doc(inline)] -pub use self::__buffa::view::CheckpointProducedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CloseSessionView; -#[doc(inline)] -pub use self::__buffa::view::CloseSessionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CommandOutputReplayRefView; -#[doc(inline)] -pub use self::__buffa::view::CommandOutputReplayRefOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReplayCompletenessView; -#[doc(inline)] -pub use self::__buffa::view::ReplayCompletenessOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CommandTerminationView; -#[doc(inline)] -pub use self::__buffa::view::CommandTerminationOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CompactedView; -#[doc(inline)] -pub use self::__buffa::view::CompactedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CompactionContextRootView; -#[doc(inline)] -pub use self::__buffa::view::CompactionContextRootOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CompactionSessionStartView; -#[doc(inline)] -pub use self::__buffa::view::CompactionSessionStartOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CompactionInheritedPrefixView; -#[doc(inline)] -pub use self::__buffa::view::CompactionInheritedPrefixOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CompactionProducerView; -#[doc(inline)] -pub use self::__buffa::view::CompactionProducerOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CompactSessionView; -#[doc(inline)] -pub use self::__buffa::view::CompactSessionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CompleteAssistantMessageView; -#[doc(inline)] -pub use self::__buffa::view::CompleteAssistantMessageOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DetachedWorkView; -#[doc(inline)] -pub use self::__buffa::view::DetachedWorkOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SupervisionPolicyView; -#[doc(inline)] -pub use self::__buffa::view::SupervisionPolicyOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ResourceAccessRecordView; -#[doc(inline)] -pub use self::__buffa::view::ResourceAccessRecordOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ResourceObservationView; -#[doc(inline)] -pub use self::__buffa::view::ResourceObservationOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ResourceAbsentView; -#[doc(inline)] -pub use self::__buffa::view::ResourceAbsentOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ByteRangeView; -#[doc(inline)] -pub use self::__buffa::view::ByteRangeOwnedView; -#[doc(inline)] -pub use self::__buffa::view::TargetOutcomeView; -#[doc(inline)] -pub use self::__buffa::view::TargetOutcomeOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CompleteToolCallView; -#[doc(inline)] -pub use self::__buffa::view::CompleteToolCallOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CopySourceView; -#[doc(inline)] -pub use self::__buffa::view::CopySourceOwnedView; -#[doc(inline)] -pub use self::__buffa::view::StoredSessionExecutionPlanView; -#[doc(inline)] -pub use self::__buffa::view::StoredSessionExecutionPlanOwnedView; -#[doc(inline)] -pub use self::__buffa::view::WorkspaceRefView; -#[doc(inline)] -pub use self::__buffa::view::WorkspaceRefOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CreateChildSessionView; -#[doc(inline)] -pub use self::__buffa::view::CreateChildSessionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::CreateSessionView; -#[doc(inline)] -pub use self::__buffa::view::CreateSessionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DelegationDetachedView; -#[doc(inline)] -pub use self::__buffa::view::DelegationDetachedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DelegationDispatchedView; -#[doc(inline)] -pub use self::__buffa::view::DelegationDispatchedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DenyToolCallView; -#[doc(inline)] -pub use self::__buffa::view::DenyToolCallOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DetachDelegationView; -#[doc(inline)] -pub use self::__buffa::view::DetachDelegationOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DetachParentView; -#[doc(inline)] -pub use self::__buffa::view::DetachParentOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DiffSummaryView; -#[doc(inline)] -pub use self::__buffa::view::DiffSummaryOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DispatchDelegationView; -#[doc(inline)] -pub use self::__buffa::view::DispatchDelegationOwnedView; -#[doc(inline)] -pub use self::__buffa::view::DispatchExternalDelegationView; -#[doc(inline)] -pub use self::__buffa::view::DispatchExternalDelegationOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ExecutionAttemptEndedView; -#[doc(inline)] -pub use self::__buffa::view::ExecutionAttemptEndedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::EndExecutionAttemptView; -#[doc(inline)] -pub use self::__buffa::view::EndExecutionAttemptOwnedView; -#[doc(inline)] -pub use self::__buffa::view::EraseArtifactView; -#[doc(inline)] -pub use self::__buffa::view::EraseArtifactOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ExecutionAttemptReadyView; -#[doc(inline)] -pub use self::__buffa::view::ExecutionAttemptReadyOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ExecutionAttemptStartedView; -#[doc(inline)] -pub use self::__buffa::view::ExecutionAttemptStartedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ExternalDelegationDispatchedView; -#[doc(inline)] -pub use self::__buffa::view::ExternalDelegationDispatchedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::FileChangedView; -#[doc(inline)] -pub use self::__buffa::view::FileChangedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::OperationCancellationRequestedView; -#[doc(inline)] -pub use self::__buffa::view::OperationCancellationRequestedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::OperationOutcomeRecordedView; -#[doc(inline)] -pub use self::__buffa::view::OperationOutcomeRecordedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::OperationSucceededView; -#[doc(inline)] -pub use self::__buffa::view::OperationSucceededOwnedView; -#[doc(inline)] -pub use self::__buffa::view::OperationFailedView; -#[doc(inline)] -pub use self::__buffa::view::OperationFailedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::OperationCancelledView; -#[doc(inline)] -pub use self::__buffa::view::OperationCancelledOwnedView; -#[doc(inline)] -pub use self::__buffa::view::OperationUnknownView; -#[doc(inline)] -pub use self::__buffa::view::OperationUnknownOwnedView; -#[doc(inline)] -pub use self::__buffa::view::OperationReservedView; -#[doc(inline)] -pub use self::__buffa::view::OperationReservedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ParentDetachedView; -#[doc(inline)] -pub use self::__buffa::view::ParentDetachedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ParentHistoryInvalidatedView; -#[doc(inline)] -pub use self::__buffa::view::ParentHistoryInvalidatedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ParentLinkedView; -#[doc(inline)] -pub use self::__buffa::view::ParentLinkedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ParentTerminatedView; -#[doc(inline)] -pub use self::__buffa::view::ParentTerminatedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ProviderToolIntentRejectedView; -#[doc(inline)] -pub use self::__buffa::view::ProviderToolIntentRejectedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RedactionAppliedView; -#[doc(inline)] -pub use self::__buffa::view::RedactionAppliedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionArchivedView; -#[doc(inline)] -pub use self::__buffa::view::SessionArchivedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionClosedView; -#[doc(inline)] -pub use self::__buffa::view::SessionClosedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionFailedView; -#[doc(inline)] -pub use self::__buffa::view::SessionFailedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionForkedView; -#[doc(inline)] -pub use self::__buffa::view::SessionForkedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionHiddenView; -#[doc(inline)] -pub use self::__buffa::view::SessionHiddenOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionRecoveredView; -#[doc(inline)] -pub use self::__buffa::view::SessionRecoveredOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionRenamedView; -#[doc(inline)] -pub use self::__buffa::view::SessionRenamedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionRewoundView; -#[doc(inline)] -pub use self::__buffa::view::SessionRewoundOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionStartedView; -#[doc(inline)] -pub use self::__buffa::view::SessionStartedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionUnarchivedView; -#[doc(inline)] -pub use self::__buffa::view::SessionUnarchivedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SystemNoticeRecordedView; -#[doc(inline)] -pub use self::__buffa::view::SystemNoticeRecordedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::TodoUpdatedView; -#[doc(inline)] -pub use self::__buffa::view::TodoUpdatedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::TodoItemView; -#[doc(inline)] -pub use self::__buffa::view::TodoItemOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallApprovedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallApprovedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallCompletedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallCompletedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallDeniedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallDeniedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallFailedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallFailedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallRequestedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallRequestedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallStartedView; -#[doc(inline)] -pub use self::__buffa::view::ToolCallStartedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::UserMessageRecordedView; -#[doc(inline)] -pub use self::__buffa::view::UserMessageRecordedOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SessionEventView; -#[doc(inline)] -pub use self::__buffa::view::SessionEventOwnedView; -#[doc(inline)] -pub use self::__buffa::view::FailAssistantMessageView; -#[doc(inline)] -pub use self::__buffa::view::FailAssistantMessageOwnedView; -#[doc(inline)] -pub use self::__buffa::view::FailSessionView; -#[doc(inline)] -pub use self::__buffa::view::FailSessionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::FailToolCallView; -#[doc(inline)] -pub use self::__buffa::view::FailToolCallOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ForkSessionView; -#[doc(inline)] -pub use self::__buffa::view::ForkSessionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::HideSessionView; -#[doc(inline)] -pub use self::__buffa::view::HideSessionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::MarkExecutionAttemptReadyView; -#[doc(inline)] -pub use self::__buffa::view::MarkExecutionAttemptReadyOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ProduceCheckpointView; -#[doc(inline)] -pub use self::__buffa::view::ProduceCheckpointOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReconcileParentRewindView; -#[doc(inline)] -pub use self::__buffa::view::ReconcileParentRewindOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReconcileParentTerminalView; -#[doc(inline)] -pub use self::__buffa::view::ReconcileParentTerminalOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RecordArtifactView; -#[doc(inline)] -pub use self::__buffa::view::RecordArtifactOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RecordFileChangeView; -#[doc(inline)] -pub use self::__buffa::view::RecordFileChangeOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RecordOperationOutcomeView; -#[doc(inline)] -pub use self::__buffa::view::RecordOperationOutcomeOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RecordSystemNoticeView; -#[doc(inline)] -pub use self::__buffa::view::RecordSystemNoticeOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RecordUserMessageView; -#[doc(inline)] -pub use self::__buffa::view::RecordUserMessageOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RecoverSessionView; -#[doc(inline)] -pub use self::__buffa::view::RecoverSessionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RejectProviderToolIntentView; -#[doc(inline)] -pub use self::__buffa::view::RejectProviderToolIntentOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RenameSessionView; -#[doc(inline)] -pub use self::__buffa::view::RenameSessionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RequestOperationCancellationView; -#[doc(inline)] -pub use self::__buffa::view::RequestOperationCancellationOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RequestToolCallView; -#[doc(inline)] -pub use self::__buffa::view::RequestToolCallOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReserveOperationView; -#[doc(inline)] -pub use self::__buffa::view::ReserveOperationOwnedView; -#[doc(inline)] -pub use self::__buffa::view::RewindSessionView; -#[doc(inline)] -pub use self::__buffa::view::RewindSessionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::StartAssistantMessageView; -#[doc(inline)] -pub use self::__buffa::view::StartAssistantMessageOwnedView; -#[doc(inline)] -pub use self::__buffa::view::StartExecutionAttemptView; -#[doc(inline)] -pub use self::__buffa::view::StartExecutionAttemptOwnedView; -#[doc(inline)] -pub use self::__buffa::view::StartToolCallView; -#[doc(inline)] -pub use self::__buffa::view::StartToolCallOwnedView; -#[doc(inline)] -pub use self::__buffa::view::UnarchiveSessionView; -#[doc(inline)] -pub use self::__buffa::view::UnarchiveSessionOwnedView; -#[doc(inline)] -pub use self::__buffa::view::UpdateTodoView; -#[doc(inline)] -pub use self::__buffa::view::UpdateTodoOwnedView; -#[doc(inline)] -pub use self::__buffa::view::WriteOutcomeView; -#[doc(inline)] -pub use self::__buffa::view::WriteOutcomeOwnedView; -#[doc(inline)] -pub use self::__buffa::view::IndeterminateWriteView; -#[doc(inline)] -pub use self::__buffa::view::IndeterminateWriteOwnedView; -#[doc(inline)] -pub use self::__buffa::view::WriteConflictView; -#[doc(inline)] -pub use self::__buffa::view::WriteConflictOwnedView; -#[doc(inline)] -pub use self::__buffa::register_types; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.model_settings.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.model_settings.__view.rs deleted file mode 100644 index ec3219231..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.model_settings.__view.rs +++ /dev/null @@ -1,436 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/model_settings.proto - -/// ModelSettings is the sampling configuration a generation actually ran with, -/// recorded on AssistantMessageStarted so a replay reproduces the request rather -/// than approximating it from whatever the caller's defaults are at replay time. -/// CanonicalMessage.model already pins which model answered; this pins how it was -/// asked. Every scalar field has explicit presence: unset means the provider -/// default applied, which is a different fact from an explicitly configured -/// zero. stop_sequences is repeated and carries no presence, so an omitted list -/// and an empty list are the same recorded fact. -#[derive(Clone, Debug, Default)] -pub struct ModelSettingsView<'a> { - /// Field 1: `max_output_tokens` - pub max_output_tokens: ::core::option::Option, - /// Field 2: `temperature` - pub temperature: ::core::option::Option, - /// Field 3: `top_p` - pub top_p: ::core::option::Option, - /// Extended-thinking budget, for providers that meter reasoning separately. - /// - /// Field 4: `thinking_budget_tokens` - pub thinking_budget_tokens: ::core::option::Option, - /// Field 5: `stop_sequences` - pub stop_sequences: ::buffa::RepeatedView<'a, &'a str>, - /// Claim-check to the full provider-specific request settings, for the fields - /// this message does not model. Kept out of line because it is replay input, - /// not projection input: no reader interprets it (D11). - /// - /// Field 6: `raw_settings` - pub raw_settings: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactRefView<'a>, - >, -} -impl<'a> ::buffa::MessageView<'a> for ModelSettingsView<'a> { - type Owned = super::super::ModelSettings; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.max_output_tokens = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Fixed64, - )?; - view.temperature = Some(::buffa::types::decode_double(&mut cur)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Fixed64, - )?; - view.top_p = Some(::buffa::types::decode_double(&mut cur)?); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.thinking_budget_tokens = Some( - ::buffa::types::decode_uint64(&mut cur)?, - ); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.raw_settings.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.raw_settings = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::borrow_str(&mut cur)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - view.stop_sequences.push(__elem); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ModelSettings { - max_output_tokens: self.max_output_tokens, - temperature: self.temperature, - top_p: self.top_p, - thinking_budget_tokens: self.thinking_budget_tokens, - stop_sequences: self.stop_sequences.iter().map(|s| s.to_string()).collect(), - raw_settings: match self.raw_settings.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ModelSettingsView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(v) = self.max_output_tokens { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.temperature.is_some() { - size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; - } - if self.top_p.is_some() { - size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; - } - if let Some(v) = self.thinking_budget_tokens { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - for v in &self.stop_sequences { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.raw_settings.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.raw_settings.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(v) = self.max_output_tokens { - ::buffa::types::put_uint64_field(1u32, v, buf); - } - if let Some(v) = self.temperature { - ::buffa::types::put_double_field(2u32, v, buf); - } - if let Some(v) = self.top_p { - ::buffa::types::put_double_field(3u32, v, buf); - } - if let Some(v) = self.thinking_budget_tokens { - ::buffa::types::put_uint64_field(4u32, v, buf); - } - for v in &self.stop_sequences { - ::buffa::types::put_string_field(5u32, v, buf); - } - if self.raw_settings.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.raw_settings.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ModelSettingsView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - if let ::core::option::Option::Some(__v) = self.max_output_tokens { - __map - .serialize_entry( - "maxOutputTokens", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.temperature { - __map - .serialize_entry( - "temperature", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.top_p { - __map.serialize_entry("topP", &::buffa::json_helpers::ProtoJson(&__v))?; - } - if let ::core::option::Option::Some(__v) = self.thinking_budget_tokens { - __map - .serialize_entry( - "thinkingBudgetTokens", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if !self.stop_sequences.is_empty() { - __map.serialize_entry("stopSequences", &*self.stop_sequences)?; - } - { - if let ::core::option::Option::Some(__v) = self.raw_settings.as_option() { - __map.serialize_entry("rawSettings", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ModelSettingsView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ModelSettings"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ModelSettings"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ModelSettings"; -} -::buffa::impl_default_view_instance!(ModelSettingsView); -::buffa::impl_view_reborrow!(ModelSettingsView); -/** Self-contained, `'static` owned view of a `ModelSettings` message. - - Wraps [`::buffa::OwnedView`]`<`[`ModelSettingsView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ModelSettingsView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ModelSettingsOwnedView(::buffa::OwnedView>); -impl ModelSettingsOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ModelSettingsOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ModelSettingsOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ModelSettings, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ModelSettingsOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ModelSettingsView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ModelSettingsView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ModelSettings { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `max_output_tokens` - #[must_use] - pub fn max_output_tokens(&self) -> ::core::option::Option { - self.0.reborrow().max_output_tokens - } - /// Field 2: `temperature` - #[must_use] - pub fn temperature(&self) -> ::core::option::Option { - self.0.reborrow().temperature - } - /// Field 3: `top_p` - #[must_use] - pub fn top_p(&self) -> ::core::option::Option { - self.0.reborrow().top_p - } - /// Extended-thinking budget, for providers that meter reasoning separately. - /// - /// Field 4: `thinking_budget_tokens` - #[must_use] - pub fn thinking_budget_tokens(&self) -> ::core::option::Option { - self.0.reborrow().thinking_budget_tokens - } - /// Field 5: `stop_sequences` - #[must_use] - pub fn stop_sequences(&self) -> &::buffa::RepeatedView<'_, &'_ str> { - &self.0.reborrow().stop_sequences - } - /// Claim-check to the full provider-specific request settings, for the fields - /// this message does not model. Kept out of line because it is replay input, - /// not projection input: no reader interprets it (D11). - /// - /// Field 6: `raw_settings` - #[must_use] - pub fn raw_settings( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().raw_settings - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ModelSettingsOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ModelSettingsOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ModelSettingsOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ModelSettingsOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ModelSettings { - type View<'a> = ModelSettingsView<'a>; - type ViewHandle = ModelSettingsOwnedView; -} -impl ::serde::Serialize for ModelSettingsOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.model_settings.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.model_settings.rs deleted file mode 100644 index c0d7ecc01..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.model_settings.rs +++ /dev/null @@ -1,297 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/model_settings.proto - -/// ModelSettings is the sampling configuration a generation actually ran with, -/// recorded on AssistantMessageStarted so a replay reproduces the request rather -/// than approximating it from whatever the caller's defaults are at replay time. -/// CanonicalMessage.model already pins which model answered; this pins how it was -/// asked. Every scalar field has explicit presence: unset means the provider -/// default applied, which is a different fact from an explicitly configured -/// zero. stop_sequences is repeated and carries no presence, so an omitted list -/// and an empty list are the same recorded fact. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ModelSettings { - /// Field 1: `max_output_tokens` - #[serde( - rename = "maxOutputTokens", - alias = "max_output_tokens", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub max_output_tokens: ::core::option::Option, - /// Field 2: `temperature` - #[serde( - rename = "temperature", - with = "::buffa::json_helpers::opt_double", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub temperature: ::core::option::Option, - /// Field 3: `top_p` - #[serde( - rename = "topP", - alias = "top_p", - with = "::buffa::json_helpers::opt_double", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub top_p: ::core::option::Option, - /// Extended-thinking budget, for providers that meter reasoning separately. - /// - /// Field 4: `thinking_budget_tokens` - #[serde( - rename = "thinkingBudgetTokens", - alias = "thinking_budget_tokens", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub thinking_budget_tokens: ::core::option::Option, - /// Field 5: `stop_sequences` - #[serde( - rename = "stopSequences", - alias = "stop_sequences", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub stop_sequences: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, - /// Claim-check to the full provider-specific request settings, for the fields - /// this message does not model. Kept out of line because it is replay input, - /// not projection input: no reader interprets it (D11). - /// - /// Field 6: `raw_settings` - #[serde( - rename = "rawSettings", - alias = "raw_settings", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub raw_settings: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for ModelSettings { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ModelSettings") - .field("max_output_tokens", &self.max_output_tokens) - .field("temperature", &self.temperature) - .field("top_p", &self.top_p) - .field("thinking_budget_tokens", &self.thinking_budget_tokens) - .field("stop_sequences", &self.stop_sequences) - .field("raw_settings", &self.raw_settings) - .finish() - } -} -impl ModelSettings { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ModelSettings"; -} -impl ModelSettings { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::max_output_tokens`] to `Some(value)`, consuming and returning `self`. - pub fn with_max_output_tokens(mut self, value: u64) -> Self { - self.max_output_tokens = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::temperature`] to `Some(value)`, consuming and returning `self`. - pub fn with_temperature(mut self, value: f64) -> Self { - self.temperature = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::top_p`] to `Some(value)`, consuming and returning `self`. - pub fn with_top_p(mut self, value: f64) -> Self { - self.top_p = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::thinking_budget_tokens`] to `Some(value)`, consuming and returning `self`. - pub fn with_thinking_budget_tokens(mut self, value: u64) -> Self { - self.thinking_budget_tokens = Some(value); - self - } -} -::buffa::impl_default_instance!(ModelSettings); -impl ::buffa::MessageName for ModelSettings { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ModelSettings"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ModelSettings"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ModelSettings"; -} -impl ::buffa::Message for ModelSettings { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(v) = self.max_output_tokens { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.temperature.is_some() { - size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; - } - if self.top_p.is_some() { - size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; - } - if let Some(v) = self.thinking_budget_tokens { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - for v in &self.stop_sequences { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.raw_settings.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.raw_settings.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(v) = self.max_output_tokens { - ::buffa::types::put_uint64_field(1u32, v, buf); - } - if let Some(v) = self.temperature { - ::buffa::types::put_double_field(2u32, v, buf); - } - if let Some(v) = self.top_p { - ::buffa::types::put_double_field(3u32, v, buf); - } - if let Some(v) = self.thinking_budget_tokens { - ::buffa::types::put_uint64_field(4u32, v, buf); - } - for v in &self.stop_sequences { - ::buffa::types::put_string_field(5u32, v, buf); - } - if self.raw_settings.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.raw_settings.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.max_output_tokens = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Fixed64, - )?; - self.temperature = ::core::option::Option::Some( - ::buffa::types::decode_double(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Fixed64, - )?; - self.top_p = ::core::option::Option::Some( - ::buffa::types::decode_double(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.thinking_budget_tokens = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::decode_string(buf)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - self.stop_sequences.push(__elem); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.raw_settings.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.max_output_tokens = ::core::option::Option::None; - self.temperature = ::core::option::Option::None; - self.top_p = ::core::option::Option::None; - self.thinking_budget_tokens = ::core::option::Option::None; - self.stop_sequences.clear(); - self.raw_settings = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ModelSettings { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __MODEL_SETTINGS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ModelSettings", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_cancellation_requested.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_cancellation_requested.__view.rs deleted file mode 100644 index b61f895fb..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_cancellation_requested.__view.rs +++ /dev/null @@ -1,329 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/operation_cancellation_requested.proto - -/// OperationCancellationRequested records cancellation intent for a reserved -/// operation, separately from its eventual outcome: decide rejects this command -/// as a typed no-op when the operation is already terminal. After intent, the -/// eventual OperationOutcomeRecorded is cancelled, or, if the side effect won -/// the race, succeeded or failed; reconciliation after a crash follows the -/// ledger (ADR#0031 §4, ADR#0035 facet 6). It is an invariant-bearing -/// transition (WRITE_PRECONDITION = At). -#[derive(Clone, Debug, Default)] -pub struct OperationCancellationRequestedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `operation_id` - pub operation_id: &'a str, - /// Command-time reason for the cancellation request; empty when none. - /// - /// Field 3: `reason` - pub reason: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> OperationCancellationRequestedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for OperationCancellationRequestedView<'a> { - type Owned = super::super::OperationCancellationRequested; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::OperationCancellationRequested, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::OperationCancellationRequested, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::OperationCancellationRequested { - session_id: self.session_id.to_string(), - operation_id: self.operation_id.to_string(), - reason: self.reason.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for OperationCancellationRequestedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for OperationCancellationRequestedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("operationId", self.operation_id)?; - } - if let ::core::option::Option::Some(__v) = self.reason { - __map.serialize_entry("reason", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for OperationCancellationRequestedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationCancellationRequested"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationCancellationRequested"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationCancellationRequested"; -} -::buffa::impl_default_view_instance!(OperationCancellationRequestedView); -::buffa::impl_view_reborrow!(OperationCancellationRequestedView); -/** Self-contained, `'static` owned view of a `OperationCancellationRequested` message. - - Wraps [`::buffa::OwnedView`]`<`[`OperationCancellationRequestedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`OperationCancellationRequestedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct OperationCancellationRequestedOwnedView( - ::buffa::OwnedView>, -); -impl OperationCancellationRequestedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationCancellationRequestedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationCancellationRequestedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::OperationCancellationRequested, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationCancellationRequestedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`OperationCancellationRequestedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &OperationCancellationRequestedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::OperationCancellationRequested { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Command-time reason for the cancellation request; empty when none. - /// - /// Field 3: `reason` - #[must_use] - pub fn reason(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().reason - } -} -impl ::core::convert::From< - ::buffa::OwnedView>, -> for OperationCancellationRequestedOwnedView { - fn from( - inner: ::buffa::OwnedView>, - ) -> Self { - OperationCancellationRequestedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: OperationCancellationRequestedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef< - ::buffa::OwnedView>, -> for OperationCancellationRequestedOwnedView { - fn as_ref( - &self, - ) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::OperationCancellationRequested { - type View<'a> = OperationCancellationRequestedView<'a>; - type ViewHandle = OperationCancellationRequestedOwnedView; -} -impl ::serde::Serialize for OperationCancellationRequestedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_cancellation_requested.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_cancellation_requested.rs deleted file mode 100644 index 93e1e6962..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_cancellation_requested.rs +++ /dev/null @@ -1,169 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/operation_cancellation_requested.proto - -/// OperationCancellationRequested records cancellation intent for a reserved -/// operation, separately from its eventual outcome: decide rejects this command -/// as a typed no-op when the operation is already terminal. After intent, the -/// eventual OperationOutcomeRecorded is cancelled, or, if the side effect won -/// the race, succeeded or failed; reconciliation after a crash follows the -/// ledger (ADR#0031 §4, ADR#0035 facet 6). It is an invariant-bearing -/// transition (WRITE_PRECONDITION = At). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct OperationCancellationRequested { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// Command-time reason for the cancellation request; empty when none. - /// - /// Field 3: `reason` - #[serde(rename = "reason", skip_serializing_if = "::core::option::Option::is_none")] - pub reason: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for OperationCancellationRequested { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("OperationCancellationRequested") - .field("session_id", &self.session_id) - .field("operation_id", &self.operation_id) - .field("reason", &self.reason) - .finish() - } -} -impl OperationCancellationRequested { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationCancellationRequested"; -} -impl OperationCancellationRequested { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::reason`] to `Some(value)`, consuming and returning `self`. - pub fn with_reason( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.reason = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(OperationCancellationRequested); -impl ::buffa::MessageName for OperationCancellationRequested { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationCancellationRequested"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationCancellationRequested"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationCancellationRequested"; -} -impl ::buffa::Message for OperationCancellationRequested { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.reason.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.operation_id.clear(); - self.reason = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for OperationCancellationRequested { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __OPERATION_CANCELLATION_REQUESTED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationCancellationRequested", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_outcome_recorded.__oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_outcome_recorded.__oneof.rs deleted file mode 100644 index 7de339715..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_outcome_recorded.__oneof.rs +++ /dev/null @@ -1,82 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/operation_outcome_recorded.proto - -pub mod operation_outcome_recorded { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, PartialEq, Debug)] - pub enum Outcome { - Succeeded(::buffa::alloc::boxed::Box), - Failed(::buffa::alloc::boxed::Box), - Cancelled(::buffa::alloc::boxed::Box), - Unknown(::buffa::alloc::boxed::Box), - } - impl ::buffa::Oneof for Outcome {} - impl From for Outcome { - fn from(v: super::super::super::OperationSucceeded) -> Self { - Self::Succeeded(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::OperationSucceeded) -> Self { - Self::Some(Outcome::from(v)) - } - } - impl From for Outcome { - fn from(v: super::super::super::OperationFailed) -> Self { - Self::Failed(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::OperationFailed) -> Self { - Self::Some(Outcome::from(v)) - } - } - impl From for Outcome { - fn from(v: super::super::super::OperationCancelled) -> Self { - Self::Cancelled(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::OperationCancelled) -> Self { - Self::Some(Outcome::from(v)) - } - } - impl From for Outcome { - fn from(v: super::super::super::OperationUnknown) -> Self { - Self::Unknown(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::OperationUnknown) -> Self { - Self::Some(Outcome::from(v)) - } - } - impl serde::Serialize for Outcome { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::Succeeded(v) => { - map.serialize_entry("succeeded", v)?; - } - Self::Failed(v) => { - map.serialize_entry("failed", v)?; - } - Self::Cancelled(v) => { - map.serialize_entry("cancelled", v)?; - } - Self::Unknown(v) => { - map.serialize_entry("unknown", v)?; - } - } - map.end() - } - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_outcome_recorded.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_outcome_recorded.__view.rs deleted file mode 100644 index 43bcf583f..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_outcome_recorded.__view.rs +++ /dev/null @@ -1,1803 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/operation_outcome_recorded.proto - -/// OperationOutcomeRecorded reconciles a reserved operation's outcome as a typed -/// oneof, including a non-terminal unknown outcome that does not auto-repeat the -/// side effect (ADR#0031 §4). unknown may be superseded exactly once by a -/// determinate outcome (succeeded, failed, or cancelled) under the At guard; -/// every determinate outcome is terminal, one per operation_id. The join key is -/// operation_id alone -- correlation_id is meaningful on the dispatch event -/// (DelegationDispatched, ExternalDelegationDispatched), not here. The ledger -/// deduplicates by operation id and digest; it is not exactly-once execution. -/// It is an invariant-bearing transition (WRITE_PRECONDITION = At). -#[derive(Clone, Debug, Default)] -pub struct OperationOutcomeRecordedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `operation_id` - pub operation_id: &'a str, - pub outcome: ::core::option::Option< - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> OperationOutcomeRecordedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for OperationOutcomeRecordedView<'a> { - type Owned = super::super::OperationOutcomeRecorded; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Succeeded( - ref mut existing, - ), - ) = view.outcome - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.outcome = Some( - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Succeeded( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Failed( - ref mut existing, - ), - ) = view.outcome - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.outcome = Some( - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Failed( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Cancelled( - ref mut existing, - ), - ) = view.outcome - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.outcome = Some( - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Cancelled( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Unknown( - ref mut existing, - ), - ) = view.outcome - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.outcome = Some( - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Unknown( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::OperationOutcomeRecorded, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::OperationOutcomeRecorded, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::OperationOutcomeRecorded { - session_id: self.session_id.to_string(), - operation_id: self.operation_id.to_string(), - outcome: match self.outcome.as_ref() { - ::core::option::Option::Some(v) => { - ::core::option::Option::Some( - match v { - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Succeeded( - v, - ) => { - super::super::__buffa::oneof::operation_outcome_recorded::Outcome::Succeeded( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Failed( - v, - ) => { - super::super::__buffa::oneof::operation_outcome_recorded::Outcome::Failed( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Cancelled( - v, - ) => { - super::super::__buffa::oneof::operation_outcome_recorded::Outcome::Cancelled( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Unknown( - v, - ) => { - super::super::__buffa::oneof::operation_outcome_recorded::Outcome::Unknown( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - }, - ) - } - ::core::option::Option::None => ::core::option::Option::None, - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for OperationOutcomeRecordedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Succeeded( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Failed( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Cancelled( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Unknown( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Succeeded( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Failed( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Cancelled( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Unknown( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for OperationOutcomeRecordedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("operationId", self.operation_id)?; - } - if let ::core::option::Option::Some(ref __ov) = self.outcome { - match __ov { - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Succeeded( - v, - ) => { - __map.serialize_entry("succeeded", v)?; - } - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Failed( - v, - ) => { - __map.serialize_entry("failed", v)?; - } - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Cancelled( - v, - ) => { - __map.serialize_entry("cancelled", v)?; - } - super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome::Unknown( - v, - ) => { - __map.serialize_entry("unknown", v)?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for OperationOutcomeRecordedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationOutcomeRecorded"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationOutcomeRecorded"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationOutcomeRecorded"; -} -::buffa::impl_default_view_instance!(OperationOutcomeRecordedView); -::buffa::impl_view_reborrow!(OperationOutcomeRecordedView); -/** Self-contained, `'static` owned view of a `OperationOutcomeRecorded` message. - - Wraps [`::buffa::OwnedView`]`<`[`OperationOutcomeRecordedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`OperationOutcomeRecordedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct OperationOutcomeRecordedOwnedView( - ::buffa::OwnedView>, -); -impl OperationOutcomeRecordedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationOutcomeRecordedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationOutcomeRecordedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::OperationOutcomeRecorded, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationOutcomeRecordedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`OperationOutcomeRecordedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &OperationOutcomeRecordedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::OperationOutcomeRecorded { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Oneof `outcome`. - #[must_use] - pub fn outcome( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::operation_outcome_recorded::Outcome<'_>, - > { - self.0.reborrow().outcome.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for OperationOutcomeRecordedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - OperationOutcomeRecordedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: OperationOutcomeRecordedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for OperationOutcomeRecordedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::OperationOutcomeRecorded { - type View<'a> = OperationOutcomeRecordedView<'a>; - type ViewHandle = OperationOutcomeRecordedOwnedView; -} -impl ::serde::Serialize for OperationOutcomeRecordedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// OperationSucceeded is the determinate success outcome of a reserved -/// operation. -#[derive(Clone, Debug, Default)] -pub struct OperationSucceededView<'a> { - /// Digest over the response bytes, verified before decode. - /// - /// Field 1: `response_digest` - pub response_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Claim-check to the response when it was durably stored; unset when the - /// response was not retained as an artifact. - /// - /// Field 2: `response_ref` - pub response_ref: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactRefView<'a>, - >, -} -impl<'a> OperationSucceededView<'a> { - /**Whether required field `response_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_response_digest(&self) -> bool { - self.response_digest.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for OperationSucceededView<'a> { - type Owned = super::super::OperationSucceeded; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.response_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.response_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.response_ref.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.response_ref = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::OperationSucceeded { - response_digest: match self.response_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - response_ref: match self.response_ref.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for OperationSucceededView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.response_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.response_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.response_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.response_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.response_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.response_digest.write_to(__cache, buf); - } - if self.response_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.response_ref.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for OperationSucceededView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - if let ::core::option::Option::Some(__v) = self.response_digest.as_option() { - __map.serialize_entry("responseDigest", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.response_ref.as_option() { - __map.serialize_entry("responseRef", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for OperationSucceededView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationSucceeded"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationSucceeded"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationSucceeded"; -} -::buffa::impl_default_view_instance!(OperationSucceededView); -::buffa::impl_view_reborrow!(OperationSucceededView); -/** Self-contained, `'static` owned view of a `OperationSucceeded` message. - - Wraps [`::buffa::OwnedView`]`<`[`OperationSucceededView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`OperationSucceededView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct OperationSucceededOwnedView( - ::buffa::OwnedView>, -); -impl OperationSucceededOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationSucceededOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationSucceededOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::OperationSucceeded, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationSucceededOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`OperationSucceededView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &OperationSucceededView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::OperationSucceeded { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Digest over the response bytes, verified before decode. - /// - /// Field 1: `response_digest` - #[must_use] - pub fn response_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().response_digest - } - /// Claim-check to the response when it was durably stored; unset when the - /// response was not retained as an artifact. - /// - /// Field 2: `response_ref` - #[must_use] - pub fn response_ref( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().response_ref - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for OperationSucceededOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - OperationSucceededOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: OperationSucceededOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for OperationSucceededOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::OperationSucceeded { - type View<'a> = OperationSucceededView<'a>; - type ViewHandle = OperationSucceededOwnedView; -} -impl ::serde::Serialize for OperationSucceededOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// OperationFailed is the determinate failure outcome of a reserved operation. -#[derive(Clone, Debug, Default)] -pub struct OperationFailedView<'a> { - /// Human-readable failure detail. - /// - /// Field 1: `detail` - pub detail: &'a str, - /// Digest over failure evidence bytes when retained; unset when none. - /// - /// Field 2: `failure_digest` - pub failure_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> OperationFailedView<'a> { - /**Whether required field `detail` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_detail(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for OperationFailedView<'a> { - type Owned = super::super::OperationFailed; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.failure_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.failure_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::OperationFailed { - detail: self.detail.to_string(), - failure_digest: match self.failure_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for OperationFailedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.detail) as u64; - if self.failure_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.failure_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.detail, buf); - if self.failure_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.failure_digest.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for OperationFailedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("detail", self.detail)?; - } - { - if let ::core::option::Option::Some(__v) = self.failure_digest.as_option() { - __map.serialize_entry("failureDigest", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for OperationFailedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationFailed"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationFailed"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationFailed"; -} -::buffa::impl_default_view_instance!(OperationFailedView); -::buffa::impl_view_reborrow!(OperationFailedView); -/** Self-contained, `'static` owned view of a `OperationFailed` message. - - Wraps [`::buffa::OwnedView`]`<`[`OperationFailedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`OperationFailedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct OperationFailedOwnedView(::buffa::OwnedView>); -impl OperationFailedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationFailedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationFailedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::OperationFailed, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationFailedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`OperationFailedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &OperationFailedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::OperationFailed { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Human-readable failure detail. - /// - /// Field 1: `detail` - #[must_use] - pub fn detail(&self) -> &'_ str { - self.0.reborrow().detail - } - /// Digest over failure evidence bytes when retained; unset when none. - /// - /// Field 2: `failure_digest` - #[must_use] - pub fn failure_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().failure_digest - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for OperationFailedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - OperationFailedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: OperationFailedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for OperationFailedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::OperationFailed { - type View<'a> = OperationFailedView<'a>; - type ViewHandle = OperationFailedOwnedView; -} -impl ::serde::Serialize for OperationFailedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// OperationCancelled is the determinate cancellation outcome of a reserved -/// operation, distinct from OperationFailed and OperationUnknown (e.g. a -/// child-session delegation cancelled by parent-terminal cascade). -#[derive(Clone, Debug, Default)] -pub struct OperationCancelledView<'a> { - /// Principal or process that cancelled the operation. - /// - /// Field 1: `cancelled_by` - pub cancelled_by: &'a str, - /// Command-time reason for the cancellation; empty when none. - /// - /// Field 2: `reason` - pub reason: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> OperationCancelledView<'a> { - /**Whether required field `cancelled_by` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_cancelled_by(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for OperationCancelledView<'a> { - type Owned = super::super::OperationCancelled; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.cancelled_by = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::OperationCancelled { - cancelled_by: self.cancelled_by.to_string(), - reason: self.reason.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for OperationCancelledView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.cancelled_by) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.cancelled_by, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(2u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for OperationCancelledView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("cancelledBy", self.cancelled_by)?; - } - if let ::core::option::Option::Some(__v) = self.reason { - __map.serialize_entry("reason", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for OperationCancelledView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationCancelled"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationCancelled"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationCancelled"; -} -::buffa::impl_default_view_instance!(OperationCancelledView); -::buffa::impl_view_reborrow!(OperationCancelledView); -/** Self-contained, `'static` owned view of a `OperationCancelled` message. - - Wraps [`::buffa::OwnedView`]`<`[`OperationCancelledView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`OperationCancelledView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct OperationCancelledOwnedView( - ::buffa::OwnedView>, -); -impl OperationCancelledOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationCancelledOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationCancelledOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::OperationCancelled, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationCancelledOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`OperationCancelledView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &OperationCancelledView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::OperationCancelled { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Principal or process that cancelled the operation. - /// - /// Field 1: `cancelled_by` - #[must_use] - pub fn cancelled_by(&self) -> &'_ str { - self.0.reborrow().cancelled_by - } - /// Command-time reason for the cancellation; empty when none. - /// - /// Field 2: `reason` - #[must_use] - pub fn reason(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for OperationCancelledOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - OperationCancelledOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: OperationCancelledOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for OperationCancelledOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::OperationCancelled { - type View<'a> = OperationCancelledView<'a>; - type ViewHandle = OperationCancelledOwnedView; -} -impl ::serde::Serialize for OperationCancelledOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// OperationUnknown is the indeterminate outcome recorded when the operation's -/// resolution could not be determined; it is non-terminal and may be superseded -/// exactly once by a determinate outcome. -#[derive(Clone, Debug, Default)] -pub struct OperationUnknownView<'a> { - /// Human-readable detail of why the outcome is indeterminate; empty when none. - /// - /// Field 1: `detail` - pub detail: ::core::option::Option<&'a str>, -} -impl<'a> ::buffa::MessageView<'a> for OperationUnknownView<'a> { - type Owned = super::super::OperationUnknown; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::OperationUnknown { - detail: self.detail.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for OperationUnknownView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(1u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for OperationUnknownView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for OperationUnknownView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationUnknown"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationUnknown"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationUnknown"; -} -::buffa::impl_default_view_instance!(OperationUnknownView); -::buffa::impl_view_reborrow!(OperationUnknownView); -/** Self-contained, `'static` owned view of a `OperationUnknown` message. - - Wraps [`::buffa::OwnedView`]`<`[`OperationUnknownView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`OperationUnknownView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct OperationUnknownOwnedView(::buffa::OwnedView>); -impl OperationUnknownOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationUnknownOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationUnknownOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::OperationUnknown, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationUnknownOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`OperationUnknownView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &OperationUnknownView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::OperationUnknown { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Human-readable detail of why the outcome is indeterminate; empty when none. - /// - /// Field 1: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for OperationUnknownOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - OperationUnknownOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: OperationUnknownOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for OperationUnknownOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::OperationUnknown { - type View<'a> = OperationUnknownView<'a>; - type ViewHandle = OperationUnknownOwnedView; -} -impl ::serde::Serialize for OperationUnknownOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_outcome_recorded.__view_oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_outcome_recorded.__view_oneof.rs deleted file mode 100644 index 75c4a508b..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_outcome_recorded.__view_oneof.rs +++ /dev/null @@ -1,30 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/operation_outcome_recorded.proto - -pub mod operation_outcome_recorded { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Outcome<'a> { - Succeeded( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::OperationSucceededView<'a>, - >, - ), - Failed( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::OperationFailedView<'a>, - >, - ), - Cancelled( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::OperationCancelledView<'a>, - >, - ), - Unknown( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::OperationUnknownView<'a>, - >, - ), - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_outcome_recorded.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_outcome_recorded.rs deleted file mode 100644 index 40442d06e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_outcome_recorded.rs +++ /dev/null @@ -1,1063 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/operation_outcome_recorded.proto - -/// OperationOutcomeRecorded reconciles a reserved operation's outcome as a typed -/// oneof, including a non-terminal unknown outcome that does not auto-repeat the -/// side effect (ADR#0031 §4). unknown may be superseded exactly once by a -/// determinate outcome (succeeded, failed, or cancelled) under the At guard; -/// every determinate outcome is terminal, one per operation_id. The join key is -/// operation_id alone -- correlation_id is meaningful on the dispatch event -/// (DelegationDispatched, ExternalDelegationDispatched), not here. The ledger -/// deduplicates by operation id and digest; it is not exactly-once execution. -/// It is an invariant-bearing transition (WRITE_PRECONDITION = At). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct OperationOutcomeRecorded { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - #[serde(flatten)] - pub outcome: ::core::option::Option< - __buffa::oneof::operation_outcome_recorded::Outcome, - >, -} -impl ::core::fmt::Debug for OperationOutcomeRecorded { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("OperationOutcomeRecorded") - .field("session_id", &self.session_id) - .field("operation_id", &self.operation_id) - .field("outcome", &self.outcome) - .finish() - } -} -impl OperationOutcomeRecorded { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationOutcomeRecorded"; -} -::buffa::impl_default_instance!(OperationOutcomeRecorded); -impl ::buffa::MessageName for OperationOutcomeRecorded { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationOutcomeRecorded"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationOutcomeRecorded"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationOutcomeRecorded"; -} -impl ::buffa::Message for OperationOutcomeRecorded { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - __buffa::oneof::operation_outcome_recorded::Outcome::Succeeded(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::operation_outcome_recorded::Outcome::Failed(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::operation_outcome_recorded::Outcome::Cancelled(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::operation_outcome_recorded::Outcome::Unknown(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - __buffa::oneof::operation_outcome_recorded::Outcome::Succeeded(x) => { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::operation_outcome_recorded::Outcome::Failed(x) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::operation_outcome_recorded::Outcome::Cancelled(x) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::operation_outcome_recorded::Outcome::Unknown(x) => { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::operation_outcome_recorded::Outcome::Succeeded( - ref mut existing, - ), - ) = self.outcome - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.outcome = ::core::option::Option::Some( - __buffa::oneof::operation_outcome_recorded::Outcome::Succeeded( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::operation_outcome_recorded::Outcome::Failed( - ref mut existing, - ), - ) = self.outcome - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.outcome = ::core::option::Option::Some( - __buffa::oneof::operation_outcome_recorded::Outcome::Failed( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::operation_outcome_recorded::Outcome::Cancelled( - ref mut existing, - ), - ) = self.outcome - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.outcome = ::core::option::Option::Some( - __buffa::oneof::operation_outcome_recorded::Outcome::Cancelled( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::operation_outcome_recorded::Outcome::Unknown( - ref mut existing, - ), - ) = self.outcome - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.outcome = ::core::option::Option::Some( - __buffa::oneof::operation_outcome_recorded::Outcome::Unknown( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.operation_id.clear(); - self.outcome = ::core::option::Option::None; - } -} -impl<'de> serde::Deserialize<'de> for OperationOutcomeRecorded { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = OperationOutcomeRecorded; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct OperationOutcomeRecorded") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __f_session_id: ::core::option::Option< - ::buffa::alloc::string::String, - > = None; - let mut __f_operation_id: ::core::option::Option< - ::buffa::alloc::string::String, - > = None; - let mut __oneof_outcome: ::core::option::Option< - __buffa::oneof::operation_outcome_recorded::Outcome, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "sessionId" | "session_id" => { - __f_session_id = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::alloc::string::String; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::string::String, - D::Error, - > { - ::buffa::json_helpers::proto_string::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "operationId" | "operation_id" => { - __f_operation_id = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::alloc::string::String; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::string::String, - D::Error, - > { - ::buffa::json_helpers::proto_string::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "succeeded" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - OperationSucceeded, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_outcome.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'outcome'", - ), - ); - } - __oneof_outcome = Some( - __buffa::oneof::operation_outcome_recorded::Outcome::Succeeded( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "failed" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - OperationFailed, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_outcome.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'outcome'", - ), - ); - } - __oneof_outcome = Some( - __buffa::oneof::operation_outcome_recorded::Outcome::Failed( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "cancelled" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - OperationCancelled, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_outcome.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'outcome'", - ), - ); - } - __oneof_outcome = Some( - __buffa::oneof::operation_outcome_recorded::Outcome::Cancelled( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "unknown" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - OperationUnknown, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_outcome.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'outcome'", - ), - ); - } - __oneof_outcome = Some( - __buffa::oneof::operation_outcome_recorded::Outcome::Unknown( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - if let ::core::option::Option::Some(v) = __f_session_id { - __r.session_id = v; - } - if let ::core::option::Option::Some(v) = __f_operation_id { - __r.operation_id = v; - } - __r.outcome = __oneof_outcome; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for OperationOutcomeRecorded { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __OPERATION_OUTCOME_RECORDED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationOutcomeRecorded", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod operation_outcome_recorded { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::operation_outcome_recorded::Outcome; - #[doc(inline)] - pub use super::__buffa::view::oneof::operation_outcome_recorded::Outcome as OutcomeView; -} -/// OperationSucceeded is the determinate success outcome of a reserved -/// operation. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct OperationSucceeded { - /// Digest over the response bytes, verified before decode. - /// - /// Field 1: `response_digest` - #[serde(rename = "responseDigest", alias = "response_digest")] - pub response_digest: ::buffa::MessageField>, - /// Claim-check to the response when it was durably stored; unset when the - /// response was not retained as an artifact. - /// - /// Field 2: `response_ref` - #[serde( - rename = "responseRef", - alias = "response_ref", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub response_ref: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for OperationSucceeded { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("OperationSucceeded") - .field("response_digest", &self.response_digest) - .field("response_ref", &self.response_ref) - .finish() - } -} -impl OperationSucceeded { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationSucceeded"; -} -::buffa::impl_default_instance!(OperationSucceeded); -impl ::buffa::MessageName for OperationSucceeded { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationSucceeded"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationSucceeded"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationSucceeded"; -} -impl ::buffa::Message for OperationSucceeded { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if self.response_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.response_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.response_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.response_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if self.response_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - self.response_digest.write_to(__cache, buf); - } - if self.response_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.response_ref.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.response_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.response_ref.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.response_digest = ::buffa::MessageField::none(); - self.response_ref = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for OperationSucceeded { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __OPERATION_SUCCEEDED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationSucceeded", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// OperationFailed is the determinate failure outcome of a reserved operation. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct OperationFailed { - /// Human-readable failure detail. - /// - /// Field 1: `detail` - #[serde(rename = "detail", with = "::buffa::json_helpers::proto_string")] - pub detail: ::buffa::alloc::string::String, - /// Digest over failure evidence bytes when retained; unset when none. - /// - /// Field 2: `failure_digest` - #[serde( - rename = "failureDigest", - alias = "failure_digest", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub failure_digest: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for OperationFailed { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("OperationFailed") - .field("detail", &self.detail) - .field("failure_digest", &self.failure_digest) - .finish() - } -} -impl OperationFailed { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationFailed"; -} -::buffa::impl_default_instance!(OperationFailed); -impl ::buffa::MessageName for OperationFailed { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationFailed"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationFailed"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationFailed"; -} -impl ::buffa::Message for OperationFailed { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.detail) as u64; - if self.failure_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.failure_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.detail, buf); - if self.failure_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.failure_digest.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.detail, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.failure_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.detail.clear(); - self.failure_digest = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for OperationFailed { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __OPERATION_FAILED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationFailed", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// OperationCancelled is the determinate cancellation outcome of a reserved -/// operation, distinct from OperationFailed and OperationUnknown (e.g. a -/// child-session delegation cancelled by parent-terminal cascade). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct OperationCancelled { - /// Principal or process that cancelled the operation. - /// - /// Field 1: `cancelled_by` - #[serde( - rename = "cancelledBy", - alias = "cancelled_by", - with = "::buffa::json_helpers::proto_string" - )] - pub cancelled_by: ::buffa::alloc::string::String, - /// Command-time reason for the cancellation; empty when none. - /// - /// Field 2: `reason` - #[serde(rename = "reason", skip_serializing_if = "::core::option::Option::is_none")] - pub reason: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for OperationCancelled { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("OperationCancelled") - .field("cancelled_by", &self.cancelled_by) - .field("reason", &self.reason) - .finish() - } -} -impl OperationCancelled { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationCancelled"; -} -impl OperationCancelled { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::reason`] to `Some(value)`, consuming and returning `self`. - pub fn with_reason( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.reason = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(OperationCancelled); -impl ::buffa::MessageName for OperationCancelled { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationCancelled"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationCancelled"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationCancelled"; -} -impl ::buffa::Message for OperationCancelled { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.cancelled_by) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.cancelled_by, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(2u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.cancelled_by, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.reason.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.cancelled_by.clear(); - self.reason = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for OperationCancelled { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __OPERATION_CANCELLED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationCancelled", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// OperationUnknown is the indeterminate outcome recorded when the operation's -/// resolution could not be determined; it is non-terminal and may be superseded -/// exactly once by a determinate outcome. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct OperationUnknown { - /// Human-readable detail of why the outcome is indeterminate; empty when none. - /// - /// Field 1: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for OperationUnknown { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("OperationUnknown").field("detail", &self.detail).finish() - } -} -impl OperationUnknown { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationUnknown"; -} -impl OperationUnknown { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(OperationUnknown); -impl ::buffa::MessageName for OperationUnknown { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationUnknown"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationUnknown"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationUnknown"; -} -impl ::buffa::Message for OperationUnknown { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(1u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.detail = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for OperationUnknown { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __OPERATION_UNKNOWN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationUnknown", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_reserved.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_reserved.__view.rs deleted file mode 100644 index 8b6b423a4..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_reserved.__view.rs +++ /dev/null @@ -1,390 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/operation_reserved.proto - -/// OperationReserved reserves an operation id and request digest before a -/// side effect, so a retry with the same id and bytes observes the -/// reservation (ADR#0031 §4, ADR#0035 facet 3). It is an invariant-bearing -/// transition (WRITE_PRECONDITION = At), making the reserve-and-check atomic. -#[derive(Clone, Debug, Default)] -pub struct OperationReservedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `operation_id` - pub operation_id: &'a str, - /// Field 3: `request_digest` - pub request_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Field 4: `operation_kind` - pub operation_kind: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> OperationReservedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `request_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_request_digest(&self) -> bool { - self.request_digest.is_set() - } - /**Whether required field `operation_kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_kind(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for OperationReservedView<'a> { - type Owned = super::super::OperationReserved; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.request_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.request_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.operation_kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::OperationReserved { - session_id: self.session_id.to_string(), - operation_id: self.operation_id.to_string(), - request_digest: match self.request_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - operation_kind: self.operation_kind, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for OperationReservedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if self.request_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.request_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.operation_kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - if self.request_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.request_digest.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(4u32, self.operation_kind.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for OperationReservedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("operationId", self.operation_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.request_digest.as_option() { - __map.serialize_entry("requestDigest", __v)?; - } - } - { - __map.serialize_entry("operationKind", &self.operation_kind)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for OperationReservedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationReserved"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationReserved"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationReserved"; -} -::buffa::impl_default_view_instance!(OperationReservedView); -::buffa::impl_view_reborrow!(OperationReservedView); -/** Self-contained, `'static` owned view of a `OperationReserved` message. - - Wraps [`::buffa::OwnedView`]`<`[`OperationReservedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`OperationReservedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct OperationReservedOwnedView( - ::buffa::OwnedView>, -); -impl OperationReservedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationReservedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationReservedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::OperationReserved, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - OperationReservedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`OperationReservedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &OperationReservedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::OperationReserved { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Field 3: `request_digest` - #[must_use] - pub fn request_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().request_digest - } - /// Field 4: `operation_kind` - #[must_use] - pub fn operation_kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().operation_kind - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for OperationReservedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - OperationReservedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: OperationReservedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for OperationReservedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::OperationReserved { - type View<'a> = OperationReservedView<'a>; - type ViewHandle = OperationReservedOwnedView; -} -impl ::serde::Serialize for OperationReservedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_reserved.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_reserved.rs deleted file mode 100644 index 4ca86d650..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.operation_reserved.rs +++ /dev/null @@ -1,362 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/operation_reserved.proto - -/// OperationKind is the kind of side effect an operation guards. Model -/// requests explicitly do not use the operation ledger in v1alpha1; their -/// retry and billing identity is message_id plus attempt, recorded via the -/// message events and TokenUsage. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum OperationKind { - OPERATION_KIND_UNSPECIFIED = 0i32, - OPERATION_KIND_TOOL = 1i32, - OPERATION_KIND_CHILD_SESSION_DELEGATION = 2i32, - OPERATION_KIND_EXTERNAL_DELEGATION = 3i32, -} -impl OperationKind { - ///Idiomatic alias for [`Self::OPERATION_KIND_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::OPERATION_KIND_UNSPECIFIED; - ///Idiomatic alias for [`Self::OPERATION_KIND_TOOL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Tool: Self = Self::OPERATION_KIND_TOOL; - ///Idiomatic alias for [`Self::OPERATION_KIND_CHILD_SESSION_DELEGATION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ChildSessionDelegation: Self = Self::OPERATION_KIND_CHILD_SESSION_DELEGATION; - ///Idiomatic alias for [`Self::OPERATION_KIND_EXTERNAL_DELEGATION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ExternalDelegation: Self = Self::OPERATION_KIND_EXTERNAL_DELEGATION; -} -impl ::core::default::Default for OperationKind { - fn default() -> Self { - Self::OPERATION_KIND_UNSPECIFIED - } -} -impl ::serde::Serialize for OperationKind { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for OperationKind { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = OperationKind; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(OperationKind)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for OperationKind { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for OperationKind { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::OPERATION_KIND_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::OPERATION_KIND_TOOL), - 2i32 => { - ::core::option::Option::Some( - Self::OPERATION_KIND_CHILD_SESSION_DELEGATION, - ) - } - 3i32 => { - ::core::option::Option::Some(Self::OPERATION_KIND_EXTERNAL_DELEGATION) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::OPERATION_KIND_UNSPECIFIED => "OPERATION_KIND_UNSPECIFIED", - Self::OPERATION_KIND_TOOL => "OPERATION_KIND_TOOL", - Self::OPERATION_KIND_CHILD_SESSION_DELEGATION => { - "OPERATION_KIND_CHILD_SESSION_DELEGATION" - } - Self::OPERATION_KIND_EXTERNAL_DELEGATION => { - "OPERATION_KIND_EXTERNAL_DELEGATION" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "OPERATION_KIND_UNSPECIFIED" => { - ::core::option::Option::Some(Self::OPERATION_KIND_UNSPECIFIED) - } - "OPERATION_KIND_TOOL" => { - ::core::option::Option::Some(Self::OPERATION_KIND_TOOL) - } - "OPERATION_KIND_CHILD_SESSION_DELEGATION" => { - ::core::option::Option::Some( - Self::OPERATION_KIND_CHILD_SESSION_DELEGATION, - ) - } - "OPERATION_KIND_EXTERNAL_DELEGATION" => { - ::core::option::Option::Some(Self::OPERATION_KIND_EXTERNAL_DELEGATION) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::OPERATION_KIND_UNSPECIFIED, - Self::OPERATION_KIND_TOOL, - Self::OPERATION_KIND_CHILD_SESSION_DELEGATION, - Self::OPERATION_KIND_EXTERNAL_DELEGATION, - ] - } -} -/// OperationReserved reserves an operation id and request digest before a -/// side effect, so a retry with the same id and bytes observes the -/// reservation (ADR#0031 §4, ADR#0035 facet 3). It is an invariant-bearing -/// transition (WRITE_PRECONDITION = At), making the reserve-and-check atomic. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct OperationReserved { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// Field 3: `request_digest` - #[serde(rename = "requestDigest", alias = "request_digest")] - pub request_digest: ::buffa::MessageField>, - /// Field 4: `operation_kind` - #[serde( - rename = "operationKind", - alias = "operation_kind", - with = "::buffa::json_helpers::proto_enum" - )] - pub operation_kind: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for OperationReserved { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("OperationReserved") - .field("session_id", &self.session_id) - .field("operation_id", &self.operation_id) - .field("request_digest", &self.request_digest) - .field("operation_kind", &self.operation_kind) - .finish() - } -} -impl OperationReserved { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationReserved"; -} -::buffa::impl_default_instance!(OperationReserved); -impl ::buffa::MessageName for OperationReserved { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "OperationReserved"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.OperationReserved"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationReserved"; -} -impl ::buffa::Message for OperationReserved { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if self.request_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.request_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.operation_kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - if self.request_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.request_digest.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(4u32, self.operation_kind.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.request_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.operation_kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.operation_id.clear(); - self.request_digest = ::buffa::MessageField::none(); - self.operation_kind = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for OperationReserved { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __OPERATION_RESERVED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.OperationReserved", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_detached.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_detached.__view.rs deleted file mode 100644 index f0be070f8..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_detached.__view.rs +++ /dev/null @@ -1,324 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/parent_detached.proto - -/// ParentDetached is the child-side counterpart to the parent's -/// DelegationDetached: two causally linked local facts joined by one durable -/// saga id (detach_operation_id) rather than a mirrored write -- each stream -/// records its own invariant-bearing local fact, satisfying ADR#0024's -/// record-once rule (ADR#0035 facet 6). Crash repair: the reconciler completes -/// the missing side idempotently, deduped by detach_operation_id; a duplicate -/// delivery no-ops because decide sees the operation id already folded. It is -/// an invariant-bearing transition (WRITE_PRECONDITION = At). -#[derive(Clone, Debug, Default)] -pub struct ParentDetachedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `parent_session_id` - pub parent_session_id: &'a str, - /// Durable saga id joining this fact to the parent's own DelegationDetached. - /// - /// Field 3: `detach_operation_id` - pub detach_operation_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ParentDetachedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `parent_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `detach_operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_detach_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ParentDetachedView<'a> { - type Owned = super::super::ParentDetached; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.parent_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detach_operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ParentDetached { - session_id: self.session_id.to_string(), - parent_session_id: self.parent_session_id.to_string(), - detach_operation_id: self.detach_operation_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ParentDetachedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.detach_operation_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - ::buffa::types::put_string_field(3u32, &self.detach_operation_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ParentDetachedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("parentSessionId", self.parent_session_id)?; - } - { - __map.serialize_entry("detachOperationId", self.detach_operation_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ParentDetachedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ParentDetached"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ParentDetached"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentDetached"; -} -::buffa::impl_default_view_instance!(ParentDetachedView); -::buffa::impl_view_reborrow!(ParentDetachedView); -/** Self-contained, `'static` owned view of a `ParentDetached` message. - - Wraps [`::buffa::OwnedView`]`<`[`ParentDetachedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ParentDetachedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ParentDetachedOwnedView(::buffa::OwnedView>); -impl ParentDetachedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentDetachedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentDetachedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ParentDetached, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentDetachedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ParentDetachedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ParentDetachedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ParentDetached { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `parent_session_id` - #[must_use] - pub fn parent_session_id(&self) -> &'_ str { - self.0.reborrow().parent_session_id - } - /// Durable saga id joining this fact to the parent's own DelegationDetached. - /// - /// Field 3: `detach_operation_id` - #[must_use] - pub fn detach_operation_id(&self) -> &'_ str { - self.0.reborrow().detach_operation_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ParentDetachedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ParentDetachedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ParentDetachedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ParentDetachedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ParentDetached { - type View<'a> = ParentDetachedView<'a>; - type ViewHandle = ParentDetachedOwnedView; -} -impl ::serde::Serialize for ParentDetachedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_detached.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_detached.rs deleted file mode 100644 index 9e208cf1f..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_detached.rs +++ /dev/null @@ -1,158 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/parent_detached.proto - -/// ParentDetached is the child-side counterpart to the parent's -/// DelegationDetached: two causally linked local facts joined by one durable -/// saga id (detach_operation_id) rather than a mirrored write -- each stream -/// records its own invariant-bearing local fact, satisfying ADR#0024's -/// record-once rule (ADR#0035 facet 6). Crash repair: the reconciler completes -/// the missing side idempotently, deduped by detach_operation_id; a duplicate -/// delivery no-ops because decide sees the operation id already folded. It is -/// an invariant-bearing transition (WRITE_PRECONDITION = At). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ParentDetached { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `parent_session_id` - #[serde( - rename = "parentSessionId", - alias = "parent_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub parent_session_id: ::buffa::alloc::string::String, - /// Durable saga id joining this fact to the parent's own DelegationDetached. - /// - /// Field 3: `detach_operation_id` - #[serde( - rename = "detachOperationId", - alias = "detach_operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub detach_operation_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for ParentDetached { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ParentDetached") - .field("session_id", &self.session_id) - .field("parent_session_id", &self.parent_session_id) - .field("detach_operation_id", &self.detach_operation_id) - .finish() - } -} -impl ParentDetached { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentDetached"; -} -::buffa::impl_default_instance!(ParentDetached); -impl ::buffa::MessageName for ParentDetached { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ParentDetached"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ParentDetached"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentDetached"; -} -impl ::buffa::Message for ParentDetached { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.detach_operation_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - ::buffa::types::put_string_field(3u32, &self.detach_operation_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.parent_session_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.detach_operation_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.parent_session_id.clear(); - self.detach_operation_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ParentDetached { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PARENT_DETACHED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentDetached", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_history_invalidated.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_history_invalidated.__view.rs deleted file mode 100644 index aad1321ee..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_history_invalidated.__view.rs +++ /dev/null @@ -1,419 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/parent_history_invalidated.proto - -/// ParentHistoryInvalidated is recorded on the child session's stream by the -/// reconciler when the parent rewound past this child's dispatch point; it is -/// emitted as one atomic \[ParentHistoryInvalidated, SessionCancelled{reason = -/// PARENT_REWIND_CASCADE}\] batch when the child's cascade_policy is -/// CASCADE_ON_PARENT_TERMINAL (an INDEPENDENT child records nothing and keeps -/// running). Rewind cascade is not termination in the same sense as -/// ParentTerminated: it fires because the parent's own history that dispatched -/// this child is no longer valid, not because the parent reached a terminal -/// state (ADR#0035 facet 6). It is an invariant-bearing transition -/// (WRITE_PRECONDITION = At). -#[derive(Clone, Debug, Default)] -pub struct ParentHistoryInvalidatedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `parent_session_id` - pub parent_session_id: &'a str, - /// The parent's SessionRewound.keep_through boundary that invalidated this - /// child: this child's ParentLinked.parent_dispatched_at was strictly greater - /// than it. - /// - /// Field 3: `parent_keep_through` - pub parent_keep_through: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Event id of the parent's SessionRewound that triggered this cascade, for - /// audit traceability back to the exact triggering fact. - /// - /// Field 4: `triggering_event_id` - pub triggering_event_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ParentHistoryInvalidatedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `parent_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `parent_keep_through` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_keep_through(&self) -> bool { - self.parent_keep_through.is_set() - } - /**Whether required field `triggering_event_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_triggering_event_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ParentHistoryInvalidatedView<'a> { - type Owned = super::super::ParentHistoryInvalidated; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.parent_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.parent_keep_through.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.parent_keep_through = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.triggering_event_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ParentHistoryInvalidated, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ParentHistoryInvalidated, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ParentHistoryInvalidated { - session_id: self.session_id.to_string(), - parent_session_id: self.parent_session_id.to_string(), - parent_keep_through: match self.parent_keep_through.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - triggering_event_id: self.triggering_event_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ParentHistoryInvalidatedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - if self.parent_keep_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent_keep_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.triggering_event_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - if self.parent_keep_through.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent_keep_through.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.triggering_event_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ParentHistoryInvalidatedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("parentSessionId", self.parent_session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self - .parent_keep_through - .as_option() - { - __map.serialize_entry("parentKeepThrough", __v)?; - } - } - { - __map.serialize_entry("triggeringEventId", self.triggering_event_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ParentHistoryInvalidatedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ParentHistoryInvalidated"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ParentHistoryInvalidated"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentHistoryInvalidated"; -} -::buffa::impl_default_view_instance!(ParentHistoryInvalidatedView); -::buffa::impl_view_reborrow!(ParentHistoryInvalidatedView); -/** Self-contained, `'static` owned view of a `ParentHistoryInvalidated` message. - - Wraps [`::buffa::OwnedView`]`<`[`ParentHistoryInvalidatedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ParentHistoryInvalidatedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ParentHistoryInvalidatedOwnedView( - ::buffa::OwnedView>, -); -impl ParentHistoryInvalidatedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentHistoryInvalidatedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentHistoryInvalidatedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ParentHistoryInvalidated, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentHistoryInvalidatedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ParentHistoryInvalidatedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ParentHistoryInvalidatedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ParentHistoryInvalidated { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `parent_session_id` - #[must_use] - pub fn parent_session_id(&self) -> &'_ str { - self.0.reborrow().parent_session_id - } - /// The parent's SessionRewound.keep_through boundary that invalidated this - /// child: this child's ParentLinked.parent_dispatched_at was strictly greater - /// than it. - /// - /// Field 3: `parent_keep_through` - #[must_use] - pub fn parent_keep_through( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().parent_keep_through - } - /// Event id of the parent's SessionRewound that triggered this cascade, for - /// audit traceability back to the exact triggering fact. - /// - /// Field 4: `triggering_event_id` - #[must_use] - pub fn triggering_event_id(&self) -> &'_ str { - self.0.reborrow().triggering_event_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ParentHistoryInvalidatedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ParentHistoryInvalidatedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ParentHistoryInvalidatedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ParentHistoryInvalidatedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ParentHistoryInvalidated { - type View<'a> = ParentHistoryInvalidatedView<'a>; - type ViewHandle = ParentHistoryInvalidatedOwnedView; -} -impl ::serde::Serialize for ParentHistoryInvalidatedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_history_invalidated.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_history_invalidated.rs deleted file mode 100644 index fe5356020..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_history_invalidated.rs +++ /dev/null @@ -1,200 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/parent_history_invalidated.proto - -/// ParentHistoryInvalidated is recorded on the child session's stream by the -/// reconciler when the parent rewound past this child's dispatch point; it is -/// emitted as one atomic \[ParentHistoryInvalidated, SessionCancelled{reason = -/// PARENT_REWIND_CASCADE}\] batch when the child's cascade_policy is -/// CASCADE_ON_PARENT_TERMINAL (an INDEPENDENT child records nothing and keeps -/// running). Rewind cascade is not termination in the same sense as -/// ParentTerminated: it fires because the parent's own history that dispatched -/// this child is no longer valid, not because the parent reached a terminal -/// state (ADR#0035 facet 6). It is an invariant-bearing transition -/// (WRITE_PRECONDITION = At). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ParentHistoryInvalidated { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `parent_session_id` - #[serde( - rename = "parentSessionId", - alias = "parent_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub parent_session_id: ::buffa::alloc::string::String, - /// The parent's SessionRewound.keep_through boundary that invalidated this - /// child: this child's ParentLinked.parent_dispatched_at was strictly greater - /// than it. - /// - /// Field 3: `parent_keep_through` - #[serde(rename = "parentKeepThrough", alias = "parent_keep_through")] - pub parent_keep_through: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Event id of the parent's SessionRewound that triggered this cascade, for - /// audit traceability back to the exact triggering fact. - /// - /// Field 4: `triggering_event_id` - #[serde( - rename = "triggeringEventId", - alias = "triggering_event_id", - with = "::buffa::json_helpers::proto_string" - )] - pub triggering_event_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for ParentHistoryInvalidated { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ParentHistoryInvalidated") - .field("session_id", &self.session_id) - .field("parent_session_id", &self.parent_session_id) - .field("parent_keep_through", &self.parent_keep_through) - .field("triggering_event_id", &self.triggering_event_id) - .finish() - } -} -impl ParentHistoryInvalidated { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentHistoryInvalidated"; -} -::buffa::impl_default_instance!(ParentHistoryInvalidated); -impl ::buffa::MessageName for ParentHistoryInvalidated { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ParentHistoryInvalidated"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ParentHistoryInvalidated"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentHistoryInvalidated"; -} -impl ::buffa::Message for ParentHistoryInvalidated { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - if self.parent_keep_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent_keep_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.triggering_event_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - if self.parent_keep_through.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent_keep_through.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.triggering_event_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.parent_session_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.parent_keep_through.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.triggering_event_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.parent_session_id.clear(); - self.parent_keep_through = ::buffa::MessageField::none(); - self.triggering_event_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ParentHistoryInvalidated { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PARENT_HISTORY_INVALIDATED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentHistoryInvalidated", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_linked.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_linked.__view.rs deleted file mode 100644 index 4b546e25a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_linked.__view.rs +++ /dev/null @@ -1,434 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/parent_linked.proto - -/// ParentLinked is the second event in the atomic \[SessionStarted, ParentLinked\] -/// creation batch on the child subject under the NoStream precondition, -/// naming the parent whose run delegated it and the cascade policy that -/// governs it (ADR#0035 facet 6). It is the child-side counterpart to the -/// parent's DelegationDispatched, joined by operation_id (the saga join key); -/// parent_dispatched_at is the parent's DelegationDispatched event's own -/// SessionOrdinal, copied onto the child only after the parent append acks -/// (parent-first ordering), never predicted. cascade_policy is likewise copied -/// verbatim from the parent's DelegationDispatched (the authoritative saga -/// input); child creation rejects a differing copy as a typed conflict, so the -/// two records cannot diverge. -#[derive(Clone, Debug, Default)] -pub struct ParentLinkedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `parent_session_id` - pub parent_session_id: &'a str, - /// Field 3: `parent_dispatched_at` - pub parent_dispatched_at: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 4: `cascade_policy` - pub cascade_policy: ::buffa::EnumValue, - /// Operation-ledger id shared with the parent's DelegationDispatched; the saga - /// join key linking the two sides of the dispatch. - /// - /// Field 5: `operation_id` - pub operation_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ParentLinkedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `parent_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `parent_dispatched_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_dispatched_at(&self) -> bool { - self.parent_dispatched_at.is_set() - } - /**Whether required field `cascade_policy` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_cascade_policy(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ParentLinkedView<'a> { - type Owned = super::super::ParentLinked; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.parent_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.parent_dispatched_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.parent_dispatched_at = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.cascade_policy = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ParentLinked { - session_id: self.session_id.to_string(), - parent_session_id: self.parent_session_id.to_string(), - parent_dispatched_at: match self.parent_dispatched_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - cascade_policy: self.cascade_policy, - operation_id: self.operation_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ParentLinkedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - if self.parent_dispatched_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent_dispatched_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.cascade_policy.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - if self.parent_dispatched_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent_dispatched_at.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(4u32, self.cascade_policy.to_i32(), buf); - ::buffa::types::put_string_field(5u32, &self.operation_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ParentLinkedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("parentSessionId", self.parent_session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self - .parent_dispatched_at - .as_option() - { - __map.serialize_entry("parentDispatchedAt", __v)?; - } - } - { - __map.serialize_entry("cascadePolicy", &self.cascade_policy)?; - } - { - __map.serialize_entry("operationId", self.operation_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ParentLinkedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ParentLinked"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ParentLinked"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentLinked"; -} -::buffa::impl_default_view_instance!(ParentLinkedView); -::buffa::impl_view_reborrow!(ParentLinkedView); -/** Self-contained, `'static` owned view of a `ParentLinked` message. - - Wraps [`::buffa::OwnedView`]`<`[`ParentLinkedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ParentLinkedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ParentLinkedOwnedView(::buffa::OwnedView>); -impl ParentLinkedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentLinkedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentLinkedOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ParentLinked, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentLinkedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ParentLinkedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ParentLinkedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ParentLinked { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `parent_session_id` - #[must_use] - pub fn parent_session_id(&self) -> &'_ str { - self.0.reborrow().parent_session_id - } - /// Field 3: `parent_dispatched_at` - #[must_use] - pub fn parent_dispatched_at( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().parent_dispatched_at - } - /// Field 4: `cascade_policy` - #[must_use] - pub fn cascade_policy(&self) -> ::buffa::EnumValue { - self.0.reborrow().cascade_policy - } - /// Operation-ledger id shared with the parent's DelegationDispatched; the saga - /// join key linking the two sides of the dispatch. - /// - /// Field 5: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ParentLinkedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ParentLinkedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ParentLinkedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ParentLinkedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ParentLinked { - type View<'a> = ParentLinkedView<'a>; - type ViewHandle = ParentLinkedOwnedView; -} -impl ::serde::Serialize for ParentLinkedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_linked.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_linked.rs deleted file mode 100644 index a1c8c4460..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_linked.rs +++ /dev/null @@ -1,218 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/parent_linked.proto - -/// ParentLinked is the second event in the atomic \[SessionStarted, ParentLinked\] -/// creation batch on the child subject under the NoStream precondition, -/// naming the parent whose run delegated it and the cascade policy that -/// governs it (ADR#0035 facet 6). It is the child-side counterpart to the -/// parent's DelegationDispatched, joined by operation_id (the saga join key); -/// parent_dispatched_at is the parent's DelegationDispatched event's own -/// SessionOrdinal, copied onto the child only after the parent append acks -/// (parent-first ordering), never predicted. cascade_policy is likewise copied -/// verbatim from the parent's DelegationDispatched (the authoritative saga -/// input); child creation rejects a differing copy as a typed conflict, so the -/// two records cannot diverge. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ParentLinked { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `parent_session_id` - #[serde( - rename = "parentSessionId", - alias = "parent_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub parent_session_id: ::buffa::alloc::string::String, - /// Field 3: `parent_dispatched_at` - #[serde(rename = "parentDispatchedAt", alias = "parent_dispatched_at")] - pub parent_dispatched_at: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Field 4: `cascade_policy` - #[serde( - rename = "cascadePolicy", - alias = "cascade_policy", - with = "::buffa::json_helpers::proto_enum" - )] - pub cascade_policy: ::buffa::EnumValue, - /// Operation-ledger id shared with the parent's DelegationDispatched; the saga - /// join key linking the two sides of the dispatch. - /// - /// Field 5: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for ParentLinked { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ParentLinked") - .field("session_id", &self.session_id) - .field("parent_session_id", &self.parent_session_id) - .field("parent_dispatched_at", &self.parent_dispatched_at) - .field("cascade_policy", &self.cascade_policy) - .field("operation_id", &self.operation_id) - .finish() - } -} -impl ParentLinked { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentLinked"; -} -::buffa::impl_default_instance!(ParentLinked); -impl ::buffa::MessageName for ParentLinked { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ParentLinked"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ParentLinked"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentLinked"; -} -impl ::buffa::Message for ParentLinked { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - if self.parent_dispatched_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent_dispatched_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.cascade_policy.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - if self.parent_dispatched_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent_dispatched_at.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(4u32, self.cascade_policy.to_i32(), buf); - ::buffa::types::put_string_field(5u32, &self.operation_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.parent_session_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.parent_dispatched_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.cascade_policy = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.parent_session_id.clear(); - self.parent_dispatched_at = ::buffa::MessageField::none(); - self.cascade_policy = ::buffa::EnumValue::from(0); - self.operation_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ParentLinked { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PARENT_LINKED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentLinked", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_terminated.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_terminated.__view.rs deleted file mode 100644 index b6b569c42..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_terminated.__view.rs +++ /dev/null @@ -1,362 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/parent_terminated.proto - -/// ParentTerminated is recorded on the child session's stream by the reconciler -/// when the parent reached a Session-level terminal state; it is emitted as one -/// atomic \[ParentTerminated, SessionCancelled\] batch (ADR#0035 facet 6). It is -/// strictly for parent-terminal causes -- rewind cascade uses -/// ParentHistoryInvalidated instead, never this event. It is an -/// invariant-bearing transition (WRITE_PRECONDITION = At). -#[derive(Clone, Debug, Default)] -pub struct ParentTerminatedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `parent_session_id` - pub parent_session_id: &'a str, - /// Which parent-terminal marker triggered this cascade. - /// - /// Field 3: `cause` - pub cause: ::buffa::EnumValue, - /// Event id of the parent's terminal marker that triggered this cascade, for - /// audit traceability back to the exact triggering fact. - /// - /// Field 4: `triggering_event_id` - pub triggering_event_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ParentTerminatedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `parent_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `cause` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_cause(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `triggering_event_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_triggering_event_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ParentTerminatedView<'a> { - type Owned = super::super::ParentTerminated; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.parent_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.cause = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.triggering_event_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ParentTerminated { - session_id: self.session_id.to_string(), - parent_session_id: self.parent_session_id.to_string(), - cause: self.cause, - triggering_event_id: self.triggering_event_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ParentTerminatedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - { - let val = self.cause.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.triggering_event_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - ::buffa::types::put_int32_field(3u32, self.cause.to_i32(), buf); - ::buffa::types::put_string_field(4u32, &self.triggering_event_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ParentTerminatedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("parentSessionId", self.parent_session_id)?; - } - { - __map.serialize_entry("cause", &self.cause)?; - } - { - __map.serialize_entry("triggeringEventId", self.triggering_event_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ParentTerminatedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ParentTerminated"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ParentTerminated"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentTerminated"; -} -::buffa::impl_default_view_instance!(ParentTerminatedView); -::buffa::impl_view_reborrow!(ParentTerminatedView); -/** Self-contained, `'static` owned view of a `ParentTerminated` message. - - Wraps [`::buffa::OwnedView`]`<`[`ParentTerminatedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ParentTerminatedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ParentTerminatedOwnedView(::buffa::OwnedView>); -impl ParentTerminatedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentTerminatedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentTerminatedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ParentTerminated, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ParentTerminatedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ParentTerminatedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ParentTerminatedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ParentTerminated { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `parent_session_id` - #[must_use] - pub fn parent_session_id(&self) -> &'_ str { - self.0.reborrow().parent_session_id - } - /// Which parent-terminal marker triggered this cascade. - /// - /// Field 3: `cause` - #[must_use] - pub fn cause(&self) -> ::buffa::EnumValue { - self.0.reborrow().cause - } - /// Event id of the parent's terminal marker that triggered this cascade, for - /// audit traceability back to the exact triggering fact. - /// - /// Field 4: `triggering_event_id` - #[must_use] - pub fn triggering_event_id(&self) -> &'_ str { - self.0.reborrow().triggering_event_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ParentTerminatedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ParentTerminatedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ParentTerminatedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ParentTerminatedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ParentTerminated { - type View<'a> = ParentTerminatedView<'a>; - type ViewHandle = ParentTerminatedOwnedView; -} -impl ::serde::Serialize for ParentTerminatedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_terminated.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_terminated.rs deleted file mode 100644 index cc97642e6..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.parent_terminated.rs +++ /dev/null @@ -1,355 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/parent_terminated.proto - -/// ParentTerminalCause is which parent-terminal marker triggered a -/// ParentTerminated cascade. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ParentTerminalCause { - PARENT_TERMINAL_CAUSE_UNSPECIFIED = 0i32, - PARENT_TERMINAL_CAUSE_CLOSED = 1i32, - PARENT_TERMINAL_CAUSE_CANCELLED = 2i32, - PARENT_TERMINAL_CAUSE_FAILED = 3i32, - PARENT_TERMINAL_CAUSE_HIDDEN = 4i32, -} -impl ParentTerminalCause { - ///Idiomatic alias for [`Self::PARENT_TERMINAL_CAUSE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::PARENT_TERMINAL_CAUSE_UNSPECIFIED; - ///Idiomatic alias for [`Self::PARENT_TERMINAL_CAUSE_CLOSED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Closed: Self = Self::PARENT_TERMINAL_CAUSE_CLOSED; - ///Idiomatic alias for [`Self::PARENT_TERMINAL_CAUSE_CANCELLED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Cancelled: Self = Self::PARENT_TERMINAL_CAUSE_CANCELLED; - ///Idiomatic alias for [`Self::PARENT_TERMINAL_CAUSE_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Failed: Self = Self::PARENT_TERMINAL_CAUSE_FAILED; - ///Idiomatic alias for [`Self::PARENT_TERMINAL_CAUSE_HIDDEN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Hidden: Self = Self::PARENT_TERMINAL_CAUSE_HIDDEN; -} -impl ::core::default::Default for ParentTerminalCause { - fn default() -> Self { - Self::PARENT_TERMINAL_CAUSE_UNSPECIFIED - } -} -impl ::serde::Serialize for ParentTerminalCause { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ParentTerminalCause { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ParentTerminalCause; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(ParentTerminalCause) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ParentTerminalCause { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ParentTerminalCause { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::PARENT_TERMINAL_CAUSE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::PARENT_TERMINAL_CAUSE_CLOSED), - 2i32 => ::core::option::Option::Some(Self::PARENT_TERMINAL_CAUSE_CANCELLED), - 3i32 => ::core::option::Option::Some(Self::PARENT_TERMINAL_CAUSE_FAILED), - 4i32 => ::core::option::Option::Some(Self::PARENT_TERMINAL_CAUSE_HIDDEN), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::PARENT_TERMINAL_CAUSE_UNSPECIFIED => { - "PARENT_TERMINAL_CAUSE_UNSPECIFIED" - } - Self::PARENT_TERMINAL_CAUSE_CLOSED => "PARENT_TERMINAL_CAUSE_CLOSED", - Self::PARENT_TERMINAL_CAUSE_CANCELLED => "PARENT_TERMINAL_CAUSE_CANCELLED", - Self::PARENT_TERMINAL_CAUSE_FAILED => "PARENT_TERMINAL_CAUSE_FAILED", - Self::PARENT_TERMINAL_CAUSE_HIDDEN => "PARENT_TERMINAL_CAUSE_HIDDEN", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "PARENT_TERMINAL_CAUSE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::PARENT_TERMINAL_CAUSE_UNSPECIFIED) - } - "PARENT_TERMINAL_CAUSE_CLOSED" => { - ::core::option::Option::Some(Self::PARENT_TERMINAL_CAUSE_CLOSED) - } - "PARENT_TERMINAL_CAUSE_CANCELLED" => { - ::core::option::Option::Some(Self::PARENT_TERMINAL_CAUSE_CANCELLED) - } - "PARENT_TERMINAL_CAUSE_FAILED" => { - ::core::option::Option::Some(Self::PARENT_TERMINAL_CAUSE_FAILED) - } - "PARENT_TERMINAL_CAUSE_HIDDEN" => { - ::core::option::Option::Some(Self::PARENT_TERMINAL_CAUSE_HIDDEN) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::PARENT_TERMINAL_CAUSE_UNSPECIFIED, - Self::PARENT_TERMINAL_CAUSE_CLOSED, - Self::PARENT_TERMINAL_CAUSE_CANCELLED, - Self::PARENT_TERMINAL_CAUSE_FAILED, - Self::PARENT_TERMINAL_CAUSE_HIDDEN, - ] - } -} -/// ParentTerminated is recorded on the child session's stream by the reconciler -/// when the parent reached a Session-level terminal state; it is emitted as one -/// atomic \[ParentTerminated, SessionCancelled\] batch (ADR#0035 facet 6). It is -/// strictly for parent-terminal causes -- rewind cascade uses -/// ParentHistoryInvalidated instead, never this event. It is an -/// invariant-bearing transition (WRITE_PRECONDITION = At). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ParentTerminated { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `parent_session_id` - #[serde( - rename = "parentSessionId", - alias = "parent_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub parent_session_id: ::buffa::alloc::string::String, - /// Which parent-terminal marker triggered this cascade. - /// - /// Field 3: `cause` - #[serde(rename = "cause", with = "::buffa::json_helpers::proto_enum")] - pub cause: ::buffa::EnumValue, - /// Event id of the parent's terminal marker that triggered this cascade, for - /// audit traceability back to the exact triggering fact. - /// - /// Field 4: `triggering_event_id` - #[serde( - rename = "triggeringEventId", - alias = "triggering_event_id", - with = "::buffa::json_helpers::proto_string" - )] - pub triggering_event_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for ParentTerminated { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ParentTerminated") - .field("session_id", &self.session_id) - .field("parent_session_id", &self.parent_session_id) - .field("cause", &self.cause) - .field("triggering_event_id", &self.triggering_event_id) - .finish() - } -} -impl ParentTerminated { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentTerminated"; -} -::buffa::impl_default_instance!(ParentTerminated); -impl ::buffa::MessageName for ParentTerminated { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ParentTerminated"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ParentTerminated"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentTerminated"; -} -impl ::buffa::Message for ParentTerminated { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - { - let val = self.cause.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.triggering_event_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - ::buffa::types::put_int32_field(3u32, self.cause.to_i32(), buf); - ::buffa::types::put_string_field(4u32, &self.triggering_event_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.parent_session_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.cause = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.triggering_event_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.parent_session_id.clear(); - self.cause = ::buffa::EnumValue::from(0); - self.triggering_event_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ParentTerminated { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PARENT_TERMINATED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ParentTerminated", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.produce_checkpoint.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.produce_checkpoint.__view.rs deleted file mode 100644 index dfa690834..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.produce_checkpoint.__view.rs +++ /dev/null @@ -1,336 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/produce_checkpoint.proto - -/// ProduceCheckpoint records opaque durable state an execution attempt captured -/// mid-run, recording \[CheckpointProduced\], so a later attempt can restore it -/// instead of replaying from the beginning. -/// -/// Write precondition Any: the first evidence admitted per checkpoint_id wins; a -/// later event reusing the id stays on the log but never replaces it, so a -/// restore always resolves to the same bytes. -#[derive(Clone, Debug, Default)] -pub struct ProduceCheckpointView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Self-describing: checkpoint id, producing attempt, covered boundary, - /// and the execution plan digest it is bound to all live here. - /// - /// Field 2: `checkpoint` - pub checkpoint: ::buffa::MessageFieldView< - super::super::__buffa::view::CheckpointView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ProduceCheckpointView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `checkpoint` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_checkpoint(&self) -> bool { - self.checkpoint.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ProduceCheckpointView<'a> { - type Owned = super::super::ProduceCheckpoint; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.checkpoint.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.checkpoint = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ProduceCheckpoint { - session_id: self.session_id.to_string(), - checkpoint: match self.checkpoint.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Checkpoint, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ProduceCheckpointView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.checkpoint.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.checkpoint.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.checkpoint.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.checkpoint.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ProduceCheckpointView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.checkpoint.as_option() { - __map.serialize_entry("checkpoint", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ProduceCheckpointView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ProduceCheckpoint"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ProduceCheckpoint"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ProduceCheckpoint"; -} -::buffa::impl_default_view_instance!(ProduceCheckpointView); -::buffa::impl_view_reborrow!(ProduceCheckpointView); -/** Self-contained, `'static` owned view of a `ProduceCheckpoint` message. - - Wraps [`::buffa::OwnedView`]`<`[`ProduceCheckpointView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ProduceCheckpointView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ProduceCheckpointOwnedView( - ::buffa::OwnedView>, -); -impl ProduceCheckpointOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProduceCheckpointOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProduceCheckpointOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ProduceCheckpoint, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProduceCheckpointOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ProduceCheckpointView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ProduceCheckpointView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ProduceCheckpoint { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Self-describing: checkpoint id, producing attempt, covered boundary, - /// and the execution plan digest it is bound to all live here. - /// - /// Field 2: `checkpoint` - #[must_use] - pub fn checkpoint( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().checkpoint - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ProduceCheckpointOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ProduceCheckpointOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ProduceCheckpointOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ProduceCheckpointOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ProduceCheckpoint { - type View<'a> = ProduceCheckpointView<'a>; - type ViewHandle = ProduceCheckpointOwnedView; -} -impl ::serde::Serialize for ProduceCheckpointOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.produce_checkpoint.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.produce_checkpoint.rs deleted file mode 100644 index 0c8206ded..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.produce_checkpoint.rs +++ /dev/null @@ -1,151 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/produce_checkpoint.proto - -/// ProduceCheckpoint records opaque durable state an execution attempt captured -/// mid-run, recording \[CheckpointProduced\], so a later attempt can restore it -/// instead of replaying from the beginning. -/// -/// Write precondition Any: the first evidence admitted per checkpoint_id wins; a -/// later event reusing the id stays on the log but never replaces it, so a -/// restore always resolves to the same bytes. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ProduceCheckpoint { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Self-describing: checkpoint id, producing attempt, covered boundary, - /// and the execution plan digest it is bound to all live here. - /// - /// Field 2: `checkpoint` - #[serde(rename = "checkpoint")] - pub checkpoint: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for ProduceCheckpoint { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ProduceCheckpoint") - .field("session_id", &self.session_id) - .field("checkpoint", &self.checkpoint) - .finish() - } -} -impl ProduceCheckpoint { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ProduceCheckpoint"; -} -::buffa::impl_default_instance!(ProduceCheckpoint); -impl ::buffa::MessageName for ProduceCheckpoint { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ProduceCheckpoint"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ProduceCheckpoint"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ProduceCheckpoint"; -} -impl ::buffa::Message for ProduceCheckpoint { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.checkpoint.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.checkpoint.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.checkpoint.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.checkpoint.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.checkpoint.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.checkpoint = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ProduceCheckpoint { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PRODUCE_CHECKPOINT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ProduceCheckpoint", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.provider_tool_intent_rejected.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.provider_tool_intent_rejected.__view.rs deleted file mode 100644 index 5c9ec4fa0..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.provider_tool_intent_rejected.__view.rs +++ /dev/null @@ -1,600 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/provider_tool_intent_rejected.proto - -/// ProviderToolIntentRejected records that a provider emitted something shaped -/// like a tool call which the runtime refused to turn into one. -/// -/// It exists because the malformed intent structurally cannot be stored anywhere -/// else. The canonical transcript form is `ToolUseBlock`, whose `input_json` is -/// LEGACY_REQUIRED and must be valid JSON; an intent whose arguments are truncated -/// JSON has nothing to put there. `ProviderBlock` retains the raw payload but is -/// documented write-verbatim, read-never, so mining it for diagnosis would make a -/// projection depend on a shape the domain promised never to interpret. The -/// choice is therefore a typed event or nothing, and nothing means the most -/// common provider fault in production leaves a session that simply did less than -/// it appeared to. -/// -/// This is not ToolCallDenied. Denial is a well-formed request a human, policy, -/// or hook refused, and the request exists. Here no request was ever admissible, -/// so no ToolCallRequested is written, no execution id is minted, and no -/// operation is reserved. Refusing to synthesize a request out of unparseable -/// input is the whole point: a synthetic ToolCallRequested would put a call on the -/// log that the provider never validly asked for. -/// -/// It is per-intent and not per-message. A message carrying nine sound tool calls -/// and one malformed one must keep the nine, so the sound calls proceed to -/// ToolCallRequested normally while only the tenth lands here. Marking the whole -/// assistant message failed would discard nine calls to describe one. -/// -/// It is a commuting happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -/// It records something the provider already did; nothing about the session's -/// current lifecycle can make it untrue. -#[derive(Clone, Debug, Default)] -pub struct ProviderToolIntentRejectedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Identifies this rejection. Minted by the runtime, because the whole class of - /// fault is that the provider's own identifier is missing, empty, or duplicated - /// and cannot be used as a key. - /// - /// Field 2: `rejection_id` - pub rejection_id: &'a str, - /// The assistant message this intent arrived in (CanonicalMessage.message_id). - /// - /// Field 3: `message_id` - pub message_id: &'a str, - /// Turn this generation belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 4: `turn_id` - pub turn_id: &'a str, - /// Field 5: `reason` - pub reason: ::buffa::EnumValue, - /// What the provider claimed the call's id was, verbatim, including empty when - /// that was the fault. Recorded as a claim rather than as an identity: it may - /// be empty, may collide with a real call, and must never be joined against - /// tool_call_id anywhere. - /// - /// Field 6: `claimed_tool_call_id` - pub claimed_tool_call_id: ::core::option::Option<&'a str>, - /// What the provider claimed the tool's name was, verbatim. Empty when absent. - /// - /// Field 7: `claimed_tool_name` - pub claimed_tool_name: ::core::option::Option<&'a str>, - /// Claim-check to the provider's raw emission for this intent. - /// - /// Out of line rather than inline for the reason every other unbounded payload - /// is: malformed input has no length bound, and this particular payload is the - /// one shaped by whatever produced the fault. A megabyte of truncated JSON - /// inlined into a never-truncated log is a way to make one bad generation - /// permanent for every reader of the stream. - /// - /// Unset when the raw emission could not be captured, which is itself worth - /// distinguishing from a capture of nothing. - /// - /// Field 8: `raw_intent` - pub raw_intent: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactRefView<'a>, - >, - /// Free-text detail from the parser or validator, for humans. Never parsed. - /// - /// Field 9: `detail` - pub detail: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ProviderToolIntentRejectedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `rejection_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_rejection_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `message_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ProviderToolIntentRejectedView<'a> { - type Owned = super::super::ProviderToolIntentRejected; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.rejection_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.message_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 16u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.claimed_tool_call_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.claimed_tool_name = Some(::buffa::types::borrow_str(&mut cur)?); - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.raw_intent.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.raw_intent = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ProviderToolIntentRejected, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ProviderToolIntentRejected, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ProviderToolIntentRejected { - session_id: self.session_id.to_string(), - rejection_id: self.rejection_id.to_string(), - message_id: self.message_id.to_string(), - turn_id: self.turn_id.to_string(), - reason: self.reason, - claimed_tool_call_id: self.claimed_tool_call_id.map(|s| s.to_string()), - claimed_tool_name: self.claimed_tool_name.map(|s| s.to_string()), - raw_intent: match self.raw_intent.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - detail: self.detail.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ProviderToolIntentRejectedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.rejection_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.claimed_tool_call_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.claimed_tool_name { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.raw_intent.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.raw_intent.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.rejection_id, buf); - ::buffa::types::put_string_field(3u32, &self.message_id, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - ::buffa::types::put_int32_field(5u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.claimed_tool_call_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - if let Some(ref v) = self.claimed_tool_name { - ::buffa::types::put_string_field(7u32, v, buf); - } - if self.raw_intent.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.raw_intent.write_to(__cache, buf); - } - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(9u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ProviderToolIntentRejectedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("rejectionId", self.rejection_id)?; - } - { - __map.serialize_entry("messageId", self.message_id)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - if let ::core::option::Option::Some(__v) = self.claimed_tool_call_id { - __map.serialize_entry("claimedToolCallId", __v)?; - } - if let ::core::option::Option::Some(__v) = self.claimed_tool_name { - __map.serialize_entry("claimedToolName", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.raw_intent.as_option() { - __map.serialize_entry("rawIntent", __v)?; - } - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ProviderToolIntentRejectedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ProviderToolIntentRejected"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ProviderToolIntentRejected"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ProviderToolIntentRejected"; -} -::buffa::impl_default_view_instance!(ProviderToolIntentRejectedView); -::buffa::impl_view_reborrow!(ProviderToolIntentRejectedView); -/** Self-contained, `'static` owned view of a `ProviderToolIntentRejected` message. - - Wraps [`::buffa::OwnedView`]`<`[`ProviderToolIntentRejectedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ProviderToolIntentRejectedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ProviderToolIntentRejectedOwnedView( - ::buffa::OwnedView>, -); -impl ProviderToolIntentRejectedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProviderToolIntentRejectedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProviderToolIntentRejectedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ProviderToolIntentRejected, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProviderToolIntentRejectedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ProviderToolIntentRejectedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ProviderToolIntentRejectedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ProviderToolIntentRejected { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Identifies this rejection. Minted by the runtime, because the whole class of - /// fault is that the provider's own identifier is missing, empty, or duplicated - /// and cannot be used as a key. - /// - /// Field 2: `rejection_id` - #[must_use] - pub fn rejection_id(&self) -> &'_ str { - self.0.reborrow().rejection_id - } - /// The assistant message this intent arrived in (CanonicalMessage.message_id). - /// - /// Field 3: `message_id` - #[must_use] - pub fn message_id(&self) -> &'_ str { - self.0.reborrow().message_id - } - /// Turn this generation belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 4: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } - /// Field 5: `reason` - #[must_use] - pub fn reason( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// What the provider claimed the call's id was, verbatim, including empty when - /// that was the fault. Recorded as a claim rather than as an identity: it may - /// be empty, may collide with a real call, and must never be joined against - /// tool_call_id anywhere. - /// - /// Field 6: `claimed_tool_call_id` - #[must_use] - pub fn claimed_tool_call_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().claimed_tool_call_id - } - /// What the provider claimed the tool's name was, verbatim. Empty when absent. - /// - /// Field 7: `claimed_tool_name` - #[must_use] - pub fn claimed_tool_name(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().claimed_tool_name - } - /// Claim-check to the provider's raw emission for this intent. - /// - /// Out of line rather than inline for the reason every other unbounded payload - /// is: malformed input has no length bound, and this particular payload is the - /// one shaped by whatever produced the fault. A megabyte of truncated JSON - /// inlined into a never-truncated log is a way to make one bad generation - /// permanent for every reader of the stream. - /// - /// Unset when the raw emission could not be captured, which is itself worth - /// distinguishing from a capture of nothing. - /// - /// Field 8: `raw_intent` - #[must_use] - pub fn raw_intent( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().raw_intent - } - /// Free-text detail from the parser or validator, for humans. Never parsed. - /// - /// Field 9: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ProviderToolIntentRejectedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ProviderToolIntentRejectedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ProviderToolIntentRejectedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ProviderToolIntentRejectedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ProviderToolIntentRejected { - type View<'a> = ProviderToolIntentRejectedView<'a>; - type ViewHandle = ProviderToolIntentRejectedOwnedView; -} -impl ::serde::Serialize for ProviderToolIntentRejectedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.provider_tool_intent_rejected.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.provider_tool_intent_rejected.rs deleted file mode 100644 index 027d8403d..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.provider_tool_intent_rejected.rs +++ /dev/null @@ -1,672 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/provider_tool_intent_rejected.proto - -/// ProviderToolIntentRejectionReason is why the intent was not admissible. -/// -/// The reasons are typed because the operational responses differ: a malformed -/// argument payload is a prompt or model problem, an unknown tool name is a -/// catalog drift problem, and a duplicate id is a provider bug that will corrupt -/// joins if it is ever admitted. A single free-text reason makes those one alert. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ProviderToolIntentRejectionReason { - PROVIDER_TOOL_INTENT_REJECTION_REASON_UNSPECIFIED = 0i32, - /// Arguments were not parseable as JSON, or parsed to something that is not an - /// object. - PROVIDER_TOOL_INTENT_REJECTION_REASON_MALFORMED_ARGUMENTS = 1i32, - /// Arguments parsed but did not satisfy the tool's declared input schema. - PROVIDER_TOOL_INTENT_REJECTION_REASON_SCHEMA_VIOLATION = 2i32, - /// The provider supplied no call id, or an empty one. - PROVIDER_TOOL_INTENT_REJECTION_REASON_MISSING_CALL_ID = 3i32, - /// The call id collides with one already used in this session. Refused rather - /// than deduplicated: admitting it would make the result of one call - /// attributable to another, and every downstream join silently wrong. - PROVIDER_TOOL_INTENT_REJECTION_REASON_DUPLICATE_CALL_ID = 4i32, - /// No tool name, or a name no registered tool answers to. - PROVIDER_TOOL_INTENT_REJECTION_REASON_UNKNOWN_TOOL = 5i32, - /// The intent named a parent tool use that does not exist in this session, so - /// its position in the call tree is unresolvable. - PROVIDER_TOOL_INTENT_REJECTION_REASON_UNRESOLVABLE_PARENT = 6i32, - /// The emission exceeded the runtime's accepted size for a single intent and - /// was refused before parsing. - PROVIDER_TOOL_INTENT_REJECTION_REASON_OVERSIZED = 7i32, -} -impl ProviderToolIntentRejectionReason { - ///Idiomatic alias for [`Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_MALFORMED_ARGUMENTS`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const MalformedArguments: Self = Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_MALFORMED_ARGUMENTS; - ///Idiomatic alias for [`Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_SCHEMA_VIOLATION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const SchemaViolation: Self = Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_SCHEMA_VIOLATION; - ///Idiomatic alias for [`Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_MISSING_CALL_ID`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const MissingCallId: Self = Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_MISSING_CALL_ID; - ///Idiomatic alias for [`Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_DUPLICATE_CALL_ID`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const DuplicateCallId: Self = Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_DUPLICATE_CALL_ID; - ///Idiomatic alias for [`Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNKNOWN_TOOL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const UnknownTool: Self = Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNKNOWN_TOOL; - ///Idiomatic alias for [`Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNRESOLVABLE_PARENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const UnresolvableParent: Self = Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNRESOLVABLE_PARENT; - ///Idiomatic alias for [`Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_OVERSIZED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Oversized: Self = Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_OVERSIZED; -} -impl ::core::default::Default for ProviderToolIntentRejectionReason { - fn default() -> Self { - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for ProviderToolIntentRejectionReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ProviderToolIntentRejectionReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ProviderToolIntentRejectionReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(ProviderToolIntentRejectionReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name( - v, - ) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32( - v32, - ) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32( - v32, - ) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ProviderToolIntentRejectionReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ProviderToolIntentRejectionReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNSPECIFIED, - ) - } - 1i32 => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_MALFORMED_ARGUMENTS, - ) - } - 2i32 => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_SCHEMA_VIOLATION, - ) - } - 3i32 => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_MISSING_CALL_ID, - ) - } - 4i32 => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_DUPLICATE_CALL_ID, - ) - } - 5i32 => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNKNOWN_TOOL, - ) - } - 6i32 => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNRESOLVABLE_PARENT, - ) - } - 7i32 => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_OVERSIZED, - ) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNSPECIFIED => { - "PROVIDER_TOOL_INTENT_REJECTION_REASON_UNSPECIFIED" - } - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_MALFORMED_ARGUMENTS => { - "PROVIDER_TOOL_INTENT_REJECTION_REASON_MALFORMED_ARGUMENTS" - } - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_SCHEMA_VIOLATION => { - "PROVIDER_TOOL_INTENT_REJECTION_REASON_SCHEMA_VIOLATION" - } - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_MISSING_CALL_ID => { - "PROVIDER_TOOL_INTENT_REJECTION_REASON_MISSING_CALL_ID" - } - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_DUPLICATE_CALL_ID => { - "PROVIDER_TOOL_INTENT_REJECTION_REASON_DUPLICATE_CALL_ID" - } - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNKNOWN_TOOL => { - "PROVIDER_TOOL_INTENT_REJECTION_REASON_UNKNOWN_TOOL" - } - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNRESOLVABLE_PARENT => { - "PROVIDER_TOOL_INTENT_REJECTION_REASON_UNRESOLVABLE_PARENT" - } - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_OVERSIZED => { - "PROVIDER_TOOL_INTENT_REJECTION_REASON_OVERSIZED" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "PROVIDER_TOOL_INTENT_REJECTION_REASON_UNSPECIFIED" => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNSPECIFIED, - ) - } - "PROVIDER_TOOL_INTENT_REJECTION_REASON_MALFORMED_ARGUMENTS" => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_MALFORMED_ARGUMENTS, - ) - } - "PROVIDER_TOOL_INTENT_REJECTION_REASON_SCHEMA_VIOLATION" => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_SCHEMA_VIOLATION, - ) - } - "PROVIDER_TOOL_INTENT_REJECTION_REASON_MISSING_CALL_ID" => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_MISSING_CALL_ID, - ) - } - "PROVIDER_TOOL_INTENT_REJECTION_REASON_DUPLICATE_CALL_ID" => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_DUPLICATE_CALL_ID, - ) - } - "PROVIDER_TOOL_INTENT_REJECTION_REASON_UNKNOWN_TOOL" => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNKNOWN_TOOL, - ) - } - "PROVIDER_TOOL_INTENT_REJECTION_REASON_UNRESOLVABLE_PARENT" => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNRESOLVABLE_PARENT, - ) - } - "PROVIDER_TOOL_INTENT_REJECTION_REASON_OVERSIZED" => { - ::core::option::Option::Some( - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_OVERSIZED, - ) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNSPECIFIED, - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_MALFORMED_ARGUMENTS, - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_SCHEMA_VIOLATION, - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_MISSING_CALL_ID, - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_DUPLICATE_CALL_ID, - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNKNOWN_TOOL, - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_UNRESOLVABLE_PARENT, - Self::PROVIDER_TOOL_INTENT_REJECTION_REASON_OVERSIZED, - ] - } -} -/// ProviderToolIntentRejected records that a provider emitted something shaped -/// like a tool call which the runtime refused to turn into one. -/// -/// It exists because the malformed intent structurally cannot be stored anywhere -/// else. The canonical transcript form is `ToolUseBlock`, whose `input_json` is -/// LEGACY_REQUIRED and must be valid JSON; an intent whose arguments are truncated -/// JSON has nothing to put there. `ProviderBlock` retains the raw payload but is -/// documented write-verbatim, read-never, so mining it for diagnosis would make a -/// projection depend on a shape the domain promised never to interpret. The -/// choice is therefore a typed event or nothing, and nothing means the most -/// common provider fault in production leaves a session that simply did less than -/// it appeared to. -/// -/// This is not ToolCallDenied. Denial is a well-formed request a human, policy, -/// or hook refused, and the request exists. Here no request was ever admissible, -/// so no ToolCallRequested is written, no execution id is minted, and no -/// operation is reserved. Refusing to synthesize a request out of unparseable -/// input is the whole point: a synthetic ToolCallRequested would put a call on the -/// log that the provider never validly asked for. -/// -/// It is per-intent and not per-message. A message carrying nine sound tool calls -/// and one malformed one must keep the nine, so the sound calls proceed to -/// ToolCallRequested normally while only the tenth lands here. Marking the whole -/// assistant message failed would discard nine calls to describe one. -/// -/// It is a commuting happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -/// It records something the provider already did; nothing about the session's -/// current lifecycle can make it untrue. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ProviderToolIntentRejected { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Identifies this rejection. Minted by the runtime, because the whole class of - /// fault is that the provider's own identifier is missing, empty, or duplicated - /// and cannot be used as a key. - /// - /// Field 2: `rejection_id` - #[serde( - rename = "rejectionId", - alias = "rejection_id", - with = "::buffa::json_helpers::proto_string" - )] - pub rejection_id: ::buffa::alloc::string::String, - /// The assistant message this intent arrived in (CanonicalMessage.message_id). - /// - /// Field 3: `message_id` - #[serde( - rename = "messageId", - alias = "message_id", - with = "::buffa::json_helpers::proto_string" - )] - pub message_id: ::buffa::alloc::string::String, - /// Turn this generation belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 4: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, - /// Field 5: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// What the provider claimed the call's id was, verbatim, including empty when - /// that was the fault. Recorded as a claim rather than as an identity: it may - /// be empty, may collide with a real call, and must never be joined against - /// tool_call_id anywhere. - /// - /// Field 6: `claimed_tool_call_id` - #[serde( - rename = "claimedToolCallId", - alias = "claimed_tool_call_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub claimed_tool_call_id: ::core::option::Option<::buffa::alloc::string::String>, - /// What the provider claimed the tool's name was, verbatim. Empty when absent. - /// - /// Field 7: `claimed_tool_name` - #[serde( - rename = "claimedToolName", - alias = "claimed_tool_name", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub claimed_tool_name: ::core::option::Option<::buffa::alloc::string::String>, - /// Claim-check to the provider's raw emission for this intent. - /// - /// Out of line rather than inline for the reason every other unbounded payload - /// is: malformed input has no length bound, and this particular payload is the - /// one shaped by whatever produced the fault. A megabyte of truncated JSON - /// inlined into a never-truncated log is a way to make one bad generation - /// permanent for every reader of the stream. - /// - /// Unset when the raw emission could not be captured, which is itself worth - /// distinguishing from a capture of nothing. - /// - /// Field 8: `raw_intent` - #[serde( - rename = "rawIntent", - alias = "raw_intent", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub raw_intent: ::buffa::MessageField>, - /// Free-text detail from the parser or validator, for humans. Never parsed. - /// - /// Field 9: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for ProviderToolIntentRejected { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ProviderToolIntentRejected") - .field("session_id", &self.session_id) - .field("rejection_id", &self.rejection_id) - .field("message_id", &self.message_id) - .field("turn_id", &self.turn_id) - .field("reason", &self.reason) - .field("claimed_tool_call_id", &self.claimed_tool_call_id) - .field("claimed_tool_name", &self.claimed_tool_name) - .field("raw_intent", &self.raw_intent) - .field("detail", &self.detail) - .finish() - } -} -impl ProviderToolIntentRejected { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ProviderToolIntentRejected"; -} -impl ProviderToolIntentRejected { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::claimed_tool_call_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_claimed_tool_call_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.claimed_tool_call_id = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::claimed_tool_name`] to `Some(value)`, consuming and returning `self`. - pub fn with_claimed_tool_name( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.claimed_tool_name = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ProviderToolIntentRejected); -impl ::buffa::MessageName for ProviderToolIntentRejected { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ProviderToolIntentRejected"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ProviderToolIntentRejected"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ProviderToolIntentRejected"; -} -impl ::buffa::Message for ProviderToolIntentRejected { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.rejection_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.claimed_tool_call_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.claimed_tool_name { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.raw_intent.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.raw_intent.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.rejection_id, buf); - ::buffa::types::put_string_field(3u32, &self.message_id, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - ::buffa::types::put_int32_field(5u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.claimed_tool_call_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - if let Some(ref v) = self.claimed_tool_name { - ::buffa::types::put_string_field(7u32, v, buf); - } - if self.raw_intent.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.raw_intent.write_to(__cache, buf); - } - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(9u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.rejection_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.message_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .claimed_tool_call_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .claimed_tool_name - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.raw_intent.get_or_insert_default(), - buf, - ctx, - )?; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.rejection_id.clear(); - self.message_id.clear(); - self.turn_id.clear(); - self.reason = ::buffa::EnumValue::from(0); - self.claimed_tool_call_id = ::core::option::Option::None; - self.claimed_tool_name = ::core::option::Option::None; - self.raw_intent = ::buffa::MessageField::none(); - self.detail = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ProviderToolIntentRejected { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PROVIDER_TOOL_INTENT_REJECTED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ProviderToolIntentRejected", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reconcile_parent_rewind.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reconcile_parent_rewind.__view.rs deleted file mode 100644 index 03eb49c42..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reconcile_parent_rewind.__view.rs +++ /dev/null @@ -1,410 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/reconcile_parent_rewind.proto - -/// ReconcileParentRewind is issued by the child-session reconciler when a parent -/// rewinds past the dispatch that created a child, recording -/// \[ParentHistoryInvalidated, SessionCancelled\] as one batch: the context the -/// child inherited no longer exists. -/// -/// Write precondition At on the child: applies only when parent_dispatched_at is -/// past the parent's new boundary and the cascade policy allows it. -#[derive(Clone, Debug, Default)] -pub struct ReconcileParentRewindView<'a> { - /// The child session being reconciled. - /// - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `parent_session_id` - pub parent_session_id: &'a str, - /// The parent's new effective boundary. - /// - /// Field 3: `parent_keep_through` - pub parent_keep_through: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 4: `triggering_event_id` - pub triggering_event_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReconcileParentRewindView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `parent_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `parent_keep_through` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_keep_through(&self) -> bool { - self.parent_keep_through.is_set() - } - /**Whether required field `triggering_event_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_triggering_event_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ReconcileParentRewindView<'a> { - type Owned = super::super::ReconcileParentRewind; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.parent_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.parent_keep_through.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.parent_keep_through = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.triggering_event_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ReconcileParentRewind, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ReconcileParentRewind, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReconcileParentRewind { - session_id: self.session_id.to_string(), - parent_session_id: self.parent_session_id.to_string(), - parent_keep_through: match self.parent_keep_through.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - triggering_event_id: self.triggering_event_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReconcileParentRewindView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - if self.parent_keep_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent_keep_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.triggering_event_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - if self.parent_keep_through.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent_keep_through.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.triggering_event_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReconcileParentRewindView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("parentSessionId", self.parent_session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self - .parent_keep_through - .as_option() - { - __map.serialize_entry("parentKeepThrough", __v)?; - } - } - { - __map.serialize_entry("triggeringEventId", self.triggering_event_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReconcileParentRewindView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ReconcileParentRewind"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ReconcileParentRewind"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReconcileParentRewind"; -} -::buffa::impl_default_view_instance!(ReconcileParentRewindView); -::buffa::impl_view_reborrow!(ReconcileParentRewindView); -/** Self-contained, `'static` owned view of a `ReconcileParentRewind` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReconcileParentRewindView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReconcileParentRewindView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReconcileParentRewindOwnedView( - ::buffa::OwnedView>, -); -impl ReconcileParentRewindOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileParentRewindOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileParentRewindOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReconcileParentRewind, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileParentRewindOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReconcileParentRewindView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReconcileParentRewindView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReconcileParentRewind { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The child session being reconciled. - /// - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `parent_session_id` - #[must_use] - pub fn parent_session_id(&self) -> &'_ str { - self.0.reborrow().parent_session_id - } - /// The parent's new effective boundary. - /// - /// Field 3: `parent_keep_through` - #[must_use] - pub fn parent_keep_through( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().parent_keep_through - } - /// Field 4: `triggering_event_id` - #[must_use] - pub fn triggering_event_id(&self) -> &'_ str { - self.0.reborrow().triggering_event_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReconcileParentRewindOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReconcileParentRewindOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReconcileParentRewindOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReconcileParentRewindOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReconcileParentRewind { - type View<'a> = ReconcileParentRewindView<'a>; - type ViewHandle = ReconcileParentRewindOwnedView; -} -impl ::serde::Serialize for ReconcileParentRewindOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reconcile_parent_rewind.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reconcile_parent_rewind.rs deleted file mode 100644 index 8f3de08e9..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reconcile_parent_rewind.rs +++ /dev/null @@ -1,194 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/reconcile_parent_rewind.proto - -/// ReconcileParentRewind is issued by the child-session reconciler when a parent -/// rewinds past the dispatch that created a child, recording -/// \[ParentHistoryInvalidated, SessionCancelled\] as one batch: the context the -/// child inherited no longer exists. -/// -/// Write precondition At on the child: applies only when parent_dispatched_at is -/// past the parent's new boundary and the cascade policy allows it. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReconcileParentRewind { - /// The child session being reconciled. - /// - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `parent_session_id` - #[serde( - rename = "parentSessionId", - alias = "parent_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub parent_session_id: ::buffa::alloc::string::String, - /// The parent's new effective boundary. - /// - /// Field 3: `parent_keep_through` - #[serde(rename = "parentKeepThrough", alias = "parent_keep_through")] - pub parent_keep_through: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Field 4: `triggering_event_id` - #[serde( - rename = "triggeringEventId", - alias = "triggering_event_id", - with = "::buffa::json_helpers::proto_string" - )] - pub triggering_event_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for ReconcileParentRewind { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReconcileParentRewind") - .field("session_id", &self.session_id) - .field("parent_session_id", &self.parent_session_id) - .field("parent_keep_through", &self.parent_keep_through) - .field("triggering_event_id", &self.triggering_event_id) - .finish() - } -} -impl ReconcileParentRewind { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReconcileParentRewind"; -} -::buffa::impl_default_instance!(ReconcileParentRewind); -impl ::buffa::MessageName for ReconcileParentRewind { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ReconcileParentRewind"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ReconcileParentRewind"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReconcileParentRewind"; -} -impl ::buffa::Message for ReconcileParentRewind { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - if self.parent_keep_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.parent_keep_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.triggering_event_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - if self.parent_keep_through.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.parent_keep_through.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.triggering_event_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.parent_session_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.parent_keep_through.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.triggering_event_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.parent_session_id.clear(); - self.parent_keep_through = ::buffa::MessageField::none(); - self.triggering_event_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReconcileParentRewind { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECONCILE_PARENT_REWIND_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReconcileParentRewind", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reconcile_parent_terminal.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reconcile_parent_terminal.__view.rs deleted file mode 100644 index 84adc350b..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reconcile_parent_terminal.__view.rs +++ /dev/null @@ -1,371 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/reconcile_parent_terminal.proto - -/// ReconcileParentTerminal is issued by the child-session reconciler when a -/// parent reaches a terminal state, recording \[ParentTerminated, -/// SessionCancelled\] against the child as one batch. Recording the observation -/// and the consequence together is what closes the silent-orphan gap. -/// -/// Write precondition At on the child: a no-op if the child is already terminal. -/// The cancellation reason is derived by the aggregate, not carried here. -#[derive(Clone, Debug, Default)] -pub struct ReconcileParentTerminalView<'a> { - /// The child session being reconciled. - /// - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `parent_session_id` - pub parent_session_id: &'a str, - /// Field 3: `cause` - pub cause: ::buffa::EnumValue, - /// The parent event that triggered this reconcile, so a redelivery is - /// recognisable as the same observation. - /// - /// Field 4: `triggering_event_id` - pub triggering_event_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReconcileParentTerminalView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `parent_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_parent_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `cause` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_cause(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `triggering_event_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_triggering_event_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ReconcileParentTerminalView<'a> { - type Owned = super::super::ReconcileParentTerminal; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.parent_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.cause = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.triggering_event_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ReconcileParentTerminal, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ReconcileParentTerminal, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReconcileParentTerminal { - session_id: self.session_id.to_string(), - parent_session_id: self.parent_session_id.to_string(), - cause: self.cause, - triggering_event_id: self.triggering_event_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReconcileParentTerminalView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - { - let val = self.cause.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.triggering_event_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - ::buffa::types::put_int32_field(3u32, self.cause.to_i32(), buf); - ::buffa::types::put_string_field(4u32, &self.triggering_event_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReconcileParentTerminalView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("parentSessionId", self.parent_session_id)?; - } - { - __map.serialize_entry("cause", &self.cause)?; - } - { - __map.serialize_entry("triggeringEventId", self.triggering_event_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReconcileParentTerminalView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ReconcileParentTerminal"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ReconcileParentTerminal"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReconcileParentTerminal"; -} -::buffa::impl_default_view_instance!(ReconcileParentTerminalView); -::buffa::impl_view_reborrow!(ReconcileParentTerminalView); -/** Self-contained, `'static` owned view of a `ReconcileParentTerminal` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReconcileParentTerminalView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReconcileParentTerminalView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReconcileParentTerminalOwnedView( - ::buffa::OwnedView>, -); -impl ReconcileParentTerminalOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileParentTerminalOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileParentTerminalOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReconcileParentTerminal, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileParentTerminalOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReconcileParentTerminalView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReconcileParentTerminalView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReconcileParentTerminal { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The child session being reconciled. - /// - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `parent_session_id` - #[must_use] - pub fn parent_session_id(&self) -> &'_ str { - self.0.reborrow().parent_session_id - } - /// Field 3: `cause` - #[must_use] - pub fn cause(&self) -> ::buffa::EnumValue { - self.0.reborrow().cause - } - /// The parent event that triggered this reconcile, so a redelivery is - /// recognisable as the same observation. - /// - /// Field 4: `triggering_event_id` - #[must_use] - pub fn triggering_event_id(&self) -> &'_ str { - self.0.reborrow().triggering_event_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReconcileParentTerminalOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReconcileParentTerminalOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReconcileParentTerminalOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReconcileParentTerminalOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReconcileParentTerminal { - type View<'a> = ReconcileParentTerminalView<'a>; - type ViewHandle = ReconcileParentTerminalOwnedView; -} -impl ::serde::Serialize for ReconcileParentTerminalOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reconcile_parent_terminal.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reconcile_parent_terminal.rs deleted file mode 100644 index ce7fe4b20..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reconcile_parent_terminal.rs +++ /dev/null @@ -1,179 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/reconcile_parent_terminal.proto - -/// ReconcileParentTerminal is issued by the child-session reconciler when a -/// parent reaches a terminal state, recording \[ParentTerminated, -/// SessionCancelled\] against the child as one batch. Recording the observation -/// and the consequence together is what closes the silent-orphan gap. -/// -/// Write precondition At on the child: a no-op if the child is already terminal. -/// The cancellation reason is derived by the aggregate, not carried here. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReconcileParentTerminal { - /// The child session being reconciled. - /// - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `parent_session_id` - #[serde( - rename = "parentSessionId", - alias = "parent_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub parent_session_id: ::buffa::alloc::string::String, - /// Field 3: `cause` - #[serde(rename = "cause", with = "::buffa::json_helpers::proto_enum")] - pub cause: ::buffa::EnumValue, - /// The parent event that triggered this reconcile, so a redelivery is - /// recognisable as the same observation. - /// - /// Field 4: `triggering_event_id` - #[serde( - rename = "triggeringEventId", - alias = "triggering_event_id", - with = "::buffa::json_helpers::proto_string" - )] - pub triggering_event_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for ReconcileParentTerminal { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReconcileParentTerminal") - .field("session_id", &self.session_id) - .field("parent_session_id", &self.parent_session_id) - .field("cause", &self.cause) - .field("triggering_event_id", &self.triggering_event_id) - .finish() - } -} -impl ReconcileParentTerminal { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReconcileParentTerminal"; -} -::buffa::impl_default_instance!(ReconcileParentTerminal); -impl ::buffa::MessageName for ReconcileParentTerminal { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ReconcileParentTerminal"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ReconcileParentTerminal"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReconcileParentTerminal"; -} -impl ::buffa::Message for ReconcileParentTerminal { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.parent_session_id) as u64; - { - let val = self.cause.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.triggering_event_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.parent_session_id, buf); - ::buffa::types::put_int32_field(3u32, self.cause.to_i32(), buf); - ::buffa::types::put_string_field(4u32, &self.triggering_event_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.parent_session_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.cause = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.triggering_event_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.parent_session_id.clear(); - self.cause = ::buffa::EnumValue::from(0); - self.triggering_event_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReconcileParentTerminal { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECONCILE_PARENT_TERMINAL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReconcileParentTerminal", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_artifact.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_artifact.__view.rs deleted file mode 100644 index f63e1d87e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_artifact.__view.rs +++ /dev/null @@ -1,327 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/record_artifact.proto - -/// RecordArtifact registers an artifact by claim-check, recording -/// \[ArtifactRecorded\]. Bytes are never inlined on the log (ADR#0035 facet 3). -/// -/// Write precondition Any. -#[derive(Clone, Debug, Default)] -pub struct RecordArtifactView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `artifact` - pub artifact: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactMetadataView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RecordArtifactView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `artifact` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_artifact(&self) -> bool { - self.artifact.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for RecordArtifactView<'a> { - type Owned = super::super::RecordArtifact; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.artifact.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.artifact = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RecordArtifact { - session_id: self.session_id.to_string(), - artifact: match self.artifact.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactMetadata, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RecordArtifactView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.artifact.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.artifact.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.artifact.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.artifact.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RecordArtifactView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.artifact.as_option() { - __map.serialize_entry("artifact", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RecordArtifactView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RecordArtifact"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RecordArtifact"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordArtifact"; -} -::buffa::impl_default_view_instance!(RecordArtifactView); -::buffa::impl_view_reborrow!(RecordArtifactView); -/** Self-contained, `'static` owned view of a `RecordArtifact` message. - - Wraps [`::buffa::OwnedView`]`<`[`RecordArtifactView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RecordArtifactView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RecordArtifactOwnedView(::buffa::OwnedView>); -impl RecordArtifactOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordArtifactOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordArtifactOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RecordArtifact, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordArtifactOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RecordArtifactView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RecordArtifactView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RecordArtifact { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `artifact` - #[must_use] - pub fn artifact( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactMetadataView<'_>, - > { - &self.0.reborrow().artifact - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RecordArtifactOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RecordArtifactOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RecordArtifactOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RecordArtifactOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RecordArtifact { - type View<'a> = RecordArtifactView<'a>; - type ViewHandle = RecordArtifactOwnedView; -} -impl ::serde::Serialize for RecordArtifactOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_artifact.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_artifact.rs deleted file mode 100644 index 7432ac0d6..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_artifact.rs +++ /dev/null @@ -1,148 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/record_artifact.proto - -/// RecordArtifact registers an artifact by claim-check, recording -/// \[ArtifactRecorded\]. Bytes are never inlined on the log (ADR#0035 facet 3). -/// -/// Write precondition Any. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RecordArtifact { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `artifact` - #[serde(rename = "artifact")] - pub artifact: ::buffa::MessageField< - ArtifactMetadata, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for RecordArtifact { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RecordArtifact") - .field("session_id", &self.session_id) - .field("artifact", &self.artifact) - .finish() - } -} -impl RecordArtifact { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordArtifact"; -} -::buffa::impl_default_instance!(RecordArtifact); -impl ::buffa::MessageName for RecordArtifact { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RecordArtifact"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RecordArtifact"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordArtifact"; -} -impl ::buffa::Message for RecordArtifact { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.artifact.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.artifact.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.artifact.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.artifact.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.artifact.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.artifact = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for RecordArtifact { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECORD_ARTIFACT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordArtifact", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_file_change.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_file_change.__view.rs deleted file mode 100644 index 35b5fab2f..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_file_change.__view.rs +++ /dev/null @@ -1,608 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/record_file_change.proto - -/// RecordFileChange attributes a workspace file change to the tool call that -/// caused it, recording \[FileChanged\]. A change with no proximate call is not -/// this command: it surfaces as a ResourceObservation whose digest moved, -/// meaning something outside the session touched the file. -/// -/// Write precondition Any. -#[derive(Clone, Debug, Default)] -pub struct RecordFileChangeView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Workspace-relative, forward slashes, no leading slash. - /// - /// Field 2: `path` - pub path: &'a str, - /// Field 3: `change_kind` - pub change_kind: ::buffa::EnumValue, - /// Field 4: `previous_path` - pub previous_path: ::core::option::Option<&'a str>, - /// Content before the change; unset for a create or when not captured. - /// Recorded because checkpoints are opaque, so what changed is not - /// re-derivable by diffing them afterwards. - /// - /// Field 5: `before_ref` - pub before_ref: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactRefView<'a>, - >, - /// Field 6: `after_ref` - pub after_ref: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactRefView<'a>, - >, - /// The causing call. Without it, which call touched this file is only - /// answerable by fold adjacency, which concurrent Any appends make - /// unsound. - /// - /// Field 7: `tool_call_id` - pub tool_call_id: &'a str, - /// Field 8: `turn_id` - pub turn_id: &'a str, - /// Field 9: `diff` - pub diff: ::buffa::MessageFieldView< - super::super::__buffa::view::DiffSummaryView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RecordFileChangeView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `path` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_path(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `change_kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_change_kind(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RecordFileChangeView<'a> { - type Owned = super::super::RecordFileChange; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.path = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.change_kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.previous_path = Some(::buffa::types::borrow_str(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.before_ref.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.before_ref = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.after_ref.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.after_ref = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.diff.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.diff = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RecordFileChange { - session_id: self.session_id.to_string(), - path: self.path.to_string(), - change_kind: self.change_kind, - previous_path: self.previous_path.map(|s| s.to_string()), - before_ref: match self.before_ref.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - after_ref: match self.after_ref.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - tool_call_id: self.tool_call_id.to_string(), - turn_id: self.turn_id.to_string(), - diff: match self.diff.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::DiffSummary, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RecordFileChangeView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.path) as u64; - { - let val = self.change_kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.previous_path { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.before_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.before_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.after_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.after_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if self.diff.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.diff.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.path, buf); - ::buffa::types::put_int32_field(3u32, self.change_kind.to_i32(), buf); - if let Some(ref v) = self.previous_path { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.before_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.before_ref.write_to(__cache, buf); - } - if self.after_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.after_ref.write_to(__cache, buf); - } - ::buffa::types::put_string_field(7u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(8u32, &self.turn_id, buf); - if self.diff.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.diff.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RecordFileChangeView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("path", self.path)?; - } - { - __map.serialize_entry("changeKind", &self.change_kind)?; - } - if let ::core::option::Option::Some(__v) = self.previous_path { - __map.serialize_entry("previousPath", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.before_ref.as_option() { - __map.serialize_entry("beforeRef", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.after_ref.as_option() { - __map.serialize_entry("afterRef", __v)?; - } - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.diff.as_option() { - __map.serialize_entry("diff", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RecordFileChangeView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RecordFileChange"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RecordFileChange"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordFileChange"; -} -::buffa::impl_default_view_instance!(RecordFileChangeView); -::buffa::impl_view_reborrow!(RecordFileChangeView); -/** Self-contained, `'static` owned view of a `RecordFileChange` message. - - Wraps [`::buffa::OwnedView`]`<`[`RecordFileChangeView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RecordFileChangeView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RecordFileChangeOwnedView(::buffa::OwnedView>); -impl RecordFileChangeOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordFileChangeOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordFileChangeOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RecordFileChange, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordFileChangeOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RecordFileChangeView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RecordFileChangeView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RecordFileChange { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Workspace-relative, forward slashes, no leading slash. - /// - /// Field 2: `path` - #[must_use] - pub fn path(&self) -> &'_ str { - self.0.reborrow().path - } - /// Field 3: `change_kind` - #[must_use] - pub fn change_kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().change_kind - } - /// Field 4: `previous_path` - #[must_use] - pub fn previous_path(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().previous_path - } - /// Content before the change; unset for a create or when not captured. - /// Recorded because checkpoints are opaque, so what changed is not - /// re-derivable by diffing them afterwards. - /// - /// Field 5: `before_ref` - #[must_use] - pub fn before_ref( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().before_ref - } - /// Field 6: `after_ref` - #[must_use] - pub fn after_ref( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().after_ref - } - /// The causing call. Without it, which call touched this file is only - /// answerable by fold adjacency, which concurrent Any appends make - /// unsound. - /// - /// Field 7: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Field 8: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } - /// Field 9: `diff` - #[must_use] - pub fn diff( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().diff - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RecordFileChangeOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RecordFileChangeOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RecordFileChangeOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RecordFileChangeOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RecordFileChange { - type View<'a> = RecordFileChangeView<'a>; - type ViewHandle = RecordFileChangeOwnedView; -} -impl ::serde::Serialize for RecordFileChangeOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_file_change.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_file_change.rs deleted file mode 100644 index aa3311adc..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_file_change.rs +++ /dev/null @@ -1,344 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/record_file_change.proto - -/// RecordFileChange attributes a workspace file change to the tool call that -/// caused it, recording \[FileChanged\]. A change with no proximate call is not -/// this command: it surfaces as a ResourceObservation whose digest moved, -/// meaning something outside the session touched the file. -/// -/// Write precondition Any. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RecordFileChange { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Workspace-relative, forward slashes, no leading slash. - /// - /// Field 2: `path` - #[serde(rename = "path", with = "::buffa::json_helpers::proto_string")] - pub path: ::buffa::alloc::string::String, - /// Field 3: `change_kind` - #[serde( - rename = "changeKind", - alias = "change_kind", - with = "::buffa::json_helpers::proto_enum" - )] - pub change_kind: ::buffa::EnumValue, - /// Field 4: `previous_path` - #[serde( - rename = "previousPath", - alias = "previous_path", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub previous_path: ::core::option::Option<::buffa::alloc::string::String>, - /// Content before the change; unset for a create or when not captured. - /// Recorded because checkpoints are opaque, so what changed is not - /// re-derivable by diffing them afterwards. - /// - /// Field 5: `before_ref` - #[serde( - rename = "beforeRef", - alias = "before_ref", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub before_ref: ::buffa::MessageField>, - /// Field 6: `after_ref` - #[serde( - rename = "afterRef", - alias = "after_ref", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub after_ref: ::buffa::MessageField>, - /// The causing call. Without it, which call touched this file is only - /// answerable by fold adjacency, which concurrent Any appends make - /// unsound. - /// - /// Field 7: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Field 8: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, - /// Field 9: `diff` - #[serde( - rename = "diff", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub diff: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for RecordFileChange { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RecordFileChange") - .field("session_id", &self.session_id) - .field("path", &self.path) - .field("change_kind", &self.change_kind) - .field("previous_path", &self.previous_path) - .field("before_ref", &self.before_ref) - .field("after_ref", &self.after_ref) - .field("tool_call_id", &self.tool_call_id) - .field("turn_id", &self.turn_id) - .field("diff", &self.diff) - .finish() - } -} -impl RecordFileChange { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordFileChange"; -} -impl RecordFileChange { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::previous_path`] to `Some(value)`, consuming and returning `self`. - pub fn with_previous_path( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.previous_path = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(RecordFileChange); -impl ::buffa::MessageName for RecordFileChange { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RecordFileChange"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RecordFileChange"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordFileChange"; -} -impl ::buffa::Message for RecordFileChange { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.path) as u64; - { - let val = self.change_kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.previous_path { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.before_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.before_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.after_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.after_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if self.diff.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.diff.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.path, buf); - ::buffa::types::put_int32_field(3u32, self.change_kind.to_i32(), buf); - if let Some(ref v) = self.previous_path { - ::buffa::types::put_string_field(4u32, v, buf); - } - if self.before_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.before_ref.write_to(__cache, buf); - } - if self.after_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.after_ref.write_to(__cache, buf); - } - ::buffa::types::put_string_field(7u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(8u32, &self.turn_id, buf); - if self.diff.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.diff.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.path, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.change_kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .previous_path - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.before_ref.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.after_ref.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.diff.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.path.clear(); - self.change_kind = ::buffa::EnumValue::from(0); - self.previous_path = ::core::option::Option::None; - self.before_ref = ::buffa::MessageField::none(); - self.after_ref = ::buffa::MessageField::none(); - self.tool_call_id.clear(); - self.turn_id.clear(); - self.diff = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for RecordFileChange { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECORD_FILE_CHANGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordFileChange", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_operation_outcome.__oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_operation_outcome.__oneof.rs deleted file mode 100644 index 51e3594a6..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_operation_outcome.__oneof.rs +++ /dev/null @@ -1,82 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/record_operation_outcome.proto - -pub mod record_operation_outcome { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, PartialEq, Debug)] - pub enum Outcome { - Succeeded(::buffa::alloc::boxed::Box), - Failed(::buffa::alloc::boxed::Box), - Cancelled(::buffa::alloc::boxed::Box), - Unknown(::buffa::alloc::boxed::Box), - } - impl ::buffa::Oneof for Outcome {} - impl From for Outcome { - fn from(v: super::super::super::OperationSucceeded) -> Self { - Self::Succeeded(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::OperationSucceeded) -> Self { - Self::Some(Outcome::from(v)) - } - } - impl From for Outcome { - fn from(v: super::super::super::OperationFailed) -> Self { - Self::Failed(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::OperationFailed) -> Self { - Self::Some(Outcome::from(v)) - } - } - impl From for Outcome { - fn from(v: super::super::super::OperationCancelled) -> Self { - Self::Cancelled(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::OperationCancelled) -> Self { - Self::Some(Outcome::from(v)) - } - } - impl From for Outcome { - fn from(v: super::super::super::OperationUnknown) -> Self { - Self::Unknown(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From - for ::core::option::Option { - fn from(v: super::super::super::OperationUnknown) -> Self { - Self::Some(Outcome::from(v)) - } - } - impl serde::Serialize for Outcome { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::Succeeded(v) => { - map.serialize_entry("succeeded", v)?; - } - Self::Failed(v) => { - map.serialize_entry("failed", v)?; - } - Self::Cancelled(v) => { - map.serialize_entry("cancelled", v)?; - } - Self::Unknown(v) => { - map.serialize_entry("unknown", v)?; - } - } - map.end() - } - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_operation_outcome.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_operation_outcome.__view.rs deleted file mode 100644 index 717659305..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_operation_outcome.__view.rs +++ /dev/null @@ -1,589 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/record_operation_outcome.proto - -/// RecordOperationOutcome settles a reserved operation, recording -/// \[OperationOutcomeRecorded\]. It is how an interrupted side effect stops being -/// in flight, and it stays admissible after the session is terminal so work -/// stranded by a cancellation can still be reconciled. -/// -/// Write precondition At: one determinate outcome per operation_id. An `unknown` -/// outcome is not determinate; it may be superseded exactly once by a -/// determinate one. -#[derive(Clone, Debug, Default)] -pub struct RecordOperationOutcomeView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `operation_id` - pub operation_id: &'a str, - pub outcome: ::core::option::Option< - super::super::__buffa::view::oneof::record_operation_outcome::Outcome<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RecordOperationOutcomeView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RecordOperationOutcomeView<'a> { - type Owned = super::super::RecordOperationOutcome; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Succeeded( - ref mut existing, - ), - ) = view.outcome - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.outcome = Some( - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Succeeded( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Failed( - ref mut existing, - ), - ) = view.outcome - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.outcome = Some( - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Failed( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Cancelled( - ref mut existing, - ), - ) = view.outcome - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.outcome = Some( - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Cancelled( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Unknown( - ref mut existing, - ), - ) = view.outcome - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.outcome = Some( - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Unknown( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::RecordOperationOutcome, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::RecordOperationOutcome, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RecordOperationOutcome { - session_id: self.session_id.to_string(), - operation_id: self.operation_id.to_string(), - outcome: match self.outcome.as_ref() { - ::core::option::Option::Some(v) => { - ::core::option::Option::Some( - match v { - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Succeeded( - v, - ) => { - super::super::__buffa::oneof::record_operation_outcome::Outcome::Succeeded( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Failed( - v, - ) => { - super::super::__buffa::oneof::record_operation_outcome::Outcome::Failed( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Cancelled( - v, - ) => { - super::super::__buffa::oneof::record_operation_outcome::Outcome::Cancelled( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Unknown( - v, - ) => { - super::super::__buffa::oneof::record_operation_outcome::Outcome::Unknown( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - }, - ) - } - ::core::option::Option::None => ::core::option::Option::None, - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RecordOperationOutcomeView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Succeeded( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Failed( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Cancelled( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Unknown( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Succeeded( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Failed( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Cancelled( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Unknown( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RecordOperationOutcomeView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("operationId", self.operation_id)?; - } - if let ::core::option::Option::Some(ref __ov) = self.outcome { - match __ov { - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Succeeded( - v, - ) => { - __map.serialize_entry("succeeded", v)?; - } - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Failed( - v, - ) => { - __map.serialize_entry("failed", v)?; - } - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Cancelled( - v, - ) => { - __map.serialize_entry("cancelled", v)?; - } - super::super::__buffa::view::oneof::record_operation_outcome::Outcome::Unknown( - v, - ) => { - __map.serialize_entry("unknown", v)?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RecordOperationOutcomeView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RecordOperationOutcome"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RecordOperationOutcome"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordOperationOutcome"; -} -::buffa::impl_default_view_instance!(RecordOperationOutcomeView); -::buffa::impl_view_reborrow!(RecordOperationOutcomeView); -/** Self-contained, `'static` owned view of a `RecordOperationOutcome` message. - - Wraps [`::buffa::OwnedView`]`<`[`RecordOperationOutcomeView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RecordOperationOutcomeView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RecordOperationOutcomeOwnedView( - ::buffa::OwnedView>, -); -impl RecordOperationOutcomeOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordOperationOutcomeOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordOperationOutcomeOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RecordOperationOutcome, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordOperationOutcomeOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RecordOperationOutcomeView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RecordOperationOutcomeView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RecordOperationOutcome { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Oneof `outcome`. - #[must_use] - pub fn outcome( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::record_operation_outcome::Outcome<'_>, - > { - self.0.reborrow().outcome.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RecordOperationOutcomeOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RecordOperationOutcomeOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RecordOperationOutcomeOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RecordOperationOutcomeOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RecordOperationOutcome { - type View<'a> = RecordOperationOutcomeView<'a>; - type ViewHandle = RecordOperationOutcomeOwnedView; -} -impl ::serde::Serialize for RecordOperationOutcomeOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_operation_outcome.__view_oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_operation_outcome.__view_oneof.rs deleted file mode 100644 index cda8257b4..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_operation_outcome.__view_oneof.rs +++ /dev/null @@ -1,30 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/record_operation_outcome.proto - -pub mod record_operation_outcome { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Outcome<'a> { - Succeeded( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::OperationSucceededView<'a>, - >, - ), - Failed( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::OperationFailedView<'a>, - >, - ), - Cancelled( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::OperationCancelledView<'a>, - >, - ), - Unknown( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::OperationUnknownView<'a>, - >, - ), - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_operation_outcome.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_operation_outcome.rs deleted file mode 100644 index c99ab622c..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_operation_outcome.rs +++ /dev/null @@ -1,486 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/record_operation_outcome.proto - -/// RecordOperationOutcome settles a reserved operation, recording -/// \[OperationOutcomeRecorded\]. It is how an interrupted side effect stops being -/// in flight, and it stays admissible after the session is terminal so work -/// stranded by a cancellation can still be reconciled. -/// -/// Write precondition At: one determinate outcome per operation_id. An `unknown` -/// outcome is not determinate; it may be superseded exactly once by a -/// determinate one. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct RecordOperationOutcome { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - #[serde(flatten)] - pub outcome: ::core::option::Option< - __buffa::oneof::record_operation_outcome::Outcome, - >, -} -impl ::core::fmt::Debug for RecordOperationOutcome { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RecordOperationOutcome") - .field("session_id", &self.session_id) - .field("operation_id", &self.operation_id) - .field("outcome", &self.outcome) - .finish() - } -} -impl RecordOperationOutcome { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordOperationOutcome"; -} -::buffa::impl_default_instance!(RecordOperationOutcome); -impl ::buffa::MessageName for RecordOperationOutcome { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RecordOperationOutcome"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RecordOperationOutcome"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordOperationOutcome"; -} -impl ::buffa::Message for RecordOperationOutcome { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - __buffa::oneof::record_operation_outcome::Outcome::Succeeded(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::record_operation_outcome::Outcome::Failed(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::record_operation_outcome::Outcome::Cancelled(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::record_operation_outcome::Outcome::Unknown(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - __buffa::oneof::record_operation_outcome::Outcome::Succeeded(x) => { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::record_operation_outcome::Outcome::Failed(x) => { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::record_operation_outcome::Outcome::Cancelled(x) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::record_operation_outcome::Outcome::Unknown(x) => { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::record_operation_outcome::Outcome::Succeeded( - ref mut existing, - ), - ) = self.outcome - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.outcome = ::core::option::Option::Some( - __buffa::oneof::record_operation_outcome::Outcome::Succeeded( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::record_operation_outcome::Outcome::Failed( - ref mut existing, - ), - ) = self.outcome - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.outcome = ::core::option::Option::Some( - __buffa::oneof::record_operation_outcome::Outcome::Failed( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::record_operation_outcome::Outcome::Cancelled( - ref mut existing, - ), - ) = self.outcome - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.outcome = ::core::option::Option::Some( - __buffa::oneof::record_operation_outcome::Outcome::Cancelled( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::record_operation_outcome::Outcome::Unknown( - ref mut existing, - ), - ) = self.outcome - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.outcome = ::core::option::Option::Some( - __buffa::oneof::record_operation_outcome::Outcome::Unknown( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.operation_id.clear(); - self.outcome = ::core::option::Option::None; - } -} -impl<'de> serde::Deserialize<'de> for RecordOperationOutcome { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = RecordOperationOutcome; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct RecordOperationOutcome") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __f_session_id: ::core::option::Option< - ::buffa::alloc::string::String, - > = None; - let mut __f_operation_id: ::core::option::Option< - ::buffa::alloc::string::String, - > = None; - let mut __oneof_outcome: ::core::option::Option< - __buffa::oneof::record_operation_outcome::Outcome, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "sessionId" | "session_id" => { - __f_session_id = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::alloc::string::String; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::string::String, - D::Error, - > { - ::buffa::json_helpers::proto_string::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "operationId" | "operation_id" => { - __f_operation_id = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::alloc::string::String; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::string::String, - D::Error, - > { - ::buffa::json_helpers::proto_string::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "succeeded" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - OperationSucceeded, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_outcome.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'outcome'", - ), - ); - } - __oneof_outcome = Some( - __buffa::oneof::record_operation_outcome::Outcome::Succeeded( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "failed" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - OperationFailed, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_outcome.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'outcome'", - ), - ); - } - __oneof_outcome = Some( - __buffa::oneof::record_operation_outcome::Outcome::Failed( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "cancelled" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - OperationCancelled, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_outcome.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'outcome'", - ), - ); - } - __oneof_outcome = Some( - __buffa::oneof::record_operation_outcome::Outcome::Cancelled( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "unknown" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - OperationUnknown, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_outcome.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'outcome'", - ), - ); - } - __oneof_outcome = Some( - __buffa::oneof::record_operation_outcome::Outcome::Unknown( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - if let ::core::option::Option::Some(v) = __f_session_id { - __r.session_id = v; - } - if let ::core::option::Option::Some(v) = __f_operation_id { - __r.operation_id = v; - } - __r.outcome = __oneof_outcome; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for RecordOperationOutcome { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECORD_OPERATION_OUTCOME_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordOperationOutcome", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod record_operation_outcome { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::record_operation_outcome::Outcome; - #[doc(inline)] - pub use super::__buffa::view::oneof::record_operation_outcome::Outcome as OutcomeView; -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_system_notice.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_system_notice.__view.rs deleted file mode 100644 index f036ce219..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_system_notice.__view.rs +++ /dev/null @@ -1,349 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/record_system_notice.proto - -/// RecordSystemNotice appends a system-originated notice, recording -/// \[SystemNoticeRecorded\], so model-visible system content and the user-visible -/// transcript both rebuild from the log alone (ADR#0035 facet 8). -/// -/// Write precondition Any. -#[derive(Clone, Debug, Default)] -pub struct RecordSystemNoticeView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `level` - pub level: ::buffa::EnumValue, - /// Field 3: `text` - pub text: &'a str, - /// Set when the notice concerns a specific call. - /// - /// Field 4: `tool_call_id` - pub tool_call_id: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RecordSystemNoticeView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `level` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_level(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `text` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_text(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RecordSystemNoticeView<'a> { - type Owned = super::super::RecordSystemNotice; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.level = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.text = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RecordSystemNotice { - session_id: self.session_id.to_string(), - level: self.level, - text: self.text.to_string(), - tool_call_id: self.tool_call_id.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RecordSystemNoticeView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.level.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - if let Some(ref v) = self.tool_call_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.level.to_i32(), buf); - ::buffa::types::put_string_field(3u32, &self.text, buf); - if let Some(ref v) = self.tool_call_id { - ::buffa::types::put_string_field(4u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RecordSystemNoticeView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("level", &self.level)?; - } - { - __map.serialize_entry("text", self.text)?; - } - if let ::core::option::Option::Some(__v) = self.tool_call_id { - __map.serialize_entry("toolCallId", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RecordSystemNoticeView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RecordSystemNotice"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RecordSystemNotice"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordSystemNotice"; -} -::buffa::impl_default_view_instance!(RecordSystemNoticeView); -::buffa::impl_view_reborrow!(RecordSystemNoticeView); -/** Self-contained, `'static` owned view of a `RecordSystemNotice` message. - - Wraps [`::buffa::OwnedView`]`<`[`RecordSystemNoticeView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RecordSystemNoticeView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RecordSystemNoticeOwnedView( - ::buffa::OwnedView>, -); -impl RecordSystemNoticeOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordSystemNoticeOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordSystemNoticeOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RecordSystemNotice, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordSystemNoticeOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RecordSystemNoticeView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RecordSystemNoticeView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RecordSystemNotice { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `level` - #[must_use] - pub fn level(&self) -> ::buffa::EnumValue { - self.0.reborrow().level - } - /// Field 3: `text` - #[must_use] - pub fn text(&self) -> &'_ str { - self.0.reborrow().text - } - /// Set when the notice concerns a specific call. - /// - /// Field 4: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().tool_call_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RecordSystemNoticeOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RecordSystemNoticeOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RecordSystemNoticeOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RecordSystemNoticeOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RecordSystemNotice { - type View<'a> = RecordSystemNoticeView<'a>; - type ViewHandle = RecordSystemNoticeOwnedView; -} -impl ::serde::Serialize for RecordSystemNoticeOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_system_notice.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_system_notice.rs deleted file mode 100644 index 133322153..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_system_notice.rs +++ /dev/null @@ -1,188 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/record_system_notice.proto - -/// RecordSystemNotice appends a system-originated notice, recording -/// \[SystemNoticeRecorded\], so model-visible system content and the user-visible -/// transcript both rebuild from the log alone (ADR#0035 facet 8). -/// -/// Write precondition Any. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RecordSystemNotice { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `level` - #[serde(rename = "level", with = "::buffa::json_helpers::proto_enum")] - pub level: ::buffa::EnumValue, - /// Field 3: `text` - #[serde(rename = "text", with = "::buffa::json_helpers::proto_string")] - pub text: ::buffa::alloc::string::String, - /// Set when the notice concerns a specific call. - /// - /// Field 4: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub tool_call_id: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for RecordSystemNotice { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RecordSystemNotice") - .field("session_id", &self.session_id) - .field("level", &self.level) - .field("text", &self.text) - .field("tool_call_id", &self.tool_call_id) - .finish() - } -} -impl RecordSystemNotice { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordSystemNotice"; -} -impl RecordSystemNotice { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::tool_call_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_tool_call_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.tool_call_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(RecordSystemNotice); -impl ::buffa::MessageName for RecordSystemNotice { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RecordSystemNotice"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RecordSystemNotice"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordSystemNotice"; -} -impl ::buffa::Message for RecordSystemNotice { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.level.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - if let Some(ref v) = self.tool_call_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.level.to_i32(), buf); - ::buffa::types::put_string_field(3u32, &self.text, buf); - if let Some(ref v) = self.tool_call_id { - ::buffa::types::put_string_field(4u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.level = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.text, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .tool_call_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.level = ::buffa::EnumValue::from(0); - self.text.clear(); - self.tool_call_id = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for RecordSystemNotice { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECORD_SYSTEM_NOTICE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordSystemNotice", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_user_message.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_user_message.__view.rs deleted file mode 100644 index b460cd10a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_user_message.__view.rs +++ /dev/null @@ -1,367 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/record_user_message.proto - -/// RecordUserMessage appends a user message, recording \[UserMessageRecorded\]. -/// -/// Write precondition Any: arrival of a message is a happened-fact that commutes -/// with other appends and carries no invariant a concurrent writer could break -/// (ADR#0035 facet 2). -#[derive(Clone, Debug, Default)] -pub struct RecordUserMessageView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `message` - pub message: ::buffa::MessageFieldView< - super::super::__buffa::view::CanonicalMessageView<'a>, - >, - /// The turn this message opens; every event produced within the turn - /// repeats it, because the fold cannot recover a boundary that concurrent - /// Any appends give no reliable ordering for. - /// - /// Field 3: `turn_id` - pub turn_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RecordUserMessageView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `message` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message(&self) -> bool { - self.message.is_set() - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RecordUserMessageView<'a> { - type Owned = super::super::RecordUserMessage; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.message.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.message = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RecordUserMessage { - session_id: self.session_id.to_string(), - message: match self.message.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CanonicalMessage, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - turn_id: self.turn_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RecordUserMessageView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.message.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.message.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.message.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.message.write_to(__cache, buf); - } - ::buffa::types::put_string_field(3u32, &self.turn_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RecordUserMessageView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.message.as_option() { - __map.serialize_entry("message", __v)?; - } - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RecordUserMessageView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RecordUserMessage"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RecordUserMessage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordUserMessage"; -} -::buffa::impl_default_view_instance!(RecordUserMessageView); -::buffa::impl_view_reborrow!(RecordUserMessageView); -/** Self-contained, `'static` owned view of a `RecordUserMessage` message. - - Wraps [`::buffa::OwnedView`]`<`[`RecordUserMessageView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RecordUserMessageView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RecordUserMessageOwnedView( - ::buffa::OwnedView>, -); -impl RecordUserMessageOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordUserMessageOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordUserMessageOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RecordUserMessage, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecordUserMessageOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RecordUserMessageView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RecordUserMessageView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RecordUserMessage { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `message` - #[must_use] - pub fn message( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CanonicalMessageView<'_>, - > { - &self.0.reborrow().message - } - /// The turn this message opens; every event produced within the turn - /// repeats it, because the fold cannot recover a boundary that concurrent - /// Any appends give no reliable ordering for. - /// - /// Field 3: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RecordUserMessageOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RecordUserMessageOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RecordUserMessageOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RecordUserMessageOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RecordUserMessage { - type View<'a> = RecordUserMessageView<'a>; - type ViewHandle = RecordUserMessageOwnedView; -} -impl ::serde::Serialize for RecordUserMessageOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_user_message.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_user_message.rs deleted file mode 100644 index 7dafcc034..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.record_user_message.rs +++ /dev/null @@ -1,171 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/record_user_message.proto - -/// RecordUserMessage appends a user message, recording \[UserMessageRecorded\]. -/// -/// Write precondition Any: arrival of a message is a happened-fact that commutes -/// with other appends and carries no invariant a concurrent writer could break -/// (ADR#0035 facet 2). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RecordUserMessage { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `message` - #[serde(rename = "message")] - pub message: ::buffa::MessageField< - CanonicalMessage, - ::buffa::Inline, - >, - /// The turn this message opens; every event produced within the turn - /// repeats it, because the fold cannot recover a boundary that concurrent - /// Any appends give no reliable ordering for. - /// - /// Field 3: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for RecordUserMessage { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RecordUserMessage") - .field("session_id", &self.session_id) - .field("message", &self.message) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl RecordUserMessage { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordUserMessage"; -} -::buffa::impl_default_instance!(RecordUserMessage); -impl ::buffa::MessageName for RecordUserMessage { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RecordUserMessage"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RecordUserMessage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordUserMessage"; -} -impl ::buffa::Message for RecordUserMessage { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.message.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.message.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.message.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.message.write_to(__cache, buf); - } - ::buffa::types::put_string_field(3u32, &self.turn_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.message.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.message = ::buffa::MessageField::none(); - self.turn_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for RecordUserMessage { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECORD_USER_MESSAGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecordUserMessage", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.recover_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.recover_session.__view.rs deleted file mode 100644 index a9a72f762..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.recover_session.__view.rs +++ /dev/null @@ -1,684 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/recover_session.proto - -/// RecoverSession opens a session carrying what a salvage could read from a -/// damaged source, recording \[SessionStarted, SessionRecovered\] as one batch. -/// -/// Write precondition NoStream on the new stream. The source is a different -/// aggregate and this decider never reads it, so what the salvage found is -/// carried on the command rather than derived here; the same rule ForkSession -/// follows. The NoStream precondition is what makes a retried salvage safe: a -/// second attempt derives the same session_id and is rejected instead of -/// producing a second copy. -/// -/// The salvaged events themselves are appended after this batch, as this -/// session's own events. This command records only that the session is a -/// recovery and how complete it is. -#[derive(Clone, Debug, Default)] -pub struct RecoverSessionView<'a> { - /// Derived from the salvage identity, never randomly minted. - /// - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `execution_plan` - pub execution_plan: ::buffa::MessageFieldView< - super::super::__buffa::view::StoredSessionExecutionPlanView<'a>, - >, - /// Field 3: `workspace` - pub workspace: ::buffa::MessageFieldView< - super::super::__buffa::view::WorkspaceRefView<'a>, - >, - /// Field 4: `source_session_id` - pub source_session_id: &'a str, - /// The last source ordinal the salvage drew from. - /// - /// Field 5: `source_boundary` - pub source_boundary: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 6: `source_digest` - pub source_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Field 7: `salvage_key` - pub salvage_key: &'a str, - /// Field 8: `completeness` - pub completeness: ::buffa::EnumValue, - /// Field 9: `omitted_count` - pub omitted_count: u32, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RecoverSessionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `execution_plan` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_execution_plan(&self) -> bool { - self.execution_plan.is_set() - } - /**Whether required field `workspace` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_workspace(&self) -> bool { - self.workspace.is_set() - } - /**Whether required field `source_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `source_boundary` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_boundary(&self) -> bool { - self.source_boundary.is_set() - } - /**Whether required field `source_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_digest(&self) -> bool { - self.source_digest.is_set() - } - /**Whether required field `salvage_key` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_salvage_key(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `completeness` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_completeness(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `omitted_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_omitted_count(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RecoverSessionView<'a> { - type Owned = super::super::RecoverSession; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.execution_plan.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.execution_plan = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.workspace.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.workspace = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.source_boundary.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.source_boundary = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.source_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.source_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.salvage_key = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.completeness = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 8u64; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.omitted_count = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RecoverSession { - session_id: self.session_id.to_string(), - execution_plan: match self.execution_plan.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::StoredSessionExecutionPlan, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - workspace: match self.workspace.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::WorkspaceRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - source_session_id: self.source_session_id.to_string(), - source_boundary: match self.source_boundary.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - source_digest: match self.source_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - salvage_key: self.salvage_key.to_string(), - completeness: self.completeness, - omitted_count: self.omitted_count, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RecoverSessionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.execution_plan.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.execution_plan.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.workspace.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.workspace.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.source_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.source_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.salvage_key) as u64; - { - let val = self.completeness.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.omitted_count) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.execution_plan.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.execution_plan.write_to(__cache, buf); - } - if self.workspace.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.workspace.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.source_session_id, buf); - if self.source_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_boundary.write_to(__cache, buf); - } - if self.source_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(7u32, &self.salvage_key, buf); - ::buffa::types::put_int32_field(8u32, self.completeness.to_i32(), buf); - ::buffa::types::put_uint32_field(9u32, self.omitted_count, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RecoverSessionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.execution_plan.as_option() { - __map.serialize_entry("executionPlan", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.workspace.as_option() { - __map.serialize_entry("workspace", __v)?; - } - } - { - __map.serialize_entry("sourceSessionId", self.source_session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.source_boundary.as_option() { - __map.serialize_entry("sourceBoundary", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.source_digest.as_option() { - __map.serialize_entry("sourceDigest", __v)?; - } - } - { - __map.serialize_entry("salvageKey", self.salvage_key)?; - } - { - __map.serialize_entry("completeness", &self.completeness)?; - } - { - __map - .serialize_entry( - "omittedCount", - &::buffa::json_helpers::ProtoJson(&self.omitted_count), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RecoverSessionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RecoverSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RecoverSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecoverSession"; -} -::buffa::impl_default_view_instance!(RecoverSessionView); -::buffa::impl_view_reborrow!(RecoverSessionView); -/** Self-contained, `'static` owned view of a `RecoverSession` message. - - Wraps [`::buffa::OwnedView`]`<`[`RecoverSessionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RecoverSessionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RecoverSessionOwnedView(::buffa::OwnedView>); -impl RecoverSessionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecoverSessionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecoverSessionOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RecoverSession, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RecoverSessionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RecoverSessionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RecoverSessionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RecoverSession { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Derived from the salvage identity, never randomly minted. - /// - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `execution_plan` - #[must_use] - pub fn execution_plan( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::StoredSessionExecutionPlanView<'_>, - > { - &self.0.reborrow().execution_plan - } - /// Field 3: `workspace` - #[must_use] - pub fn workspace( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().workspace - } - /// Field 4: `source_session_id` - #[must_use] - pub fn source_session_id(&self) -> &'_ str { - self.0.reborrow().source_session_id - } - /// The last source ordinal the salvage drew from. - /// - /// Field 5: `source_boundary` - #[must_use] - pub fn source_boundary( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().source_boundary - } - /// Field 6: `source_digest` - #[must_use] - pub fn source_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().source_digest - } - /// Field 7: `salvage_key` - #[must_use] - pub fn salvage_key(&self) -> &'_ str { - self.0.reborrow().salvage_key - } - /// Field 8: `completeness` - #[must_use] - pub fn completeness( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().completeness - } - /// Field 9: `omitted_count` - #[must_use] - pub fn omitted_count(&self) -> u32 { - self.0.reborrow().omitted_count - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RecoverSessionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RecoverSessionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RecoverSessionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RecoverSessionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RecoverSession { - type View<'a> = RecoverSessionView<'a>; - type ViewHandle = RecoverSessionOwnedView; -} -impl ::serde::Serialize for RecoverSessionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.recover_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.recover_session.rs deleted file mode 100644 index e49d271bd..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.recover_session.rs +++ /dev/null @@ -1,334 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/recover_session.proto - -/// RecoverSession opens a session carrying what a salvage could read from a -/// damaged source, recording \[SessionStarted, SessionRecovered\] as one batch. -/// -/// Write precondition NoStream on the new stream. The source is a different -/// aggregate and this decider never reads it, so what the salvage found is -/// carried on the command rather than derived here; the same rule ForkSession -/// follows. The NoStream precondition is what makes a retried salvage safe: a -/// second attempt derives the same session_id and is rejected instead of -/// producing a second copy. -/// -/// The salvaged events themselves are appended after this batch, as this -/// session's own events. This command records only that the session is a -/// recovery and how complete it is. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RecoverSession { - /// Derived from the salvage identity, never randomly minted. - /// - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `execution_plan` - #[serde(rename = "executionPlan", alias = "execution_plan")] - pub execution_plan: ::buffa::MessageField< - StoredSessionExecutionPlan, - ::buffa::Inline, - >, - /// Field 3: `workspace` - #[serde(rename = "workspace")] - pub workspace: ::buffa::MessageField>, - /// Field 4: `source_session_id` - #[serde( - rename = "sourceSessionId", - alias = "source_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub source_session_id: ::buffa::alloc::string::String, - /// The last source ordinal the salvage drew from. - /// - /// Field 5: `source_boundary` - #[serde(rename = "sourceBoundary", alias = "source_boundary")] - pub source_boundary: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Field 6: `source_digest` - #[serde(rename = "sourceDigest", alias = "source_digest")] - pub source_digest: ::buffa::MessageField>, - /// Field 7: `salvage_key` - #[serde( - rename = "salvageKey", - alias = "salvage_key", - with = "::buffa::json_helpers::proto_string" - )] - pub salvage_key: ::buffa::alloc::string::String, - /// Field 8: `completeness` - #[serde(rename = "completeness", with = "::buffa::json_helpers::proto_enum")] - pub completeness: ::buffa::EnumValue, - /// Field 9: `omitted_count` - #[serde( - rename = "omittedCount", - alias = "omitted_count", - with = "::buffa::json_helpers::uint32" - )] - pub omitted_count: u32, -} -impl ::core::fmt::Debug for RecoverSession { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RecoverSession") - .field("session_id", &self.session_id) - .field("execution_plan", &self.execution_plan) - .field("workspace", &self.workspace) - .field("source_session_id", &self.source_session_id) - .field("source_boundary", &self.source_boundary) - .field("source_digest", &self.source_digest) - .field("salvage_key", &self.salvage_key) - .field("completeness", &self.completeness) - .field("omitted_count", &self.omitted_count) - .finish() - } -} -impl RecoverSession { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecoverSession"; -} -::buffa::impl_default_instance!(RecoverSession); -impl ::buffa::MessageName for RecoverSession { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RecoverSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RecoverSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecoverSession"; -} -impl ::buffa::Message for RecoverSession { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.execution_plan.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.execution_plan.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.workspace.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.workspace.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.source_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.source_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.salvage_key) as u64; - { - let val = self.completeness.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.omitted_count) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.execution_plan.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.execution_plan.write_to(__cache, buf); - } - if self.workspace.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.workspace.write_to(__cache, buf); - } - ::buffa::types::put_string_field(4u32, &self.source_session_id, buf); - if self.source_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_boundary.write_to(__cache, buf); - } - if self.source_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(7u32, &self.salvage_key, buf); - ::buffa::types::put_int32_field(8u32, self.completeness.to_i32(), buf); - ::buffa::types::put_uint32_field(9u32, self.omitted_count, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.execution_plan.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.workspace.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.source_session_id, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.source_boundary.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.source_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.salvage_key, buf)?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.completeness = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.omitted_count = ::buffa::types::decode_uint32(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.execution_plan = ::buffa::MessageField::none(); - self.workspace = ::buffa::MessageField::none(); - self.source_session_id.clear(); - self.source_boundary = ::buffa::MessageField::none(); - self.source_digest = ::buffa::MessageField::none(); - self.salvage_key.clear(); - self.completeness = ::buffa::EnumValue::from(0); - self.omitted_count = 0u32; - } -} -impl ::buffa::json_helpers::ProtoElemJson for RecoverSession { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECOVER_SESSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.RecoverSession", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.redaction_applied.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.redaction_applied.__view.rs deleted file mode 100644 index f6b5ce7f0..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.redaction_applied.__view.rs +++ /dev/null @@ -1,323 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/redaction_applied.proto - -/// RedactionApplied records that the targeted events' content must be masked at -/// read time by the fold and every projection; original bytes remain on the -/// keep-forever log (D7). Because every redelivered duplicate of an event -/// shares one deterministic event id (D3), redaction by event id covers -/// duplicates automatically. Redaction on a source stream automatically masks -/// every fork's inherited context, since a fork reads source events by -/// reference (D2) rather than copying them. It is an invariant-bearing -/// transition (WRITE_PRECONDITION = At). -#[derive(Clone, Debug, Default)] -pub struct RedactionAppliedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Ids of the events whose content must be masked at read time. - /// - /// Field 2: `redacted_event_ids` - pub redacted_event_ids: ::buffa::RepeatedView<'a, &'a str>, - /// Command-time reason for the redaction; empty when none. - /// - /// Field 3: `reason` - pub reason: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RedactionAppliedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RedactionAppliedView<'a> { - type Owned = super::super::RedactionApplied; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = Some(::buffa::types::borrow_str(&mut cur)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::borrow_str(&mut cur)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - view.redacted_event_ids.push(__elem); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RedactionApplied { - session_id: self.session_id.to_string(), - redacted_event_ids: self - .redacted_event_ids - .iter() - .map(|s| s.to_string()) - .collect(), - reason: self.reason.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RedactionAppliedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - for v in &self.redacted_event_ids { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - for v in &self.redacted_event_ids { - ::buffa::types::put_string_field(2u32, v, buf); - } - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RedactionAppliedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - if !self.redacted_event_ids.is_empty() { - __map.serialize_entry("redactedEventIds", &*self.redacted_event_ids)?; - } - if let ::core::option::Option::Some(__v) = self.reason { - __map.serialize_entry("reason", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RedactionAppliedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RedactionApplied"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RedactionApplied"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RedactionApplied"; -} -::buffa::impl_default_view_instance!(RedactionAppliedView); -::buffa::impl_view_reborrow!(RedactionAppliedView); -/** Self-contained, `'static` owned view of a `RedactionApplied` message. - - Wraps [`::buffa::OwnedView`]`<`[`RedactionAppliedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RedactionAppliedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RedactionAppliedOwnedView(::buffa::OwnedView>); -impl RedactionAppliedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RedactionAppliedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RedactionAppliedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RedactionApplied, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RedactionAppliedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RedactionAppliedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RedactionAppliedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RedactionApplied { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Ids of the events whose content must be masked at read time. - /// - /// Field 2: `redacted_event_ids` - #[must_use] - pub fn redacted_event_ids(&self) -> &::buffa::RepeatedView<'_, &'_ str> { - &self.0.reborrow().redacted_event_ids - } - /// Command-time reason for the redaction; empty when none. - /// - /// Field 3: `reason` - #[must_use] - pub fn reason(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RedactionAppliedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RedactionAppliedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RedactionAppliedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RedactionAppliedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RedactionApplied { - type View<'a> = RedactionAppliedView<'a>; - type ViewHandle = RedactionAppliedOwnedView; -} -impl ::serde::Serialize for RedactionAppliedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.redaction_applied.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.redaction_applied.rs deleted file mode 100644 index 804d9bbed..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.redaction_applied.rs +++ /dev/null @@ -1,181 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/redaction_applied.proto - -/// RedactionApplied records that the targeted events' content must be masked at -/// read time by the fold and every projection; original bytes remain on the -/// keep-forever log (D7). Because every redelivered duplicate of an event -/// shares one deterministic event id (D3), redaction by event id covers -/// duplicates automatically. Redaction on a source stream automatically masks -/// every fork's inherited context, since a fork reads source events by -/// reference (D2) rather than copying them. It is an invariant-bearing -/// transition (WRITE_PRECONDITION = At). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RedactionApplied { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Ids of the events whose content must be masked at read time. - /// - /// Field 2: `redacted_event_ids` - #[serde( - rename = "redactedEventIds", - alias = "redacted_event_ids", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub redacted_event_ids: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, - /// Command-time reason for the redaction; empty when none. - /// - /// Field 3: `reason` - #[serde(rename = "reason", skip_serializing_if = "::core::option::Option::is_none")] - pub reason: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for RedactionApplied { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RedactionApplied") - .field("session_id", &self.session_id) - .field("redacted_event_ids", &self.redacted_event_ids) - .field("reason", &self.reason) - .finish() - } -} -impl RedactionApplied { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RedactionApplied"; -} -impl RedactionApplied { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::reason`] to `Some(value)`, consuming and returning `self`. - pub fn with_reason( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.reason = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(RedactionApplied); -impl ::buffa::MessageName for RedactionApplied { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RedactionApplied"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RedactionApplied"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RedactionApplied"; -} -impl ::buffa::Message for RedactionApplied { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - for v in &self.redacted_event_ids { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - for v in &self.redacted_event_ids { - ::buffa::types::put_string_field(2u32, v, buf); - } - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __elem = ::buffa::types::decode_string(buf)?; - ctx.register_element_memory( - ::buffa::__private::element_footprint(&__elem), - )?; - self.redacted_event_ids.push(__elem); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.reason.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.redacted_event_ids.clear(); - self.reason = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for RedactionApplied { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REDACTION_APPLIED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.RedactionApplied", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reject_provider_tool_intent.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reject_provider_tool_intent.__view.rs deleted file mode 100644 index c7ef5bf0c..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reject_provider_tool_intent.__view.rs +++ /dev/null @@ -1,526 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/reject_provider_tool_intent.proto - -/// RejectProviderToolIntent records a refused provider tool intent, producing -/// \[ProviderToolIntentRejected\]. -/// -/// Write precondition Any: the provider already emitted it, and no lifecycle -/// state can retract that. -/// -/// The raw emission is stored as an artifact before this command is issued, for -/// the same reason captured command output is: a decider that must write an -/// unbounded attacker-shaped payload before it can append has an append latency -/// set by the worst input it ever received. -#[derive(Clone, Debug, Default)] -pub struct RejectProviderToolIntentView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `rejection_id` - pub rejection_id: &'a str, - /// Field 3: `message_id` - pub message_id: &'a str, - /// Field 4: `turn_id` - pub turn_id: &'a str, - /// Field 5: `reason` - pub reason: ::buffa::EnumValue, - /// Field 6: `claimed_tool_call_id` - pub claimed_tool_call_id: ::core::option::Option<&'a str>, - /// Field 7: `claimed_tool_name` - pub claimed_tool_name: ::core::option::Option<&'a str>, - /// Field 8: `raw_intent` - pub raw_intent: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactRefView<'a>, - >, - /// Field 9: `detail` - pub detail: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RejectProviderToolIntentView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `rejection_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_rejection_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `message_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RejectProviderToolIntentView<'a> { - type Owned = super::super::RejectProviderToolIntent; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.rejection_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.message_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 16u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.claimed_tool_call_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.claimed_tool_name = Some(::buffa::types::borrow_str(&mut cur)?); - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.raw_intent.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.raw_intent = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::RejectProviderToolIntent, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::RejectProviderToolIntent, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RejectProviderToolIntent { - session_id: self.session_id.to_string(), - rejection_id: self.rejection_id.to_string(), - message_id: self.message_id.to_string(), - turn_id: self.turn_id.to_string(), - reason: self.reason, - claimed_tool_call_id: self.claimed_tool_call_id.map(|s| s.to_string()), - claimed_tool_name: self.claimed_tool_name.map(|s| s.to_string()), - raw_intent: match self.raw_intent.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - detail: self.detail.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RejectProviderToolIntentView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.rejection_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.claimed_tool_call_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.claimed_tool_name { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.raw_intent.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.raw_intent.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.rejection_id, buf); - ::buffa::types::put_string_field(3u32, &self.message_id, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - ::buffa::types::put_int32_field(5u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.claimed_tool_call_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - if let Some(ref v) = self.claimed_tool_name { - ::buffa::types::put_string_field(7u32, v, buf); - } - if self.raw_intent.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.raw_intent.write_to(__cache, buf); - } - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(9u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RejectProviderToolIntentView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("rejectionId", self.rejection_id)?; - } - { - __map.serialize_entry("messageId", self.message_id)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - if let ::core::option::Option::Some(__v) = self.claimed_tool_call_id { - __map.serialize_entry("claimedToolCallId", __v)?; - } - if let ::core::option::Option::Some(__v) = self.claimed_tool_name { - __map.serialize_entry("claimedToolName", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.raw_intent.as_option() { - __map.serialize_entry("rawIntent", __v)?; - } - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RejectProviderToolIntentView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RejectProviderToolIntent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RejectProviderToolIntent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RejectProviderToolIntent"; -} -::buffa::impl_default_view_instance!(RejectProviderToolIntentView); -::buffa::impl_view_reborrow!(RejectProviderToolIntentView); -/** Self-contained, `'static` owned view of a `RejectProviderToolIntent` message. - - Wraps [`::buffa::OwnedView`]`<`[`RejectProviderToolIntentView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RejectProviderToolIntentView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RejectProviderToolIntentOwnedView( - ::buffa::OwnedView>, -); -impl RejectProviderToolIntentOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RejectProviderToolIntentOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RejectProviderToolIntentOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RejectProviderToolIntent, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RejectProviderToolIntentOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RejectProviderToolIntentView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RejectProviderToolIntentView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RejectProviderToolIntent { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `rejection_id` - #[must_use] - pub fn rejection_id(&self) -> &'_ str { - self.0.reborrow().rejection_id - } - /// Field 3: `message_id` - #[must_use] - pub fn message_id(&self) -> &'_ str { - self.0.reborrow().message_id - } - /// Field 4: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } - /// Field 5: `reason` - #[must_use] - pub fn reason( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// Field 6: `claimed_tool_call_id` - #[must_use] - pub fn claimed_tool_call_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().claimed_tool_call_id - } - /// Field 7: `claimed_tool_name` - #[must_use] - pub fn claimed_tool_name(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().claimed_tool_name - } - /// Field 8: `raw_intent` - #[must_use] - pub fn raw_intent( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().raw_intent - } - /// Field 9: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RejectProviderToolIntentOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RejectProviderToolIntentOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RejectProviderToolIntentOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RejectProviderToolIntentOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RejectProviderToolIntent { - type View<'a> = RejectProviderToolIntentView<'a>; - type ViewHandle = RejectProviderToolIntentOwnedView; -} -impl ::serde::Serialize for RejectProviderToolIntentOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reject_provider_tool_intent.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reject_provider_tool_intent.rs deleted file mode 100644 index 29909a9eb..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reject_provider_tool_intent.rs +++ /dev/null @@ -1,335 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/reject_provider_tool_intent.proto - -/// RejectProviderToolIntent records a refused provider tool intent, producing -/// \[ProviderToolIntentRejected\]. -/// -/// Write precondition Any: the provider already emitted it, and no lifecycle -/// state can retract that. -/// -/// The raw emission is stored as an artifact before this command is issued, for -/// the same reason captured command output is: a decider that must write an -/// unbounded attacker-shaped payload before it can append has an append latency -/// set by the worst input it ever received. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RejectProviderToolIntent { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `rejection_id` - #[serde( - rename = "rejectionId", - alias = "rejection_id", - with = "::buffa::json_helpers::proto_string" - )] - pub rejection_id: ::buffa::alloc::string::String, - /// Field 3: `message_id` - #[serde( - rename = "messageId", - alias = "message_id", - with = "::buffa::json_helpers::proto_string" - )] - pub message_id: ::buffa::alloc::string::String, - /// Field 4: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, - /// Field 5: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// Field 6: `claimed_tool_call_id` - #[serde( - rename = "claimedToolCallId", - alias = "claimed_tool_call_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub claimed_tool_call_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 7: `claimed_tool_name` - #[serde( - rename = "claimedToolName", - alias = "claimed_tool_name", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub claimed_tool_name: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 8: `raw_intent` - #[serde( - rename = "rawIntent", - alias = "raw_intent", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub raw_intent: ::buffa::MessageField>, - /// Field 9: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for RejectProviderToolIntent { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RejectProviderToolIntent") - .field("session_id", &self.session_id) - .field("rejection_id", &self.rejection_id) - .field("message_id", &self.message_id) - .field("turn_id", &self.turn_id) - .field("reason", &self.reason) - .field("claimed_tool_call_id", &self.claimed_tool_call_id) - .field("claimed_tool_name", &self.claimed_tool_name) - .field("raw_intent", &self.raw_intent) - .field("detail", &self.detail) - .finish() - } -} -impl RejectProviderToolIntent { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RejectProviderToolIntent"; -} -impl RejectProviderToolIntent { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::claimed_tool_call_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_claimed_tool_call_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.claimed_tool_call_id = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::claimed_tool_name`] to `Some(value)`, consuming and returning `self`. - pub fn with_claimed_tool_name( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.claimed_tool_name = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(RejectProviderToolIntent); -impl ::buffa::MessageName for RejectProviderToolIntent { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RejectProviderToolIntent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RejectProviderToolIntent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RejectProviderToolIntent"; -} -impl ::buffa::Message for RejectProviderToolIntent { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.rejection_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.claimed_tool_call_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.claimed_tool_name { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.raw_intent.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.raw_intent.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.rejection_id, buf); - ::buffa::types::put_string_field(3u32, &self.message_id, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - ::buffa::types::put_int32_field(5u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.claimed_tool_call_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - if let Some(ref v) = self.claimed_tool_name { - ::buffa::types::put_string_field(7u32, v, buf); - } - if self.raw_intent.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.raw_intent.write_to(__cache, buf); - } - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(9u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.rejection_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.message_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .claimed_tool_call_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .claimed_tool_name - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.raw_intent.get_or_insert_default(), - buf, - ctx, - )?; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.rejection_id.clear(); - self.message_id.clear(); - self.turn_id.clear(); - self.reason = ::buffa::EnumValue::from(0); - self.claimed_tool_call_id = ::core::option::Option::None; - self.claimed_tool_name = ::core::option::Option::None; - self.raw_intent = ::buffa::MessageField::none(); - self.detail = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for RejectProviderToolIntent { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REJECT_PROVIDER_TOOL_INTENT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.RejectProviderToolIntent", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.rename_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.rename_session.__view.rs deleted file mode 100644 index 110ccf4db..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.rename_session.__view.rs +++ /dev/null @@ -1,283 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/rename_session.proto - -/// RenameSession changes the session's display name, recording -/// \[SessionRenamed\]. Reversible organization state, unlike the terminal -/// HideSession. -/// -/// Write precondition Any. -#[derive(Clone, Debug, Default)] -pub struct RenameSessionView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `display_name` - pub display_name: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RenameSessionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `display_name` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_display_name(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RenameSessionView<'a> { - type Owned = super::super::RenameSession; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.display_name = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RenameSession { - session_id: self.session_id.to_string(), - display_name: self.display_name.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RenameSessionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.display_name) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.display_name, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RenameSessionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("displayName", self.display_name)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RenameSessionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RenameSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RenameSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RenameSession"; -} -::buffa::impl_default_view_instance!(RenameSessionView); -::buffa::impl_view_reborrow!(RenameSessionView); -/** Self-contained, `'static` owned view of a `RenameSession` message. - - Wraps [`::buffa::OwnedView`]`<`[`RenameSessionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RenameSessionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RenameSessionOwnedView(::buffa::OwnedView>); -impl RenameSessionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RenameSessionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RenameSessionOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RenameSession, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RenameSessionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RenameSessionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RenameSessionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RenameSession { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `display_name` - #[must_use] - pub fn display_name(&self) -> &'_ str { - self.0.reborrow().display_name - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RenameSessionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RenameSessionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RenameSessionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RenameSessionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RenameSession { - type View<'a> = RenameSessionView<'a>; - type ViewHandle = RenameSessionOwnedView; -} -impl ::serde::Serialize for RenameSessionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.rename_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.rename_session.rs deleted file mode 100644 index 12c8736c5..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.rename_session.rs +++ /dev/null @@ -1,132 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/rename_session.proto - -/// RenameSession changes the session's display name, recording -/// \[SessionRenamed\]. Reversible organization state, unlike the terminal -/// HideSession. -/// -/// Write precondition Any. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RenameSession { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `display_name` - #[serde( - rename = "displayName", - alias = "display_name", - with = "::buffa::json_helpers::proto_string" - )] - pub display_name: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for RenameSession { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RenameSession") - .field("session_id", &self.session_id) - .field("display_name", &self.display_name) - .finish() - } -} -impl RenameSession { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RenameSession"; -} -::buffa::impl_default_instance!(RenameSession); -impl ::buffa::MessageName for RenameSession { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RenameSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RenameSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RenameSession"; -} -impl ::buffa::Message for RenameSession { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.display_name) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.display_name, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.display_name, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.display_name.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for RenameSession { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RENAME_SESSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.RenameSession", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.request_operation_cancellation.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.request_operation_cancellation.__view.rs deleted file mode 100644 index 02cfdab1d..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.request_operation_cancellation.__view.rs +++ /dev/null @@ -1,320 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/request_operation_cancellation.proto - -/// RequestOperationCancellation asks for an in-flight side effect to stop, -/// recording \[OperationCancellationRequested\]. Asking is not settling: the -/// operation still needs a recorded outcome before it leaves the ledger. -/// -/// Write precondition At: rejected if the operation is already terminal. -#[derive(Clone, Debug, Default)] -pub struct RequestOperationCancellationView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `operation_id` - pub operation_id: &'a str, - /// Field 3: `reason` - pub reason: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RequestOperationCancellationView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RequestOperationCancellationView<'a> { - type Owned = super::super::RequestOperationCancellation; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::RequestOperationCancellation, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::RequestOperationCancellation, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RequestOperationCancellation { - session_id: self.session_id.to_string(), - operation_id: self.operation_id.to_string(), - reason: self.reason.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RequestOperationCancellationView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RequestOperationCancellationView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("operationId", self.operation_id)?; - } - if let ::core::option::Option::Some(__v) = self.reason { - __map.serialize_entry("reason", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RequestOperationCancellationView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RequestOperationCancellation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RequestOperationCancellation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RequestOperationCancellation"; -} -::buffa::impl_default_view_instance!(RequestOperationCancellationView); -::buffa::impl_view_reborrow!(RequestOperationCancellationView); -/** Self-contained, `'static` owned view of a `RequestOperationCancellation` message. - - Wraps [`::buffa::OwnedView`]`<`[`RequestOperationCancellationView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RequestOperationCancellationView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RequestOperationCancellationOwnedView( - ::buffa::OwnedView>, -); -impl RequestOperationCancellationOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RequestOperationCancellationOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RequestOperationCancellationOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RequestOperationCancellation, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RequestOperationCancellationOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RequestOperationCancellationView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RequestOperationCancellationView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RequestOperationCancellation { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Field 3: `reason` - #[must_use] - pub fn reason(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RequestOperationCancellationOwnedView { - fn from( - inner: ::buffa::OwnedView>, - ) -> Self { - RequestOperationCancellationOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RequestOperationCancellationOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef< - ::buffa::OwnedView>, -> for RequestOperationCancellationOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RequestOperationCancellation { - type View<'a> = RequestOperationCancellationView<'a>; - type ViewHandle = RequestOperationCancellationOwnedView; -} -impl ::serde::Serialize for RequestOperationCancellationOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.request_operation_cancellation.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.request_operation_cancellation.rs deleted file mode 100644 index 3dcfa6efb..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.request_operation_cancellation.rs +++ /dev/null @@ -1,165 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/request_operation_cancellation.proto - -/// RequestOperationCancellation asks for an in-flight side effect to stop, -/// recording \[OperationCancellationRequested\]. Asking is not settling: the -/// operation still needs a recorded outcome before it leaves the ledger. -/// -/// Write precondition At: rejected if the operation is already terminal. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RequestOperationCancellation { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// Field 3: `reason` - #[serde(rename = "reason", skip_serializing_if = "::core::option::Option::is_none")] - pub reason: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for RequestOperationCancellation { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RequestOperationCancellation") - .field("session_id", &self.session_id) - .field("operation_id", &self.operation_id) - .field("reason", &self.reason) - .finish() - } -} -impl RequestOperationCancellation { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RequestOperationCancellation"; -} -impl RequestOperationCancellation { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::reason`] to `Some(value)`, consuming and returning `self`. - pub fn with_reason( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.reason = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(RequestOperationCancellation); -impl ::buffa::MessageName for RequestOperationCancellation { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RequestOperationCancellation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RequestOperationCancellation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RequestOperationCancellation"; -} -impl ::buffa::Message for RequestOperationCancellation { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.reason.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.operation_id.clear(); - self.reason = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for RequestOperationCancellation { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REQUEST_OPERATION_CANCELLATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.RequestOperationCancellation", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.request_tool_call.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.request_tool_call.__view.rs deleted file mode 100644 index 2228e3853..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.request_tool_call.__view.rs +++ /dev/null @@ -1,464 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/request_tool_call.proto - -/// RequestToolCall records that the model asked for a tool, recording -/// \[ToolCallRequested\]. -/// -/// Write precondition Any: this is the aggregate's highest-volume path and it -/// commutes with everything else, so it never coordinates and never retries. -#[derive(Clone, Debug, Default)] -pub struct RequestToolCallView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Identity of the request. Approval, denial, and start all join on it. - /// - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Retry identity of this execution of the call. The terminal outcome joins - /// on it, so a re-execution settles the attempt it belongs to. - /// - /// Field 3: `tool_execution_id` - pub tool_execution_id: &'a str, - /// Field 4: `tool_name` - pub tool_name: &'a str, - /// Field 5: `input_json` - pub input_json: &'a str, - /// Field 6: `parent_tool_use_id` - pub parent_tool_use_id: ::core::option::Option<&'a str>, - /// The ledger operation guarding this call's side effect, when it reserves one. - /// - /// Field 7: `operation_id` - pub operation_id: ::core::option::Option<&'a str>, - /// Field 8: `turn_id` - pub turn_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RequestToolCallView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_execution_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_execution_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `tool_name` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_name(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `input_json` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_input_json(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 32u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RequestToolCallView<'a> { - type Owned = super::super::RequestToolCall; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_execution_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_name = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.input_json = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.parent_tool_use_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 32u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RequestToolCall { - session_id: self.session_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - tool_execution_id: self.tool_execution_id.to_string(), - tool_name: self.tool_name.to_string(), - input_json: self.input_json.to_string(), - parent_tool_use_id: self.parent_tool_use_id.map(|s| s.to_string()), - operation_id: self.operation_id.map(|s| s.to_string()), - turn_id: self.turn_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RequestToolCallView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_name) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.input_json) as u64; - if let Some(ref v) = self.parent_tool_use_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.operation_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.tool_name, buf); - ::buffa::types::put_string_field(5u32, &self.input_json, buf); - if let Some(ref v) = self.parent_tool_use_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - if let Some(ref v) = self.operation_id { - ::buffa::types::put_string_field(7u32, v, buf); - } - ::buffa::types::put_string_field(8u32, &self.turn_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RequestToolCallView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolExecutionId", self.tool_execution_id)?; - } - { - __map.serialize_entry("toolName", self.tool_name)?; - } - { - __map.serialize_entry("inputJson", self.input_json)?; - } - if let ::core::option::Option::Some(__v) = self.parent_tool_use_id { - __map.serialize_entry("parentToolUseId", __v)?; - } - if let ::core::option::Option::Some(__v) = self.operation_id { - __map.serialize_entry("operationId", __v)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RequestToolCallView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RequestToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RequestToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RequestToolCall"; -} -::buffa::impl_default_view_instance!(RequestToolCallView); -::buffa::impl_view_reborrow!(RequestToolCallView); -/** Self-contained, `'static` owned view of a `RequestToolCall` message. - - Wraps [`::buffa::OwnedView`]`<`[`RequestToolCallView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RequestToolCallView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RequestToolCallOwnedView(::buffa::OwnedView>); -impl RequestToolCallOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RequestToolCallOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RequestToolCallOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RequestToolCall, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RequestToolCallOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RequestToolCallView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RequestToolCallView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RequestToolCall { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Identity of the request. Approval, denial, and start all join on it. - /// - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Retry identity of this execution of the call. The terminal outcome joins - /// on it, so a re-execution settles the attempt it belongs to. - /// - /// Field 3: `tool_execution_id` - #[must_use] - pub fn tool_execution_id(&self) -> &'_ str { - self.0.reborrow().tool_execution_id - } - /// Field 4: `tool_name` - #[must_use] - pub fn tool_name(&self) -> &'_ str { - self.0.reborrow().tool_name - } - /// Field 5: `input_json` - #[must_use] - pub fn input_json(&self) -> &'_ str { - self.0.reborrow().input_json - } - /// Field 6: `parent_tool_use_id` - #[must_use] - pub fn parent_tool_use_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().parent_tool_use_id - } - /// The ledger operation guarding this call's side effect, when it reserves one. - /// - /// Field 7: `operation_id` - #[must_use] - pub fn operation_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().operation_id - } - /// Field 8: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RequestToolCallOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RequestToolCallOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RequestToolCallOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RequestToolCallOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RequestToolCall { - type View<'a> = RequestToolCallView<'a>; - type ViewHandle = RequestToolCallOwnedView; -} -impl ::serde::Serialize for RequestToolCallOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.request_tool_call.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.request_tool_call.rs deleted file mode 100644 index a3b23f31c..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.request_tool_call.rs +++ /dev/null @@ -1,288 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/request_tool_call.proto - -/// RequestToolCall records that the model asked for a tool, recording -/// \[ToolCallRequested\]. -/// -/// Write precondition Any: this is the aggregate's highest-volume path and it -/// commutes with everything else, so it never coordinates and never retries. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RequestToolCall { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Identity of the request. Approval, denial, and start all join on it. - /// - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Retry identity of this execution of the call. The terminal outcome joins - /// on it, so a re-execution settles the attempt it belongs to. - /// - /// Field 3: `tool_execution_id` - #[serde( - rename = "toolExecutionId", - alias = "tool_execution_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_execution_id: ::buffa::alloc::string::String, - /// Field 4: `tool_name` - #[serde( - rename = "toolName", - alias = "tool_name", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_name: ::buffa::alloc::string::String, - /// Field 5: `input_json` - #[serde( - rename = "inputJson", - alias = "input_json", - with = "::buffa::json_helpers::proto_string" - )] - pub input_json: ::buffa::alloc::string::String, - /// Field 6: `parent_tool_use_id` - #[serde( - rename = "parentToolUseId", - alias = "parent_tool_use_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub parent_tool_use_id: ::core::option::Option<::buffa::alloc::string::String>, - /// The ledger operation guarding this call's side effect, when it reserves one. - /// - /// Field 7: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub operation_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 8: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for RequestToolCall { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RequestToolCall") - .field("session_id", &self.session_id) - .field("tool_call_id", &self.tool_call_id) - .field("tool_execution_id", &self.tool_execution_id) - .field("tool_name", &self.tool_name) - .field("input_json", &self.input_json) - .field("parent_tool_use_id", &self.parent_tool_use_id) - .field("operation_id", &self.operation_id) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl RequestToolCall { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RequestToolCall"; -} -impl RequestToolCall { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::parent_tool_use_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_parent_tool_use_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.parent_tool_use_id = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::operation_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_operation_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.operation_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(RequestToolCall); -impl ::buffa::MessageName for RequestToolCall { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RequestToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RequestToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RequestToolCall"; -} -impl ::buffa::Message for RequestToolCall { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_name) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.input_json) as u64; - if let Some(ref v) = self.parent_tool_use_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.operation_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.tool_name, buf); - ::buffa::types::put_string_field(5u32, &self.input_json, buf); - if let Some(ref v) = self.parent_tool_use_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - if let Some(ref v) = self.operation_id { - ::buffa::types::put_string_field(7u32, v, buf); - } - ::buffa::types::put_string_field(8u32, &self.turn_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_execution_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_name, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.input_json, buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .parent_tool_use_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .operation_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.tool_call_id.clear(); - self.tool_execution_id.clear(); - self.tool_name.clear(); - self.input_json.clear(); - self.parent_tool_use_id = ::core::option::Option::None; - self.operation_id = ::core::option::Option::None; - self.turn_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for RequestToolCall { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REQUEST_TOOL_CALL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.RequestToolCall", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reserve_operation.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reserve_operation.__view.rs deleted file mode 100644 index 2138a057e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reserve_operation.__view.rs +++ /dev/null @@ -1,396 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/reserve_operation.proto - -/// ReserveOperation claims an operation id and its request bytes before a side -/// effect runs, recording \[OperationReserved\]. -/// -/// Write precondition At: this is what makes reserve-and-check atomic. One -/// reservation per operation_id; a retry carrying different bytes under the same -/// id is a contract violation, not a duplicate (ADR#0035 facet 3). -#[derive(Clone, Debug, Default)] -pub struct ReserveOperationView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `operation_id` - pub operation_id: &'a str, - /// Digest of the request the id is reserved for, so a retry with different - /// bytes is refused instead of executed as if it were the same call. - /// - /// Field 3: `request_digest` - pub request_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Field 4: `operation_kind` - pub operation_kind: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReserveOperationView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `operation_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `request_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_request_digest(&self) -> bool { - self.request_digest.is_set() - } - /**Whether required field `operation_kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_operation_kind(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ReserveOperationView<'a> { - type Owned = super::super::ReserveOperation; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.request_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.request_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.operation_kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReserveOperation { - session_id: self.session_id.to_string(), - operation_id: self.operation_id.to_string(), - request_digest: match self.request_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - operation_kind: self.operation_kind, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReserveOperationView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if self.request_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.request_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.operation_kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - if self.request_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.request_digest.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(4u32, self.operation_kind.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReserveOperationView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("operationId", self.operation_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.request_digest.as_option() { - __map.serialize_entry("requestDigest", __v)?; - } - } - { - __map.serialize_entry("operationKind", &self.operation_kind)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReserveOperationView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ReserveOperation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ReserveOperation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReserveOperation"; -} -::buffa::impl_default_view_instance!(ReserveOperationView); -::buffa::impl_view_reborrow!(ReserveOperationView); -/** Self-contained, `'static` owned view of a `ReserveOperation` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReserveOperationView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReserveOperationView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReserveOperationOwnedView(::buffa::OwnedView>); -impl ReserveOperationOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReserveOperationOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReserveOperationOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReserveOperation, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReserveOperationOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReserveOperationView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReserveOperationView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReserveOperation { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `operation_id` - #[must_use] - pub fn operation_id(&self) -> &'_ str { - self.0.reborrow().operation_id - } - /// Digest of the request the id is reserved for, so a retry with different - /// bytes is refused instead of executed as if it were the same call. - /// - /// Field 3: `request_digest` - #[must_use] - pub fn request_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().request_digest - } - /// Field 4: `operation_kind` - #[must_use] - pub fn operation_kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().operation_kind - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReserveOperationOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReserveOperationOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReserveOperationOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReserveOperationOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReserveOperation { - type View<'a> = ReserveOperationView<'a>; - type ViewHandle = ReserveOperationOwnedView; -} -impl ::serde::Serialize for ReserveOperationOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reserve_operation.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reserve_operation.rs deleted file mode 100644 index fd858d288..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.reserve_operation.rs +++ /dev/null @@ -1,191 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/reserve_operation.proto - -/// ReserveOperation claims an operation id and its request bytes before a side -/// effect runs, recording \[OperationReserved\]. -/// -/// Write precondition At: this is what makes reserve-and-check atomic. One -/// reservation per operation_id; a retry carrying different bytes under the same -/// id is a contract violation, not a duplicate (ADR#0035 facet 3). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReserveOperation { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - with = "::buffa::json_helpers::proto_string" - )] - pub operation_id: ::buffa::alloc::string::String, - /// Digest of the request the id is reserved for, so a retry with different - /// bytes is refused instead of executed as if it were the same call. - /// - /// Field 3: `request_digest` - #[serde(rename = "requestDigest", alias = "request_digest")] - pub request_digest: ::buffa::MessageField>, - /// Field 4: `operation_kind` - #[serde( - rename = "operationKind", - alias = "operation_kind", - with = "::buffa::json_helpers::proto_enum" - )] - pub operation_kind: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for ReserveOperation { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReserveOperation") - .field("session_id", &self.session_id) - .field("operation_id", &self.operation_id) - .field("request_digest", &self.request_digest) - .field("operation_kind", &self.operation_kind) - .finish() - } -} -impl ReserveOperation { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReserveOperation"; -} -::buffa::impl_default_instance!(ReserveOperation); -impl ::buffa::MessageName for ReserveOperation { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ReserveOperation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ReserveOperation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReserveOperation"; -} -impl ::buffa::Message for ReserveOperation { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.operation_id) as u64; - if self.request_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.request_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.operation_kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.operation_id, buf); - if self.request_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.request_digest.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(4u32, self.operation_kind.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.operation_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.request_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.operation_kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.operation_id.clear(); - self.request_digest = ::buffa::MessageField::none(); - self.operation_kind = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReserveOperation { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RESERVE_OPERATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ReserveOperation", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_access.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_access.__view.rs deleted file mode 100644 index ab904fcdd..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_access.__view.rs +++ /dev/null @@ -1,526 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/resource_access.proto - -/// ResourceAccessRecord records what a tool call did to a namespace of -/// resources, as distinct from what content it read. -/// -/// It exists because ResourceObservation deliberately answers only one question. -/// An observation means content entered the model's context, and its digest is -/// what makes a later write checkable. A search that walks a directory of -/// sensitive filenames and returns none of their contents produces no -/// observation, correctly, and yet something happened that a compliance reviewer -/// has to be able to see: the agent learned that those files exist and what they -/// are called. -/// -/// The two must stay separate rather than merging into one weakened observation. -/// "Did the agent read this file" and "did the agent see this file's name" are -/// different questions with different answers and different consequences, and a -/// single record that means either makes both unanswerable. -/// -/// Records are per-scope, never per-path. That is the same volume argument that -/// keeps reads off their own event: a search can walk forty thousand paths, and -/// forty thousand facts appended to a log that is never truncated -/// (ADR#0035 facet 7) would make the dominant content of a session stream the -/// output of one grep. The scope plus the counts is what a reviewer needs to know -/// what was exposed; the path list itself, when it is worth keeping, goes out of -/// line as an artifact and is erasable like any other artifact while the counts -/// survive it. -#[derive(Clone, Debug, Default)] -pub struct ResourceAccessRecordView<'a> { - /// Field 1: `action` - pub action: ::buffa::EnumValue, - /// The namespace this access covered, as a URI prefix or a glob in the same URI - /// form as WorkspaceRef.uri. This is the extent of exposure, not a single - /// resource: a directory listing's scope is the directory, and a recursive - /// search's scope is its root. - /// - /// Field 2: `scope` - pub scope: &'a str, - /// Resources within scope the tool actually enumerated back to the caller. For - /// a search this is the hit count, which is the number that matters, since - /// knowing that four files in a secrets directory matched "password" is a - /// different disclosure from knowing the directory has four hundred files. - /// - /// Field 3: `matched` - pub matched: u64, - /// Resources within scope the tool traversed to produce that answer. Recorded - /// apart from `matched` because traversal is itself access to a namespace: a - /// filter that rejected a path still required reading the path's name. - /// - /// Field 4: `traversed` - pub traversed: u64, - /// True when the tool covered its scope entirely. False when it stopped at a - /// result limit, a depth limit, or a timeout, so a reviewer never reads a - /// truncated enumeration as a complete inventory of what was exposed. - /// - /// Field 5: `complete` - pub complete: bool, - /// Claim-check to the enumerated resource identifiers, when they were kept. - /// - /// Unset is ordinary and does not weaken the record: the counts and the scope - /// stand on their own. It is a claim-check rather than a repeated string for - /// the volume reason above, and being an artifact is also what makes the list - /// erasable under a deletion request while leaving the audit fact that an - /// enumeration happened permanently intact. - /// - /// Field 6: `enumerated` - pub enumerated: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactRefView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ResourceAccessRecordView<'a> { - /**Whether required field `action` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_action(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `scope` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_scope(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `matched` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_matched(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `traversed` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_traversed(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `complete` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_complete(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ResourceAccessRecordView<'a> { - type Owned = super::super::ResourceAccessRecord; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.action = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.scope = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.matched = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.traversed = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.complete = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.enumerated.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.enumerated = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ResourceAccessRecord, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ResourceAccessRecord, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ResourceAccessRecord { - action: self.action, - scope: self.scope.to_string(), - matched: self.matched, - traversed: self.traversed, - complete: self.complete, - enumerated: match self.enumerated.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ResourceAccessRecordView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.action.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.scope) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.matched) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.traversed) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - if self.enumerated.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.enumerated.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.action.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.scope, buf); - ::buffa::types::put_uint64_field(3u32, self.matched, buf); - ::buffa::types::put_uint64_field(4u32, self.traversed, buf); - ::buffa::types::put_bool_field(5u32, self.complete, buf); - if self.enumerated.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.enumerated.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ResourceAccessRecordView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("action", &self.action)?; - } - { - __map.serialize_entry("scope", self.scope)?; - } - { - __map - .serialize_entry( - "matched", - &::buffa::json_helpers::ProtoJson(&self.matched), - )?; - } - { - __map - .serialize_entry( - "traversed", - &::buffa::json_helpers::ProtoJson(&self.traversed), - )?; - } - { - __map.serialize_entry("complete", &self.complete)?; - } - { - if let ::core::option::Option::Some(__v) = self.enumerated.as_option() { - __map.serialize_entry("enumerated", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ResourceAccessRecordView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ResourceAccessRecord"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ResourceAccessRecord"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ResourceAccessRecord"; -} -::buffa::impl_default_view_instance!(ResourceAccessRecordView); -::buffa::impl_view_reborrow!(ResourceAccessRecordView); -/** Self-contained, `'static` owned view of a `ResourceAccessRecord` message. - - Wraps [`::buffa::OwnedView`]`<`[`ResourceAccessRecordView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ResourceAccessRecordView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ResourceAccessRecordOwnedView( - ::buffa::OwnedView>, -); -impl ResourceAccessRecordOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ResourceAccessRecordOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ResourceAccessRecordOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ResourceAccessRecord, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ResourceAccessRecordOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ResourceAccessRecordView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ResourceAccessRecordView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ResourceAccessRecord { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `action` - #[must_use] - pub fn action(&self) -> ::buffa::EnumValue { - self.0.reborrow().action - } - /// The namespace this access covered, as a URI prefix or a glob in the same URI - /// form as WorkspaceRef.uri. This is the extent of exposure, not a single - /// resource: a directory listing's scope is the directory, and a recursive - /// search's scope is its root. - /// - /// Field 2: `scope` - #[must_use] - pub fn scope(&self) -> &'_ str { - self.0.reborrow().scope - } - /// Resources within scope the tool actually enumerated back to the caller. For - /// a search this is the hit count, which is the number that matters, since - /// knowing that four files in a secrets directory matched "password" is a - /// different disclosure from knowing the directory has four hundred files. - /// - /// Field 3: `matched` - #[must_use] - pub fn matched(&self) -> u64 { - self.0.reborrow().matched - } - /// Resources within scope the tool traversed to produce that answer. Recorded - /// apart from `matched` because traversal is itself access to a namespace: a - /// filter that rejected a path still required reading the path's name. - /// - /// Field 4: `traversed` - #[must_use] - pub fn traversed(&self) -> u64 { - self.0.reborrow().traversed - } - /// True when the tool covered its scope entirely. False when it stopped at a - /// result limit, a depth limit, or a timeout, so a reviewer never reads a - /// truncated enumeration as a complete inventory of what was exposed. - /// - /// Field 5: `complete` - #[must_use] - pub fn complete(&self) -> bool { - self.0.reborrow().complete - } - /// Claim-check to the enumerated resource identifiers, when they were kept. - /// - /// Unset is ordinary and does not weaken the record: the counts and the scope - /// stand on their own. It is a claim-check rather than a repeated string for - /// the volume reason above, and being an artifact is also what makes the list - /// erasable under a deletion request while leaving the audit fact that an - /// enumeration happened permanently intact. - /// - /// Field 6: `enumerated` - #[must_use] - pub fn enumerated( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().enumerated - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ResourceAccessRecordOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ResourceAccessRecordOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ResourceAccessRecordOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ResourceAccessRecordOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ResourceAccessRecord { - type View<'a> = ResourceAccessRecordView<'a>; - type ViewHandle = ResourceAccessRecordOwnedView; -} -impl ::serde::Serialize for ResourceAccessRecordOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_access.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_access.rs deleted file mode 100644 index b4e6410b0..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_access.rs +++ /dev/null @@ -1,503 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/resource_access.proto - -/// ResourceAction is what was done to a namespace, in the terms an access policy -/// is written in. -/// -/// The distinction the taxonomy exists for is between the actions that expose -/// names and the actions that expose or alter content. LIST and SEARCH disclose -/// a namespace. READ discloses content. The mutating actions change it. A policy -/// that cannot separate those cannot express "this agent may find files here but -/// may not open them", which is a rule real deployments have. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ResourceAction { - RESOURCE_ACTION_UNSPECIFIED = 0i32, - /// Enumerated the names within a scope, without reading contents. - RESOURCE_ACTION_LIST = 1i32, - /// Matched contents within a scope and returned locations or excerpts. Content - /// that actually entered the model's context is separately a - /// ResourceObservation; a search that returned only paths is not. - RESOURCE_ACTION_SEARCH = 2i32, - /// Read content. Paired with a ResourceObservation carrying the digest. - RESOURCE_ACTION_READ = 3i32, - /// Created or overwrote content. - RESOURCE_ACTION_WRITE = 4i32, - /// Modified existing content in place. - RESOURCE_ACTION_EDIT = 5i32, - /// Removed resources. - RESOURCE_ACTION_DELETE = 6i32, - /// Moved or renamed resources. - RESOURCE_ACTION_RENAME = 7i32, - /// Duplicated resources to a new location. - RESOURCE_ACTION_COPY = 8i32, - /// Changed permissions, ownership, or other metadata without changing content. - RESOURCE_ACTION_CHANGE_METADATA = 9i32, - /// Executed a resource as a program. - RESOURCE_ACTION_EXECUTE = 10i32, -} -impl ResourceAction { - ///Idiomatic alias for [`Self::RESOURCE_ACTION_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::RESOURCE_ACTION_UNSPECIFIED; - ///Idiomatic alias for [`Self::RESOURCE_ACTION_LIST`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const List: Self = Self::RESOURCE_ACTION_LIST; - ///Idiomatic alias for [`Self::RESOURCE_ACTION_SEARCH`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Search: Self = Self::RESOURCE_ACTION_SEARCH; - ///Idiomatic alias for [`Self::RESOURCE_ACTION_READ`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Read: Self = Self::RESOURCE_ACTION_READ; - ///Idiomatic alias for [`Self::RESOURCE_ACTION_WRITE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Write: Self = Self::RESOURCE_ACTION_WRITE; - ///Idiomatic alias for [`Self::RESOURCE_ACTION_EDIT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Edit: Self = Self::RESOURCE_ACTION_EDIT; - ///Idiomatic alias for [`Self::RESOURCE_ACTION_DELETE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Delete: Self = Self::RESOURCE_ACTION_DELETE; - ///Idiomatic alias for [`Self::RESOURCE_ACTION_RENAME`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Rename: Self = Self::RESOURCE_ACTION_RENAME; - ///Idiomatic alias for [`Self::RESOURCE_ACTION_COPY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Copy: Self = Self::RESOURCE_ACTION_COPY; - ///Idiomatic alias for [`Self::RESOURCE_ACTION_CHANGE_METADATA`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ChangeMetadata: Self = Self::RESOURCE_ACTION_CHANGE_METADATA; - ///Idiomatic alias for [`Self::RESOURCE_ACTION_EXECUTE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Execute: Self = Self::RESOURCE_ACTION_EXECUTE; -} -impl ::core::default::Default for ResourceAction { - fn default() -> Self { - Self::RESOURCE_ACTION_UNSPECIFIED - } -} -impl ::serde::Serialize for ResourceAction { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ResourceAction { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ResourceAction; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(ResourceAction) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ResourceAction { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ResourceAction { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::RESOURCE_ACTION_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::RESOURCE_ACTION_LIST), - 2i32 => ::core::option::Option::Some(Self::RESOURCE_ACTION_SEARCH), - 3i32 => ::core::option::Option::Some(Self::RESOURCE_ACTION_READ), - 4i32 => ::core::option::Option::Some(Self::RESOURCE_ACTION_WRITE), - 5i32 => ::core::option::Option::Some(Self::RESOURCE_ACTION_EDIT), - 6i32 => ::core::option::Option::Some(Self::RESOURCE_ACTION_DELETE), - 7i32 => ::core::option::Option::Some(Self::RESOURCE_ACTION_RENAME), - 8i32 => ::core::option::Option::Some(Self::RESOURCE_ACTION_COPY), - 9i32 => ::core::option::Option::Some(Self::RESOURCE_ACTION_CHANGE_METADATA), - 10i32 => ::core::option::Option::Some(Self::RESOURCE_ACTION_EXECUTE), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::RESOURCE_ACTION_UNSPECIFIED => "RESOURCE_ACTION_UNSPECIFIED", - Self::RESOURCE_ACTION_LIST => "RESOURCE_ACTION_LIST", - Self::RESOURCE_ACTION_SEARCH => "RESOURCE_ACTION_SEARCH", - Self::RESOURCE_ACTION_READ => "RESOURCE_ACTION_READ", - Self::RESOURCE_ACTION_WRITE => "RESOURCE_ACTION_WRITE", - Self::RESOURCE_ACTION_EDIT => "RESOURCE_ACTION_EDIT", - Self::RESOURCE_ACTION_DELETE => "RESOURCE_ACTION_DELETE", - Self::RESOURCE_ACTION_RENAME => "RESOURCE_ACTION_RENAME", - Self::RESOURCE_ACTION_COPY => "RESOURCE_ACTION_COPY", - Self::RESOURCE_ACTION_CHANGE_METADATA => "RESOURCE_ACTION_CHANGE_METADATA", - Self::RESOURCE_ACTION_EXECUTE => "RESOURCE_ACTION_EXECUTE", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "RESOURCE_ACTION_UNSPECIFIED" => { - ::core::option::Option::Some(Self::RESOURCE_ACTION_UNSPECIFIED) - } - "RESOURCE_ACTION_LIST" => { - ::core::option::Option::Some(Self::RESOURCE_ACTION_LIST) - } - "RESOURCE_ACTION_SEARCH" => { - ::core::option::Option::Some(Self::RESOURCE_ACTION_SEARCH) - } - "RESOURCE_ACTION_READ" => { - ::core::option::Option::Some(Self::RESOURCE_ACTION_READ) - } - "RESOURCE_ACTION_WRITE" => { - ::core::option::Option::Some(Self::RESOURCE_ACTION_WRITE) - } - "RESOURCE_ACTION_EDIT" => { - ::core::option::Option::Some(Self::RESOURCE_ACTION_EDIT) - } - "RESOURCE_ACTION_DELETE" => { - ::core::option::Option::Some(Self::RESOURCE_ACTION_DELETE) - } - "RESOURCE_ACTION_RENAME" => { - ::core::option::Option::Some(Self::RESOURCE_ACTION_RENAME) - } - "RESOURCE_ACTION_COPY" => { - ::core::option::Option::Some(Self::RESOURCE_ACTION_COPY) - } - "RESOURCE_ACTION_CHANGE_METADATA" => { - ::core::option::Option::Some(Self::RESOURCE_ACTION_CHANGE_METADATA) - } - "RESOURCE_ACTION_EXECUTE" => { - ::core::option::Option::Some(Self::RESOURCE_ACTION_EXECUTE) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::RESOURCE_ACTION_UNSPECIFIED, - Self::RESOURCE_ACTION_LIST, - Self::RESOURCE_ACTION_SEARCH, - Self::RESOURCE_ACTION_READ, - Self::RESOURCE_ACTION_WRITE, - Self::RESOURCE_ACTION_EDIT, - Self::RESOURCE_ACTION_DELETE, - Self::RESOURCE_ACTION_RENAME, - Self::RESOURCE_ACTION_COPY, - Self::RESOURCE_ACTION_CHANGE_METADATA, - Self::RESOURCE_ACTION_EXECUTE, - ] - } -} -/// ResourceAccessRecord records what a tool call did to a namespace of -/// resources, as distinct from what content it read. -/// -/// It exists because ResourceObservation deliberately answers only one question. -/// An observation means content entered the model's context, and its digest is -/// what makes a later write checkable. A search that walks a directory of -/// sensitive filenames and returns none of their contents produces no -/// observation, correctly, and yet something happened that a compliance reviewer -/// has to be able to see: the agent learned that those files exist and what they -/// are called. -/// -/// The two must stay separate rather than merging into one weakened observation. -/// "Did the agent read this file" and "did the agent see this file's name" are -/// different questions with different answers and different consequences, and a -/// single record that means either makes both unanswerable. -/// -/// Records are per-scope, never per-path. That is the same volume argument that -/// keeps reads off their own event: a search can walk forty thousand paths, and -/// forty thousand facts appended to a log that is never truncated -/// (ADR#0035 facet 7) would make the dominant content of a session stream the -/// output of one grep. The scope plus the counts is what a reviewer needs to know -/// what was exposed; the path list itself, when it is worth keeping, goes out of -/// line as an artifact and is erasable like any other artifact while the counts -/// survive it. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ResourceAccessRecord { - /// Field 1: `action` - #[serde(rename = "action", with = "::buffa::json_helpers::proto_enum")] - pub action: ::buffa::EnumValue, - /// The namespace this access covered, as a URI prefix or a glob in the same URI - /// form as WorkspaceRef.uri. This is the extent of exposure, not a single - /// resource: a directory listing's scope is the directory, and a recursive - /// search's scope is its root. - /// - /// Field 2: `scope` - #[serde(rename = "scope", with = "::buffa::json_helpers::proto_string")] - pub scope: ::buffa::alloc::string::String, - /// Resources within scope the tool actually enumerated back to the caller. For - /// a search this is the hit count, which is the number that matters, since - /// knowing that four files in a secrets directory matched "password" is a - /// different disclosure from knowing the directory has four hundred files. - /// - /// Field 3: `matched` - #[serde(rename = "matched", with = "::buffa::json_helpers::uint64")] - pub matched: u64, - /// Resources within scope the tool traversed to produce that answer. Recorded - /// apart from `matched` because traversal is itself access to a namespace: a - /// filter that rejected a path still required reading the path's name. - /// - /// Field 4: `traversed` - #[serde(rename = "traversed", with = "::buffa::json_helpers::uint64")] - pub traversed: u64, - /// True when the tool covered its scope entirely. False when it stopped at a - /// result limit, a depth limit, or a timeout, so a reviewer never reads a - /// truncated enumeration as a complete inventory of what was exposed. - /// - /// Field 5: `complete` - #[serde(rename = "complete", with = "::buffa::json_helpers::proto_bool")] - pub complete: bool, - /// Claim-check to the enumerated resource identifiers, when they were kept. - /// - /// Unset is ordinary and does not weaken the record: the counts and the scope - /// stand on their own. It is a claim-check rather than a repeated string for - /// the volume reason above, and being an artifact is also what makes the list - /// erasable under a deletion request while leaving the audit fact that an - /// enumeration happened permanently intact. - /// - /// Field 6: `enumerated` - #[serde( - rename = "enumerated", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub enumerated: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for ResourceAccessRecord { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ResourceAccessRecord") - .field("action", &self.action) - .field("scope", &self.scope) - .field("matched", &self.matched) - .field("traversed", &self.traversed) - .field("complete", &self.complete) - .field("enumerated", &self.enumerated) - .finish() - } -} -impl ResourceAccessRecord { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ResourceAccessRecord"; -} -::buffa::impl_default_instance!(ResourceAccessRecord); -impl ::buffa::MessageName for ResourceAccessRecord { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ResourceAccessRecord"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ResourceAccessRecord"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ResourceAccessRecord"; -} -impl ::buffa::Message for ResourceAccessRecord { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.action.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.scope) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.matched) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.traversed) as u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - if self.enumerated.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.enumerated.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.action.to_i32(), buf); - ::buffa::types::put_string_field(2u32, &self.scope, buf); - ::buffa::types::put_uint64_field(3u32, self.matched, buf); - ::buffa::types::put_uint64_field(4u32, self.traversed, buf); - ::buffa::types::put_bool_field(5u32, self.complete, buf); - if self.enumerated.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.enumerated.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.action = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.scope, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.matched = ::buffa::types::decode_uint64(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.traversed = ::buffa::types::decode_uint64(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.complete = ::buffa::types::decode_bool(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.enumerated.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.action = ::buffa::EnumValue::from(0); - self.scope.clear(); - self.matched = 0u64; - self.traversed = 0u64; - self.complete = false; - self.enumerated = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ResourceAccessRecord { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RESOURCE_ACCESS_RECORD_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ResourceAccessRecord", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_observation.__oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_observation.__oneof.rs deleted file mode 100644 index 3a366e5d1..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_observation.__oneof.rs +++ /dev/null @@ -1,54 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/resource_observation.proto - -pub mod resource_observation { - #[allow(unused_imports)] - use super::*; - /// What the read found. Exactly one arm is always recorded, so a producer that - /// failed to compute a digest can never be mistaken for one that observed - /// genuine absence. - #[derive(Clone, PartialEq, Debug)] - pub enum Outcome { - ContentDigest(::buffa::alloc::boxed::Box), - Absent(::buffa::alloc::boxed::Box), - } - impl ::buffa::Oneof for Outcome {} - impl From for Outcome { - fn from(v: super::super::super::Digest) -> Self { - Self::ContentDigest(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::Digest) -> Self { - Self::Some(Outcome::from(v)) - } - } - impl From for Outcome { - fn from(v: super::super::super::ResourceAbsent) -> Self { - Self::Absent(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ResourceAbsent) -> Self { - Self::Some(Outcome::from(v)) - } - } - impl serde::Serialize for Outcome { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::ContentDigest(v) => { - map.serialize_entry("contentDigest", v)?; - } - Self::Absent(v) => { - map.serialize_entry("absent", v)?; - } - } - map.end() - } - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_observation.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_observation.__view.rs deleted file mode 100644 index 36c263523..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_observation.__view.rs +++ /dev/null @@ -1,1074 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/resource_observation.proto - -/// ResourceObservation records that a tool call put the content of a resource -/// into the model's context, and what that content hashed to at the moment it was -/// read. It is what makes a later write checkable: a replayed or retried write -/// carries the digest its decision was based on, and a projection can tell -/// "this write is a duplicate of one already applied" from "this write was -/// decided against content that has since changed" without keeping the bytes. -/// -/// Reads are recorded here, on the completion of the call that performed them, -/// and deliberately not as their own event: reads outnumber writes by more than -/// an order of magnitude, and a per-read event would make the dominant kind in -/// every session stream a fact no projection folds. The same reasoning applies -/// within a call: record an observation only for a resource whose content -/// actually entered the model's context, never for every path a search walked. -/// -/// A change with a proximate tool call is a FileChanged. A change first noticed -/// because a resource hashed differently than when it was last observed is not: -/// it surfaces as an observation with a new digest, with no FileChanged to -/// attribute it to, which is precisely the signal that something outside the -/// session moved underneath it. -#[derive(Clone, Debug, Default)] -pub struct ResourceObservationView<'a> { - /// Resource location, in the same URI form as WorkspaceRef.uri. For a - /// resource inside the workspace this is workspace.uri + "/" + - /// FileChanged.path, which is the join a projection uses to attribute or - /// exclude a later digest change against that path; a resource with no such - /// join (a fetched URL, an MCP resource) can only ever appear here, never as - /// a FileChanged. - /// - /// Field 1: `uri` - pub uri: &'a str, - /// The extent actually read, when the read did not necessarily span the whole - /// resource. This is provenance of what was fetched, not a claim about - /// coverage: complete carries that claim, so a full-covering range alongside - /// complete is not a contradiction. Unset when the outcome is absent, where - /// there is no extent to record. - /// - /// Field 3: `range` - pub range: ::buffa::MessageFieldView>, - /// True when the observation covered the resource in its entirety, with - /// nothing elided by truncation or by a range limit. A write against a - /// resource the model only saw part of is a weaker precondition than one - /// against a resource it saw entirely, and that difference must be a recorded - /// fact rather than inferred from the presence of range. With an absent - /// outcome it asserts the resource was confirmed absent in full, which is the - /// precondition a create-if-not-exists write depends on. - /// - /// Field 4: `complete` - pub complete: ::core::option::Option, - pub outcome: ::core::option::Option< - super::super::__buffa::view::oneof::resource_observation::Outcome<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ResourceObservationView<'a> { - /**Whether required field `uri` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_uri(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ResourceObservationView<'a> { - type Owned = super::super::ResourceObservation; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.uri = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.range.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.range = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.complete = Some(::buffa::types::decode_bool(&mut cur)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::resource_observation::Outcome::ContentDigest( - ref mut existing, - ), - ) = view.outcome - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.outcome = Some( - super::super::__buffa::view::oneof::resource_observation::Outcome::ContentDigest( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::resource_observation::Outcome::Absent( - ref mut existing, - ), - ) = view.outcome - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.outcome = Some( - super::super::__buffa::view::oneof::resource_observation::Outcome::Absent( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ResourceObservation, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ResourceObservation, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ResourceObservation { - uri: self.uri.to_string(), - range: match self.range.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ByteRange, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - complete: self.complete, - outcome: match self.outcome.as_ref() { - ::core::option::Option::Some(v) => { - ::core::option::Option::Some( - match v { - super::super::__buffa::view::oneof::resource_observation::Outcome::ContentDigest( - v, - ) => { - super::super::__buffa::oneof::resource_observation::Outcome::ContentDigest( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::resource_observation::Outcome::Absent( - v, - ) => { - super::super::__buffa::oneof::resource_observation::Outcome::Absent( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - }, - ) - } - ::core::option::Option::None => ::core::option::Option::None, - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ResourceObservationView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.uri) as u64; - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - super::super::__buffa::view::oneof::resource_observation::Outcome::ContentDigest( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::resource_observation::Outcome::Absent( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - if self.range.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.range.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.complete.is_some() { - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.uri, buf); - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - super::super::__buffa::view::oneof::resource_observation::Outcome::ContentDigest( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::resource_observation::Outcome::Absent( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - if self.range.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.range.write_to(__cache, buf); - } - if let Some(v) = self.complete { - ::buffa::types::put_bool_field(4u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ResourceObservationView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("uri", self.uri)?; - } - { - if let ::core::option::Option::Some(__v) = self.range.as_option() { - __map.serialize_entry("range", __v)?; - } - } - if let ::core::option::Option::Some(__v) = self.complete { - __map.serialize_entry("complete", &__v)?; - } - if let ::core::option::Option::Some(ref __ov) = self.outcome { - match __ov { - super::super::__buffa::view::oneof::resource_observation::Outcome::ContentDigest( - v, - ) => { - __map.serialize_entry("contentDigest", v)?; - } - super::super::__buffa::view::oneof::resource_observation::Outcome::Absent( - v, - ) => { - __map.serialize_entry("absent", v)?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ResourceObservationView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ResourceObservation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ResourceObservation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ResourceObservation"; -} -::buffa::impl_default_view_instance!(ResourceObservationView); -::buffa::impl_view_reborrow!(ResourceObservationView); -/** Self-contained, `'static` owned view of a `ResourceObservation` message. - - Wraps [`::buffa::OwnedView`]`<`[`ResourceObservationView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ResourceObservationView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ResourceObservationOwnedView( - ::buffa::OwnedView>, -); -impl ResourceObservationOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ResourceObservationOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ResourceObservationOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ResourceObservation, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ResourceObservationOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ResourceObservationView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ResourceObservationView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ResourceObservation { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Resource location, in the same URI form as WorkspaceRef.uri. For a - /// resource inside the workspace this is workspace.uri + "/" + - /// FileChanged.path, which is the join a projection uses to attribute or - /// exclude a later digest change against that path; a resource with no such - /// join (a fetched URL, an MCP resource) can only ever appear here, never as - /// a FileChanged. - /// - /// Field 1: `uri` - #[must_use] - pub fn uri(&self) -> &'_ str { - self.0.reborrow().uri - } - /// The extent actually read, when the read did not necessarily span the whole - /// resource. This is provenance of what was fetched, not a claim about - /// coverage: complete carries that claim, so a full-covering range alongside - /// complete is not a contradiction. Unset when the outcome is absent, where - /// there is no extent to record. - /// - /// Field 3: `range` - #[must_use] - pub fn range( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().range - } - /// True when the observation covered the resource in its entirety, with - /// nothing elided by truncation or by a range limit. A write against a - /// resource the model only saw part of is a weaker precondition than one - /// against a resource it saw entirely, and that difference must be a recorded - /// fact rather than inferred from the presence of range. With an absent - /// outcome it asserts the resource was confirmed absent in full, which is the - /// precondition a create-if-not-exists write depends on. - /// - /// Field 4: `complete` - #[must_use] - pub fn complete(&self) -> ::core::option::Option { - self.0.reborrow().complete - } - /// Oneof `outcome`. - #[must_use] - pub fn outcome( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::resource_observation::Outcome<'_>, - > { - self.0.reborrow().outcome.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ResourceObservationOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ResourceObservationOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ResourceObservationOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ResourceObservationOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ResourceObservation { - type View<'a> = ResourceObservationView<'a>; - type ViewHandle = ResourceObservationOwnedView; -} -impl ::serde::Serialize for ResourceObservationOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ResourceAbsent is the observation arm for a resource that was looked for and -/// found not to exist. It carries no fields: the fact is the absence itself, and -/// it is a message rather than a bool so the arm can gain detail later without -/// changing the shape of the outcome. -#[derive(Clone, Debug, Default)] -pub struct ResourceAbsentView<'a> { - #[doc(hidden)] - pub __buffa_phantom: ::core::marker::PhantomData<&'a ()>, -} -impl<'a> ::buffa::MessageView<'a> for ResourceAbsentView<'a> { - type Owned = super::super::ResourceAbsent; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ResourceAbsent { - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ResourceAbsentView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let size = 0u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - _buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ResourceAbsentView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - __map.end() - } -} -impl<'a> ::buffa::MessageName for ResourceAbsentView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ResourceAbsent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ResourceAbsent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ResourceAbsent"; -} -::buffa::impl_default_view_instance!(ResourceAbsentView); -::buffa::impl_view_reborrow!(ResourceAbsentView); -/** Self-contained, `'static` owned view of a `ResourceAbsent` message. - - Wraps [`::buffa::OwnedView`]`<`[`ResourceAbsentView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ResourceAbsentView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ResourceAbsentOwnedView(::buffa::OwnedView>); -impl ResourceAbsentOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ResourceAbsentOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ResourceAbsentOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ResourceAbsent, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ResourceAbsentOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ResourceAbsentView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ResourceAbsentView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ResourceAbsent { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ResourceAbsentOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ResourceAbsentOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ResourceAbsentOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ResourceAbsentOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ResourceAbsent { - type View<'a> = ResourceAbsentView<'a>; - type ViewHandle = ResourceAbsentOwnedView; -} -impl ::serde::Serialize for ResourceAbsentOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ByteRange is a half-open extent over a resource's bytes. -#[derive(Clone, Debug, Default)] -pub struct ByteRangeView<'a> { - /// Field 1: `offset` - pub offset: u64, - /// Field 2: `length` - pub length: u64, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, - #[doc(hidden)] - pub __buffa_phantom: ::core::marker::PhantomData<&'a ()>, -} -impl<'a> ByteRangeView<'a> { - /**Whether required field `offset` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_offset(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `length` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_length(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ByteRangeView<'a> { - type Owned = super::super::ByteRange; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.offset = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.length = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ByteRange { - offset: self.offset, - length: self.length, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ByteRangeView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.offset) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.length) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.offset, buf); - ::buffa::types::put_uint64_field(2u32, self.length, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ByteRangeView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "offset", - &::buffa::json_helpers::ProtoJson(&self.offset), - )?; - } - { - __map - .serialize_entry( - "length", - &::buffa::json_helpers::ProtoJson(&self.length), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ByteRangeView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ByteRange"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ByteRange"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ByteRange"; -} -::buffa::impl_default_view_instance!(ByteRangeView); -::buffa::impl_view_reborrow!(ByteRangeView); -/** Self-contained, `'static` owned view of a `ByteRange` message. - - Wraps [`::buffa::OwnedView`]`<`[`ByteRangeView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ByteRangeView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ByteRangeOwnedView(::buffa::OwnedView>); -impl ByteRangeOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ByteRangeOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ByteRangeOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ByteRange, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ByteRangeOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ByteRangeView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ByteRangeView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ByteRange { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `offset` - #[must_use] - pub fn offset(&self) -> u64 { - self.0.reborrow().offset - } - /// Field 2: `length` - #[must_use] - pub fn length(&self) -> u64 { - self.0.reborrow().length - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ByteRangeOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ByteRangeOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ByteRangeOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ByteRangeOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ByteRange { - type View<'a> = ByteRangeView<'a>; - type ViewHandle = ByteRangeOwnedView; -} -impl ::serde::Serialize for ByteRangeOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_observation.__view_oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_observation.__view_oneof.rs deleted file mode 100644 index 4c5a0c453..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_observation.__view_oneof.rs +++ /dev/null @@ -1,20 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/resource_observation.proto - -pub mod resource_observation { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Outcome<'a> { - ContentDigest( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::DigestView<'a>, - >, - ), - Absent( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ResourceAbsentView<'a>, - >, - ), - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_observation.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_observation.rs deleted file mode 100644 index 725b619e4..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.resource_observation.rs +++ /dev/null @@ -1,644 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/resource_observation.proto - -/// ResourceObservation records that a tool call put the content of a resource -/// into the model's context, and what that content hashed to at the moment it was -/// read. It is what makes a later write checkable: a replayed or retried write -/// carries the digest its decision was based on, and a projection can tell -/// "this write is a duplicate of one already applied" from "this write was -/// decided against content that has since changed" without keeping the bytes. -/// -/// Reads are recorded here, on the completion of the call that performed them, -/// and deliberately not as their own event: reads outnumber writes by more than -/// an order of magnitude, and a per-read event would make the dominant kind in -/// every session stream a fact no projection folds. The same reasoning applies -/// within a call: record an observation only for a resource whose content -/// actually entered the model's context, never for every path a search walked. -/// -/// A change with a proximate tool call is a FileChanged. A change first noticed -/// because a resource hashed differently than when it was last observed is not: -/// it surfaces as an observation with a new digest, with no FileChanged to -/// attribute it to, which is precisely the signal that something outside the -/// session moved underneath it. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct ResourceObservation { - /// Resource location, in the same URI form as WorkspaceRef.uri. For a - /// resource inside the workspace this is workspace.uri + "/" + - /// FileChanged.path, which is the join a projection uses to attribute or - /// exclude a later digest change against that path; a resource with no such - /// join (a fetched URL, an MCP resource) can only ever appear here, never as - /// a FileChanged. - /// - /// Field 1: `uri` - #[serde(rename = "uri", with = "::buffa::json_helpers::proto_string")] - pub uri: ::buffa::alloc::string::String, - /// The extent actually read, when the read did not necessarily span the whole - /// resource. This is provenance of what was fetched, not a claim about - /// coverage: complete carries that claim, so a full-covering range alongside - /// complete is not a contradiction. Unset when the outcome is absent, where - /// there is no extent to record. - /// - /// Field 3: `range` - #[serde( - rename = "range", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub range: ::buffa::MessageField>, - /// True when the observation covered the resource in its entirety, with - /// nothing elided by truncation or by a range limit. A write against a - /// resource the model only saw part of is a weaker precondition than one - /// against a resource it saw entirely, and that difference must be a recorded - /// fact rather than inferred from the presence of range. With an absent - /// outcome it asserts the resource was confirmed absent in full, which is the - /// precondition a create-if-not-exists write depends on. - /// - /// Field 4: `complete` - #[serde( - rename = "complete", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub complete: ::core::option::Option, - #[serde(flatten)] - pub outcome: ::core::option::Option<__buffa::oneof::resource_observation::Outcome>, -} -impl ::core::fmt::Debug for ResourceObservation { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ResourceObservation") - .field("uri", &self.uri) - .field("range", &self.range) - .field("complete", &self.complete) - .field("outcome", &self.outcome) - .finish() - } -} -impl ResourceObservation { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ResourceObservation"; -} -impl ResourceObservation { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::complete`] to `Some(value)`, consuming and returning `self`. - pub fn with_complete(mut self, value: bool) -> Self { - self.complete = Some(value); - self - } -} -::buffa::impl_default_instance!(ResourceObservation); -impl ::buffa::MessageName for ResourceObservation { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ResourceObservation"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ResourceObservation"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ResourceObservation"; -} -impl ::buffa::Message for ResourceObservation { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.uri) as u64; - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - __buffa::oneof::resource_observation::Outcome::ContentDigest(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::resource_observation::Outcome::Absent(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - if self.range.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.range.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.complete.is_some() { - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.uri, buf); - if let ::core::option::Option::Some(ref v) = self.outcome { - match v { - __buffa::oneof::resource_observation::Outcome::ContentDigest(x) => { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::resource_observation::Outcome::Absent(x) => { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - if self.range.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.range.write_to(__cache, buf); - } - if let Some(v) = self.complete { - ::buffa::types::put_bool_field(4u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.uri, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::resource_observation::Outcome::ContentDigest( - ref mut existing, - ), - ) = self.outcome - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.outcome = ::core::option::Option::Some( - __buffa::oneof::resource_observation::Outcome::ContentDigest( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::resource_observation::Outcome::Absent( - ref mut existing, - ), - ) = self.outcome - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.outcome = ::core::option::Option::Some( - __buffa::oneof::resource_observation::Outcome::Absent( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.range.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.complete = ::core::option::Option::Some( - ::buffa::types::decode_bool(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.uri.clear(); - self.outcome = ::core::option::Option::None; - self.range = ::buffa::MessageField::none(); - self.complete = ::core::option::Option::None; - } -} -impl<'de> serde::Deserialize<'de> for ResourceObservation { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = ResourceObservation; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct ResourceObservation") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __f_uri: ::core::option::Option< - ::buffa::alloc::string::String, - > = None; - let mut __f_range: ::core::option::Option< - ::buffa::MessageField>, - > = None; - let mut __f_complete: ::core::option::Option< - ::core::option::Option, - > = None; - let mut __oneof_outcome: ::core::option::Option< - __buffa::oneof::resource_observation::Outcome, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "uri" => { - __f_uri = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::alloc::string::String; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::alloc::string::String, - D::Error, - > { - ::buffa::json_helpers::proto_string::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "range" => { - __f_range = Some( - map - .next_value::< - ::buffa::MessageField>, - >()?, - ); - } - "complete" => { - __f_complete = Some( - map.next_value::<::core::option::Option>()?, - ); - } - "contentDigest" | "content_digest" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - Digest, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_outcome.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'outcome'", - ), - ); - } - __oneof_outcome = Some( - __buffa::oneof::resource_observation::Outcome::ContentDigest( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "absent" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ResourceAbsent, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_outcome.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'outcome'", - ), - ); - } - __oneof_outcome = Some( - __buffa::oneof::resource_observation::Outcome::Absent( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - if let ::core::option::Option::Some(v) = __f_uri { - __r.uri = v; - } - if let ::core::option::Option::Some(v) = __f_range { - __r.range = v; - } - if let ::core::option::Option::Some(v) = __f_complete { - __r.complete = v; - } - __r.outcome = __oneof_outcome; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ResourceObservation { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RESOURCE_OBSERVATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ResourceObservation", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod resource_observation { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::resource_observation::Outcome; - #[doc(inline)] - pub use super::__buffa::view::oneof::resource_observation::Outcome as OutcomeView; -} -/// ResourceAbsent is the observation arm for a resource that was looked for and -/// found not to exist. It carries no fields: the fact is the absence itself, and -/// it is a message rather than a bool so the arm can gain detail later without -/// changing the shape of the outcome. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ResourceAbsent {} -impl ::core::fmt::Debug for ResourceAbsent { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ResourceAbsent").finish() - } -} -impl ResourceAbsent { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ResourceAbsent"; -} -::buffa::impl_default_instance!(ResourceAbsent); -impl ::buffa::MessageName for ResourceAbsent { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ResourceAbsent"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ResourceAbsent"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ResourceAbsent"; -} -impl ::buffa::Message for ResourceAbsent { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let size = 0u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - _buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) {} -} -impl ::buffa::json_helpers::ProtoElemJson for ResourceAbsent { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RESOURCE_ABSENT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ResourceAbsent", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ByteRange is a half-open extent over a resource's bytes. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ByteRange { - /// Field 1: `offset` - #[serde(rename = "offset", with = "::buffa::json_helpers::uint64")] - pub offset: u64, - /// Field 2: `length` - #[serde(rename = "length", with = "::buffa::json_helpers::uint64")] - pub length: u64, -} -impl ::core::fmt::Debug for ByteRange { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ByteRange") - .field("offset", &self.offset) - .field("length", &self.length) - .finish() - } -} -impl ByteRange { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ByteRange"; -} -::buffa::impl_default_instance!(ByteRange); -impl ::buffa::MessageName for ByteRange { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ByteRange"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ByteRange"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ByteRange"; -} -impl ::buffa::Message for ByteRange { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.offset) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.length) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.offset, buf); - ::buffa::types::put_uint64_field(2u32, self.length, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.offset = ::buffa::types::decode_uint64(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.length = ::buffa::types::decode_uint64(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.offset = 0u64; - self.length = 0u64; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ByteRange { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __BYTE_RANGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ByteRange", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.rewind_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.rewind_session.__view.rs deleted file mode 100644 index fe1b90f1a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.rewind_session.__view.rs +++ /dev/null @@ -1,365 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/rewind_session.proto - -/// RewindSession moves the effective-history boundary back, recording -/// \[SessionRewound\]. It masks what later turns and readers see; it never -/// un-applies a fact, because work that really ran still has to be reconcilable. -/// -/// Write precondition At: keep_through must lie within the log the decision was -/// taken against. -#[derive(Clone, Debug, Default)] -pub struct RewindSessionView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// This session's own ordinal that stays effective; everything after it is masked. - /// - /// Field 2: `keep_through` - pub keep_through: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Field 3: `reason` - pub reason: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> RewindSessionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `keep_through` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_keep_through(&self) -> bool { - self.keep_through.is_set() - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for RewindSessionView<'a> { - type Owned = super::super::RewindSession; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.keep_through.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.keep_through = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::RewindSession { - session_id: self.session_id.to_string(), - keep_through: match self.keep_through.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - reason: self.reason, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for RewindSessionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.keep_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.keep_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.keep_through.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.keep_through.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.reason.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for RewindSessionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.keep_through.as_option() { - __map.serialize_entry("keepThrough", __v)?; - } - } - { - __map.serialize_entry("reason", &self.reason)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for RewindSessionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RewindSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RewindSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RewindSession"; -} -::buffa::impl_default_view_instance!(RewindSessionView); -::buffa::impl_view_reborrow!(RewindSessionView); -/** Self-contained, `'static` owned view of a `RewindSession` message. - - Wraps [`::buffa::OwnedView`]`<`[`RewindSessionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`RewindSessionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct RewindSessionOwnedView(::buffa::OwnedView>); -impl RewindSessionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RewindSessionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RewindSessionOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::RewindSession, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - RewindSessionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`RewindSessionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &RewindSessionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::RewindSession { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// This session's own ordinal that stays effective; everything after it is masked. - /// - /// Field 2: `keep_through` - #[must_use] - pub fn keep_through( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().keep_through - } - /// Field 3: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for RewindSessionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - RewindSessionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: RewindSessionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for RewindSessionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::RewindSession { - type View<'a> = RewindSessionView<'a>; - type ViewHandle = RewindSessionOwnedView; -} -impl ::serde::Serialize for RewindSessionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.rewind_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.rewind_session.rs deleted file mode 100644 index 96e22e6fd..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.rewind_session.rs +++ /dev/null @@ -1,171 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/rewind_session.proto - -/// RewindSession moves the effective-history boundary back, recording -/// \[SessionRewound\]. It masks what later turns and readers see; it never -/// un-applies a fact, because work that really ran still has to be reconcilable. -/// -/// Write precondition At: keep_through must lie within the log the decision was -/// taken against. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct RewindSession { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// This session's own ordinal that stays effective; everything after it is masked. - /// - /// Field 2: `keep_through` - #[serde(rename = "keepThrough", alias = "keep_through")] - pub keep_through: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Field 3: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for RewindSession { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RewindSession") - .field("session_id", &self.session_id) - .field("keep_through", &self.keep_through) - .field("reason", &self.reason) - .finish() - } -} -impl RewindSession { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RewindSession"; -} -::buffa::impl_default_instance!(RewindSession); -impl ::buffa::MessageName for RewindSession { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "RewindSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.RewindSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.RewindSession"; -} -impl ::buffa::Message for RewindSession { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.keep_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.keep_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.keep_through.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.keep_through.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.reason.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.keep_through.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.keep_through = ::buffa::MessageField::none(); - self.reason = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for RewindSession { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __REWIND_SESSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.RewindSession", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_archived.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_archived.__view.rs deleted file mode 100644 index 3642c952d..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_archived.__view.rs +++ /dev/null @@ -1,255 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_archived.proto - -/// SessionArchived records that a session was moved out of the default listing -/// view: reversible organization state, distinct from the terminal -/// SessionHidden (D11). It is a commuting happened-fact -/// (WRITE_PRECONDITION = Any). -#[derive(Clone, Debug, Default)] -pub struct SessionArchivedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionArchivedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SessionArchivedView<'a> { - type Owned = super::super::SessionArchived; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionArchived { - session_id: self.session_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionArchivedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionArchivedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionArchivedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionArchived"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionArchived"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionArchived"; -} -::buffa::impl_default_view_instance!(SessionArchivedView); -::buffa::impl_view_reborrow!(SessionArchivedView); -/** Self-contained, `'static` owned view of a `SessionArchived` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionArchivedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionArchivedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionArchivedOwnedView(::buffa::OwnedView>); -impl SessionArchivedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionArchivedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionArchivedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionArchived, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionArchivedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionArchivedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionArchivedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionArchived { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionArchivedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionArchivedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionArchivedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionArchivedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionArchived { - type View<'a> = SessionArchivedView<'a>; - type ViewHandle = SessionArchivedOwnedView; -} -impl ::serde::Serialize for SessionArchivedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_archived.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_archived.rs deleted file mode 100644 index e53831f2a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_archived.rs +++ /dev/null @@ -1,111 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_archived.proto - -/// SessionArchived records that a session was moved out of the default listing -/// view: reversible organization state, distinct from the terminal -/// SessionHidden (D11). It is a commuting happened-fact -/// (WRITE_PRECONDITION = Any). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionArchived { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for SessionArchived { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionArchived").field("session_id", &self.session_id).finish() - } -} -impl SessionArchived { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionArchived"; -} -::buffa::impl_default_instance!(SessionArchived); -impl ::buffa::MessageName for SessionArchived { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionArchived"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionArchived"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionArchived"; -} -impl ::buffa::Message for SessionArchived { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionArchived { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_ARCHIVED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionArchived", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_cancelled.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_cancelled.__view.rs deleted file mode 100644 index 5ccf50316..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_cancelled.__view.rs +++ /dev/null @@ -1,318 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_cancelled.proto - -/// SessionCancelled is the cancellation terminal marker for a session; it is -/// also emitted on the child in the cascade batch after ParentTerminated -/// (PARENT_TERMINAL_CASCADE) or after ParentHistoryInvalidated -/// (PARENT_REWIND_CASCADE) (ADR#0035 facet 6). It is an invariant-bearing -/// transition guarded by WRITE_PRECONDITION = At(current_position). -#[derive(Clone, Debug, Default)] -pub struct SessionCancelledView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `reason` - pub reason: ::buffa::EnumValue, - /// Human-readable detail; empty when none. - /// - /// Field 3: `detail` - pub detail: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionCancelledView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SessionCancelledView<'a> { - type Owned = super::super::SessionCancelled; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionCancelled { - session_id: self.session_id.to_string(), - reason: self.reason, - detail: self.detail.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionCancelledView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionCancelledView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionCancelledView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionCancelled"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionCancelled"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionCancelled"; -} -::buffa::impl_default_view_instance!(SessionCancelledView); -::buffa::impl_view_reborrow!(SessionCancelledView); -/** Self-contained, `'static` owned view of a `SessionCancelled` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionCancelledView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionCancelledView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionCancelledOwnedView(::buffa::OwnedView>); -impl SessionCancelledOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionCancelledOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionCancelledOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionCancelled, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionCancelledOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionCancelledView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionCancelledView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionCancelled { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// Human-readable detail; empty when none. - /// - /// Field 3: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionCancelledOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionCancelledOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionCancelledOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionCancelledOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionCancelled { - type View<'a> = SessionCancelledView<'a>; - type ViewHandle = SessionCancelledOwnedView; -} -impl ::serde::Serialize for SessionCancelledOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_cancelled.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_cancelled.rs deleted file mode 100644 index c4c79bffe..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_cancelled.rs +++ /dev/null @@ -1,413 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_cancelled.proto - -/// SessionCancellationReason is the typed classification of why a session was -/// cancelled. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum SessionCancellationReason { - SESSION_CANCELLATION_REASON_UNSPECIFIED = 0i32, - /// An explicit user cancellation request. - SESSION_CANCELLATION_REASON_USER_REQUESTED = 1i32, - /// Cascaded from a parent reaching a terminal state. - SESSION_CANCELLATION_REASON_PARENT_TERMINAL_CASCADE = 2i32, - /// Cascaded from a parent rewind invalidating this child's dispatch point. - SESSION_CANCELLATION_REASON_PARENT_REWIND_CASCADE = 3i32, - /// Exceeded its time budget. - SESSION_CANCELLATION_REASON_TIMEOUT = 4i32, - /// Cancelled by policy (for example an admission or safety policy). - SESSION_CANCELLATION_REASON_POLICY = 5i32, - /// Cancelled as part of an orderly shutdown. - SESSION_CANCELLATION_REASON_SHUTDOWN = 6i32, -} -impl SessionCancellationReason { - ///Idiomatic alias for [`Self::SESSION_CANCELLATION_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::SESSION_CANCELLATION_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::SESSION_CANCELLATION_REASON_USER_REQUESTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const UserRequested: Self = Self::SESSION_CANCELLATION_REASON_USER_REQUESTED; - ///Idiomatic alias for [`Self::SESSION_CANCELLATION_REASON_PARENT_TERMINAL_CASCADE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ParentTerminalCascade: Self = Self::SESSION_CANCELLATION_REASON_PARENT_TERMINAL_CASCADE; - ///Idiomatic alias for [`Self::SESSION_CANCELLATION_REASON_PARENT_REWIND_CASCADE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ParentRewindCascade: Self = Self::SESSION_CANCELLATION_REASON_PARENT_REWIND_CASCADE; - ///Idiomatic alias for [`Self::SESSION_CANCELLATION_REASON_TIMEOUT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Timeout: Self = Self::SESSION_CANCELLATION_REASON_TIMEOUT; - ///Idiomatic alias for [`Self::SESSION_CANCELLATION_REASON_POLICY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Policy: Self = Self::SESSION_CANCELLATION_REASON_POLICY; - ///Idiomatic alias for [`Self::SESSION_CANCELLATION_REASON_SHUTDOWN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Shutdown: Self = Self::SESSION_CANCELLATION_REASON_SHUTDOWN; -} -impl ::core::default::Default for SessionCancellationReason { - fn default() -> Self { - Self::SESSION_CANCELLATION_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for SessionCancellationReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for SessionCancellationReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = SessionCancellationReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(SessionCancellationReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionCancellationReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for SessionCancellationReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some( - Self::SESSION_CANCELLATION_REASON_UNSPECIFIED, - ) - } - 1i32 => { - ::core::option::Option::Some( - Self::SESSION_CANCELLATION_REASON_USER_REQUESTED, - ) - } - 2i32 => { - ::core::option::Option::Some( - Self::SESSION_CANCELLATION_REASON_PARENT_TERMINAL_CASCADE, - ) - } - 3i32 => { - ::core::option::Option::Some( - Self::SESSION_CANCELLATION_REASON_PARENT_REWIND_CASCADE, - ) - } - 4i32 => { - ::core::option::Option::Some(Self::SESSION_CANCELLATION_REASON_TIMEOUT) - } - 5i32 => { - ::core::option::Option::Some(Self::SESSION_CANCELLATION_REASON_POLICY) - } - 6i32 => { - ::core::option::Option::Some(Self::SESSION_CANCELLATION_REASON_SHUTDOWN) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::SESSION_CANCELLATION_REASON_UNSPECIFIED => { - "SESSION_CANCELLATION_REASON_UNSPECIFIED" - } - Self::SESSION_CANCELLATION_REASON_USER_REQUESTED => { - "SESSION_CANCELLATION_REASON_USER_REQUESTED" - } - Self::SESSION_CANCELLATION_REASON_PARENT_TERMINAL_CASCADE => { - "SESSION_CANCELLATION_REASON_PARENT_TERMINAL_CASCADE" - } - Self::SESSION_CANCELLATION_REASON_PARENT_REWIND_CASCADE => { - "SESSION_CANCELLATION_REASON_PARENT_REWIND_CASCADE" - } - Self::SESSION_CANCELLATION_REASON_TIMEOUT => { - "SESSION_CANCELLATION_REASON_TIMEOUT" - } - Self::SESSION_CANCELLATION_REASON_POLICY => { - "SESSION_CANCELLATION_REASON_POLICY" - } - Self::SESSION_CANCELLATION_REASON_SHUTDOWN => { - "SESSION_CANCELLATION_REASON_SHUTDOWN" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "SESSION_CANCELLATION_REASON_UNSPECIFIED" => { - ::core::option::Option::Some( - Self::SESSION_CANCELLATION_REASON_UNSPECIFIED, - ) - } - "SESSION_CANCELLATION_REASON_USER_REQUESTED" => { - ::core::option::Option::Some( - Self::SESSION_CANCELLATION_REASON_USER_REQUESTED, - ) - } - "SESSION_CANCELLATION_REASON_PARENT_TERMINAL_CASCADE" => { - ::core::option::Option::Some( - Self::SESSION_CANCELLATION_REASON_PARENT_TERMINAL_CASCADE, - ) - } - "SESSION_CANCELLATION_REASON_PARENT_REWIND_CASCADE" => { - ::core::option::Option::Some( - Self::SESSION_CANCELLATION_REASON_PARENT_REWIND_CASCADE, - ) - } - "SESSION_CANCELLATION_REASON_TIMEOUT" => { - ::core::option::Option::Some(Self::SESSION_CANCELLATION_REASON_TIMEOUT) - } - "SESSION_CANCELLATION_REASON_POLICY" => { - ::core::option::Option::Some(Self::SESSION_CANCELLATION_REASON_POLICY) - } - "SESSION_CANCELLATION_REASON_SHUTDOWN" => { - ::core::option::Option::Some(Self::SESSION_CANCELLATION_REASON_SHUTDOWN) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::SESSION_CANCELLATION_REASON_UNSPECIFIED, - Self::SESSION_CANCELLATION_REASON_USER_REQUESTED, - Self::SESSION_CANCELLATION_REASON_PARENT_TERMINAL_CASCADE, - Self::SESSION_CANCELLATION_REASON_PARENT_REWIND_CASCADE, - Self::SESSION_CANCELLATION_REASON_TIMEOUT, - Self::SESSION_CANCELLATION_REASON_POLICY, - Self::SESSION_CANCELLATION_REASON_SHUTDOWN, - ] - } -} -/// SessionCancelled is the cancellation terminal marker for a session; it is -/// also emitted on the child in the cascade batch after ParentTerminated -/// (PARENT_TERMINAL_CASCADE) or after ParentHistoryInvalidated -/// (PARENT_REWIND_CASCADE) (ADR#0035 facet 6). It is an invariant-bearing -/// transition guarded by WRITE_PRECONDITION = At(current_position). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionCancelled { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// Human-readable detail; empty when none. - /// - /// Field 3: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for SessionCancelled { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionCancelled") - .field("session_id", &self.session_id) - .field("reason", &self.reason) - .field("detail", &self.detail) - .finish() - } -} -impl SessionCancelled { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionCancelled"; -} -impl SessionCancelled { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(SessionCancelled); -impl ::buffa::MessageName for SessionCancelled { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionCancelled"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionCancelled"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionCancelled"; -} -impl ::buffa::Message for SessionCancelled { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.reason = ::buffa::EnumValue::from(0); - self.detail = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionCancelled { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_CANCELLED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionCancelled", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_closed.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_closed.__view.rs deleted file mode 100644 index 23d694d37..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_closed.__view.rs +++ /dev/null @@ -1,324 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_closed.proto - -/// SessionClosed is the normal-completion terminal marker for a session. It is an -/// invariant-bearing transition (WRITE_PRECONDITION = At); a second close is -/// rejected (ADR#0035 facet 2). A delegating parent's durable receipt of this -/// session's result is not this event but the delegation operation's own -/// OperationOutcomeRecorded on the parent stream, written by the reconciler; -/// the At guard plus one-terminal-outcome-per-operation makes redelivery -/// idempotent (D6). -#[derive(Clone, Debug, Default)] -pub struct SessionClosedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Claim-check to the session's final output; unset when the session produced - /// none. - /// - /// Field 2: `result_ref` - pub result_ref: ::buffa::MessageFieldView< - super::super::__buffa::view::ArtifactRefView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionClosedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SessionClosedView<'a> { - type Owned = super::super::SessionClosed; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.result_ref.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.result_ref = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionClosed { - session_id: self.session_id.to_string(), - result_ref: match self.result_ref.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ArtifactRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionClosedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.result_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.result_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.result_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.result_ref.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionClosedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.result_ref.as_option() { - __map.serialize_entry("resultRef", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionClosedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionClosed"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionClosed"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionClosed"; -} -::buffa::impl_default_view_instance!(SessionClosedView); -::buffa::impl_view_reborrow!(SessionClosedView); -/** Self-contained, `'static` owned view of a `SessionClosed` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionClosedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionClosedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionClosedOwnedView(::buffa::OwnedView>); -impl SessionClosedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionClosedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionClosedOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionClosed, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionClosedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionClosedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionClosedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionClosed { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Claim-check to the session's final output; unset when the session produced - /// none. - /// - /// Field 2: `result_ref` - #[must_use] - pub fn result_ref( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().result_ref - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionClosedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionClosedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionClosedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionClosedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionClosed { - type View<'a> = SessionClosedView<'a>; - type ViewHandle = SessionClosedOwnedView; -} -impl ::serde::Serialize for SessionClosedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_closed.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_closed.rs deleted file mode 100644 index 01f1197c6..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_closed.rs +++ /dev/null @@ -1,155 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_closed.proto - -/// SessionClosed is the normal-completion terminal marker for a session. It is an -/// invariant-bearing transition (WRITE_PRECONDITION = At); a second close is -/// rejected (ADR#0035 facet 2). A delegating parent's durable receipt of this -/// session's result is not this event but the delegation operation's own -/// OperationOutcomeRecorded on the parent stream, written by the reconciler; -/// the At guard plus one-terminal-outcome-per-operation makes redelivery -/// idempotent (D6). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionClosed { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Claim-check to the session's final output; unset when the session produced - /// none. - /// - /// Field 2: `result_ref` - #[serde( - rename = "resultRef", - alias = "result_ref", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub result_ref: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for SessionClosed { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionClosed") - .field("session_id", &self.session_id) - .field("result_ref", &self.result_ref) - .finish() - } -} -impl SessionClosed { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionClosed"; -} -::buffa::impl_default_instance!(SessionClosed); -impl ::buffa::MessageName for SessionClosed { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionClosed"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionClosed"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionClosed"; -} -impl ::buffa::Message for SessionClosed { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.result_ref.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.result_ref.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.result_ref.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.result_ref.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.result_ref.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.result_ref = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionClosed { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_CLOSED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionClosed", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_failed.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_failed.__view.rs deleted file mode 100644 index 92767977a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_failed.__view.rs +++ /dev/null @@ -1,314 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_failed.proto - -/// SessionFailed is the terminal failure marker for a session; a liveness -/// watchdog records this when no further attempt will run (ADR#0035 facet 6). -/// It is an invariant-bearing transition guarded by WRITE_PRECONDITION = At(current_position). -#[derive(Clone, Debug, Default)] -pub struct SessionFailedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Human-readable detail of the failure; empty when none. - /// - /// Field 2: `detail` - pub detail: ::core::option::Option<&'a str>, - /// Field 3: `reason` - pub reason: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionFailedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SessionFailedView<'a> { - type Owned = super::super::SessionFailed; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionFailed { - session_id: self.session_id.to_string(), - detail: self.detail.map(|s| s.to_string()), - reason: self.reason, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionFailedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(2u32, v, buf); - } - ::buffa::types::put_int32_field(3u32, self.reason.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionFailedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionFailedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionFailed"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionFailed"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionFailed"; -} -::buffa::impl_default_view_instance!(SessionFailedView); -::buffa::impl_view_reborrow!(SessionFailedView); -/** Self-contained, `'static` owned view of a `SessionFailed` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionFailedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionFailedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionFailedOwnedView(::buffa::OwnedView>); -impl SessionFailedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionFailedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionFailedOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionFailed, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionFailedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionFailedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionFailedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionFailed { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Human-readable detail of the failure; empty when none. - /// - /// Field 2: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } - /// Field 3: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionFailedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionFailedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionFailedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionFailedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionFailed { - type View<'a> = SessionFailedView<'a>; - type ViewHandle = SessionFailedOwnedView; -} -impl ::serde::Serialize for SessionFailedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_failed.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_failed.rs deleted file mode 100644 index 784bc26dd..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_failed.rs +++ /dev/null @@ -1,391 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_failed.proto - -/// SessionFailureReason is the typed classification of why a session failed. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum SessionFailureReason { - SESSION_FAILURE_REASON_UNSPECIFIED = 0i32, - /// Failed with a runtime or execution error. - SESSION_FAILURE_REASON_EXECUTION_ERROR = 1i32, - /// Exceeded its time budget. - SESSION_FAILURE_REASON_TIMEOUT = 2i32, - /// Exhausted an allotted resource (for example a token or cost budget). - SESSION_FAILURE_REASON_RESOURCE_EXHAUSTED = 3i32, - /// A required external dependency failed. - SESSION_FAILURE_REASON_EXTERNAL_DEPENDENCY_FAILURE = 4i32, - /// The session's execution violated its own SessionExecutionPlan binding. - SESSION_FAILURE_REASON_PLAN_BINDING_VIOLATION = 5i32, -} -impl SessionFailureReason { - ///Idiomatic alias for [`Self::SESSION_FAILURE_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::SESSION_FAILURE_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::SESSION_FAILURE_REASON_EXECUTION_ERROR`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ExecutionError: Self = Self::SESSION_FAILURE_REASON_EXECUTION_ERROR; - ///Idiomatic alias for [`Self::SESSION_FAILURE_REASON_TIMEOUT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Timeout: Self = Self::SESSION_FAILURE_REASON_TIMEOUT; - ///Idiomatic alias for [`Self::SESSION_FAILURE_REASON_RESOURCE_EXHAUSTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ResourceExhausted: Self = Self::SESSION_FAILURE_REASON_RESOURCE_EXHAUSTED; - ///Idiomatic alias for [`Self::SESSION_FAILURE_REASON_EXTERNAL_DEPENDENCY_FAILURE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ExternalDependencyFailure: Self = Self::SESSION_FAILURE_REASON_EXTERNAL_DEPENDENCY_FAILURE; - ///Idiomatic alias for [`Self::SESSION_FAILURE_REASON_PLAN_BINDING_VIOLATION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const PlanBindingViolation: Self = Self::SESSION_FAILURE_REASON_PLAN_BINDING_VIOLATION; -} -impl ::core::default::Default for SessionFailureReason { - fn default() -> Self { - Self::SESSION_FAILURE_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for SessionFailureReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for SessionFailureReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = SessionFailureReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(SessionFailureReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionFailureReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for SessionFailureReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some(Self::SESSION_FAILURE_REASON_UNSPECIFIED) - } - 1i32 => { - ::core::option::Option::Some( - Self::SESSION_FAILURE_REASON_EXECUTION_ERROR, - ) - } - 2i32 => ::core::option::Option::Some(Self::SESSION_FAILURE_REASON_TIMEOUT), - 3i32 => { - ::core::option::Option::Some( - Self::SESSION_FAILURE_REASON_RESOURCE_EXHAUSTED, - ) - } - 4i32 => { - ::core::option::Option::Some( - Self::SESSION_FAILURE_REASON_EXTERNAL_DEPENDENCY_FAILURE, - ) - } - 5i32 => { - ::core::option::Option::Some( - Self::SESSION_FAILURE_REASON_PLAN_BINDING_VIOLATION, - ) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::SESSION_FAILURE_REASON_UNSPECIFIED => { - "SESSION_FAILURE_REASON_UNSPECIFIED" - } - Self::SESSION_FAILURE_REASON_EXECUTION_ERROR => { - "SESSION_FAILURE_REASON_EXECUTION_ERROR" - } - Self::SESSION_FAILURE_REASON_TIMEOUT => "SESSION_FAILURE_REASON_TIMEOUT", - Self::SESSION_FAILURE_REASON_RESOURCE_EXHAUSTED => { - "SESSION_FAILURE_REASON_RESOURCE_EXHAUSTED" - } - Self::SESSION_FAILURE_REASON_EXTERNAL_DEPENDENCY_FAILURE => { - "SESSION_FAILURE_REASON_EXTERNAL_DEPENDENCY_FAILURE" - } - Self::SESSION_FAILURE_REASON_PLAN_BINDING_VIOLATION => { - "SESSION_FAILURE_REASON_PLAN_BINDING_VIOLATION" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "SESSION_FAILURE_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::SESSION_FAILURE_REASON_UNSPECIFIED) - } - "SESSION_FAILURE_REASON_EXECUTION_ERROR" => { - ::core::option::Option::Some( - Self::SESSION_FAILURE_REASON_EXECUTION_ERROR, - ) - } - "SESSION_FAILURE_REASON_TIMEOUT" => { - ::core::option::Option::Some(Self::SESSION_FAILURE_REASON_TIMEOUT) - } - "SESSION_FAILURE_REASON_RESOURCE_EXHAUSTED" => { - ::core::option::Option::Some( - Self::SESSION_FAILURE_REASON_RESOURCE_EXHAUSTED, - ) - } - "SESSION_FAILURE_REASON_EXTERNAL_DEPENDENCY_FAILURE" => { - ::core::option::Option::Some( - Self::SESSION_FAILURE_REASON_EXTERNAL_DEPENDENCY_FAILURE, - ) - } - "SESSION_FAILURE_REASON_PLAN_BINDING_VIOLATION" => { - ::core::option::Option::Some( - Self::SESSION_FAILURE_REASON_PLAN_BINDING_VIOLATION, - ) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::SESSION_FAILURE_REASON_UNSPECIFIED, - Self::SESSION_FAILURE_REASON_EXECUTION_ERROR, - Self::SESSION_FAILURE_REASON_TIMEOUT, - Self::SESSION_FAILURE_REASON_RESOURCE_EXHAUSTED, - Self::SESSION_FAILURE_REASON_EXTERNAL_DEPENDENCY_FAILURE, - Self::SESSION_FAILURE_REASON_PLAN_BINDING_VIOLATION, - ] - } -} -/// SessionFailed is the terminal failure marker for a session; a liveness -/// watchdog records this when no further attempt will run (ADR#0035 facet 6). -/// It is an invariant-bearing transition guarded by WRITE_PRECONDITION = At(current_position). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionFailed { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Human-readable detail of the failure; empty when none. - /// - /// Field 2: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, - /// Field 3: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for SessionFailed { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionFailed") - .field("session_id", &self.session_id) - .field("detail", &self.detail) - .field("reason", &self.reason) - .finish() - } -} -impl SessionFailed { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionFailed"; -} -impl SessionFailed { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(SessionFailed); -impl ::buffa::MessageName for SessionFailed { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionFailed"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionFailed"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionFailed"; -} -impl ::buffa::Message for SessionFailed { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(2u32, v, buf); - } - ::buffa::types::put_int32_field(3u32, self.reason.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.detail = ::core::option::Option::None; - self.reason = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionFailed { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_FAILED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionFailed", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_forked.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_forked.__view.rs deleted file mode 100644 index 629194b1e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_forked.__view.rs +++ /dev/null @@ -1,412 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_forked.proto - -/// SessionForked is the second event in the atomic \[SessionStarted, SessionForked\] -/// creation batch appended to the child subject under the NoStream precondition, -/// making fork creation atomic and exactly-once (ADR#0035 facet 2). The child -/// aggregate folds only its own stream -- fork replay never folds source events -/// into child aggregate state; conversation messages, compaction summaries, and -/// artifact references within context_prefix_boundary are inherited by reference -/// through the model-visible context projection keyed by (source_session_id, -/// context_prefix_boundary), never by physical copy (ADR#0035 facet 5). A later -/// rewind on the source does not retroactively alter a fork's context prefix: it -/// is an immutable snapshot-in-time reference on a keep-forever log. -#[derive(Clone, Debug, Default)] -pub struct SessionForkedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `source_session_id` - pub source_session_id: &'a str, - /// Inclusive boundary on the source stream: the last source-stream ordinal - /// whose conversation messages, compaction summaries, and artifact references - /// this fork inherits by reference. - /// - /// Field 3: `context_prefix_boundary` - pub context_prefix_boundary: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Why the fork happened; a command-time input not derivable from the rest of - /// the log. - /// - /// Field 4: `reason` - pub reason: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionForkedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `source_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `context_prefix_boundary` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_context_prefix_boundary(&self) -> bool { - self.context_prefix_boundary.is_set() - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SessionForkedView<'a> { - type Owned = super::super::SessionForked; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.context_prefix_boundary.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.context_prefix_boundary = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionForked { - session_id: self.session_id.to_string(), - source_session_id: self.source_session_id.to_string(), - context_prefix_boundary: match self.context_prefix_boundary.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - reason: self.reason, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionForkedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.context_prefix_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.context_prefix_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.source_session_id, buf); - if self.context_prefix_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.context_prefix_boundary.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(4u32, self.reason.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionForkedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("sourceSessionId", self.source_session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self - .context_prefix_boundary - .as_option() - { - __map.serialize_entry("contextPrefixBoundary", __v)?; - } - } - { - __map.serialize_entry("reason", &self.reason)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionForkedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionForked"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionForked"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionForked"; -} -::buffa::impl_default_view_instance!(SessionForkedView); -::buffa::impl_view_reborrow!(SessionForkedView); -/** Self-contained, `'static` owned view of a `SessionForked` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionForkedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionForkedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionForkedOwnedView(::buffa::OwnedView>); -impl SessionForkedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionForkedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionForkedOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionForked, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionForkedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionForkedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionForkedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionForked { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `source_session_id` - #[must_use] - pub fn source_session_id(&self) -> &'_ str { - self.0.reborrow().source_session_id - } - /// Inclusive boundary on the source stream: the last source-stream ordinal - /// whose conversation messages, compaction summaries, and artifact references - /// this fork inherits by reference. - /// - /// Field 3: `context_prefix_boundary` - #[must_use] - pub fn context_prefix_boundary( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().context_prefix_boundary - } - /// Why the fork happened; a command-time input not derivable from the rest of - /// the log. - /// - /// Field 4: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionForkedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionForkedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionForkedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionForkedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionForked { - type View<'a> = SessionForkedView<'a>; - type ViewHandle = SessionForkedOwnedView; -} -impl ::serde::Serialize for SessionForkedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_forked.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_forked.rs deleted file mode 100644 index ac14fba48..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_forked.rs +++ /dev/null @@ -1,365 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_forked.proto - -/// ForkReason is why a session was forked. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ForkReason { - FORK_REASON_UNSPECIFIED = 0i32, - /// An explicit user branch. - FORK_REASON_MANUAL_BRANCH = 1i32, - /// A continuation forked at a compaction boundary. - FORK_REASON_COMPACTION_CONTINUATION = 2i32, - /// A retry of a prior run from a shared prefix. - FORK_REASON_RETRY = 3i32, -} -impl ForkReason { - ///Idiomatic alias for [`Self::FORK_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::FORK_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::FORK_REASON_MANUAL_BRANCH`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ManualBranch: Self = Self::FORK_REASON_MANUAL_BRANCH; - ///Idiomatic alias for [`Self::FORK_REASON_COMPACTION_CONTINUATION`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const CompactionContinuation: Self = Self::FORK_REASON_COMPACTION_CONTINUATION; - ///Idiomatic alias for [`Self::FORK_REASON_RETRY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Retry: Self = Self::FORK_REASON_RETRY; -} -impl ::core::default::Default for ForkReason { - fn default() -> Self { - Self::FORK_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for ForkReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ForkReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ForkReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(ForkReason)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ForkReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ForkReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::FORK_REASON_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::FORK_REASON_MANUAL_BRANCH), - 2i32 => { - ::core::option::Option::Some(Self::FORK_REASON_COMPACTION_CONTINUATION) - } - 3i32 => ::core::option::Option::Some(Self::FORK_REASON_RETRY), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::FORK_REASON_UNSPECIFIED => "FORK_REASON_UNSPECIFIED", - Self::FORK_REASON_MANUAL_BRANCH => "FORK_REASON_MANUAL_BRANCH", - Self::FORK_REASON_COMPACTION_CONTINUATION => { - "FORK_REASON_COMPACTION_CONTINUATION" - } - Self::FORK_REASON_RETRY => "FORK_REASON_RETRY", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "FORK_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::FORK_REASON_UNSPECIFIED) - } - "FORK_REASON_MANUAL_BRANCH" => { - ::core::option::Option::Some(Self::FORK_REASON_MANUAL_BRANCH) - } - "FORK_REASON_COMPACTION_CONTINUATION" => { - ::core::option::Option::Some(Self::FORK_REASON_COMPACTION_CONTINUATION) - } - "FORK_REASON_RETRY" => ::core::option::Option::Some(Self::FORK_REASON_RETRY), - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::FORK_REASON_UNSPECIFIED, - Self::FORK_REASON_MANUAL_BRANCH, - Self::FORK_REASON_COMPACTION_CONTINUATION, - Self::FORK_REASON_RETRY, - ] - } -} -/// SessionForked is the second event in the atomic \[SessionStarted, SessionForked\] -/// creation batch appended to the child subject under the NoStream precondition, -/// making fork creation atomic and exactly-once (ADR#0035 facet 2). The child -/// aggregate folds only its own stream -- fork replay never folds source events -/// into child aggregate state; conversation messages, compaction summaries, and -/// artifact references within context_prefix_boundary are inherited by reference -/// through the model-visible context projection keyed by (source_session_id, -/// context_prefix_boundary), never by physical copy (ADR#0035 facet 5). A later -/// rewind on the source does not retroactively alter a fork's context prefix: it -/// is an immutable snapshot-in-time reference on a keep-forever log. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionForked { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `source_session_id` - #[serde( - rename = "sourceSessionId", - alias = "source_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub source_session_id: ::buffa::alloc::string::String, - /// Inclusive boundary on the source stream: the last source-stream ordinal - /// whose conversation messages, compaction summaries, and artifact references - /// this fork inherits by reference. - /// - /// Field 3: `context_prefix_boundary` - #[serde(rename = "contextPrefixBoundary", alias = "context_prefix_boundary")] - pub context_prefix_boundary: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Why the fork happened; a command-time input not derivable from the rest of - /// the log. - /// - /// Field 4: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for SessionForked { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionForked") - .field("session_id", &self.session_id) - .field("source_session_id", &self.source_session_id) - .field("context_prefix_boundary", &self.context_prefix_boundary) - .field("reason", &self.reason) - .finish() - } -} -impl SessionForked { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionForked"; -} -::buffa::impl_default_instance!(SessionForked); -impl ::buffa::MessageName for SessionForked { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionForked"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionForked"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionForked"; -} -impl ::buffa::Message for SessionForked { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.context_prefix_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.context_prefix_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.source_session_id, buf); - if self.context_prefix_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.context_prefix_boundary.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(4u32, self.reason.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.source_session_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.context_prefix_boundary.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.source_session_id.clear(); - self.context_prefix_boundary = ::buffa::MessageField::none(); - self.reason = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionForked { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_FORKED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionForked", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_hidden.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_hidden.__view.rs deleted file mode 100644 index 8de80b147..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_hidden.__view.rs +++ /dev/null @@ -1,291 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_hidden.proto - -/// SessionHidden is the terminal visibility-tombstone marker for a session: it -/// removes the session from every default surface and still cascades as a -/// terminal marker, but -- unlike its former name SessionDeleted -- it does not -/// promise erasure the log does not perform; the log is never physically purged -/// (ADR#0035 facet 2, facet 7). Legal or user erasure beyond masking is a named -/// follow-up ADR (D7); the interim story is RedactionApplied plus -/// ArtifactErased. It is an invariant-bearing transition guarded by -/// WRITE_PRECONDITION = At(current_position). -#[derive(Clone, Debug, Default)] -pub struct SessionHiddenView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `reason` - pub reason: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionHiddenView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SessionHiddenView<'a> { - type Owned = super::super::SessionHidden; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionHidden { - session_id: self.session_id.to_string(), - reason: self.reason, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionHiddenView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.reason.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionHiddenView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionHiddenView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionHidden"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionHidden"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionHidden"; -} -::buffa::impl_default_view_instance!(SessionHiddenView); -::buffa::impl_view_reborrow!(SessionHiddenView); -/** Self-contained, `'static` owned view of a `SessionHidden` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionHiddenView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionHiddenView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionHiddenOwnedView(::buffa::OwnedView>); -impl SessionHiddenOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionHiddenOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionHiddenOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionHidden, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionHiddenOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionHiddenView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionHiddenView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionHidden { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionHiddenOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionHiddenOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionHiddenOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionHiddenOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionHidden { - type View<'a> = SessionHiddenView<'a>; - type ViewHandle = SessionHiddenOwnedView; -} -impl ::serde::Serialize for SessionHiddenOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_hidden.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_hidden.rs deleted file mode 100644 index 508c14a3a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_hidden.rs +++ /dev/null @@ -1,306 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_hidden.proto - -/// SessionHiddenReason is why a session was hidden from default surfaces. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum SessionHiddenReason { - SESSION_HIDDEN_REASON_UNSPECIFIED = 0i32, - /// An explicit user request to remove the session from view. - SESSION_HIDDEN_REASON_USER_REQUESTED = 1i32, - /// Applied by a retention policy rather than a direct user request. - SESSION_HIDDEN_REASON_RETENTION_POLICY = 2i32, -} -impl SessionHiddenReason { - ///Idiomatic alias for [`Self::SESSION_HIDDEN_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::SESSION_HIDDEN_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::SESSION_HIDDEN_REASON_USER_REQUESTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const UserRequested: Self = Self::SESSION_HIDDEN_REASON_USER_REQUESTED; - ///Idiomatic alias for [`Self::SESSION_HIDDEN_REASON_RETENTION_POLICY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const RetentionPolicy: Self = Self::SESSION_HIDDEN_REASON_RETENTION_POLICY; -} -impl ::core::default::Default for SessionHiddenReason { - fn default() -> Self { - Self::SESSION_HIDDEN_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for SessionHiddenReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for SessionHiddenReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = SessionHiddenReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(SessionHiddenReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionHiddenReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for SessionHiddenReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::SESSION_HIDDEN_REASON_UNSPECIFIED), - 1i32 => { - ::core::option::Option::Some(Self::SESSION_HIDDEN_REASON_USER_REQUESTED) - } - 2i32 => { - ::core::option::Option::Some( - Self::SESSION_HIDDEN_REASON_RETENTION_POLICY, - ) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::SESSION_HIDDEN_REASON_UNSPECIFIED => { - "SESSION_HIDDEN_REASON_UNSPECIFIED" - } - Self::SESSION_HIDDEN_REASON_USER_REQUESTED => { - "SESSION_HIDDEN_REASON_USER_REQUESTED" - } - Self::SESSION_HIDDEN_REASON_RETENTION_POLICY => { - "SESSION_HIDDEN_REASON_RETENTION_POLICY" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "SESSION_HIDDEN_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::SESSION_HIDDEN_REASON_UNSPECIFIED) - } - "SESSION_HIDDEN_REASON_USER_REQUESTED" => { - ::core::option::Option::Some(Self::SESSION_HIDDEN_REASON_USER_REQUESTED) - } - "SESSION_HIDDEN_REASON_RETENTION_POLICY" => { - ::core::option::Option::Some( - Self::SESSION_HIDDEN_REASON_RETENTION_POLICY, - ) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::SESSION_HIDDEN_REASON_UNSPECIFIED, - Self::SESSION_HIDDEN_REASON_USER_REQUESTED, - Self::SESSION_HIDDEN_REASON_RETENTION_POLICY, - ] - } -} -/// SessionHidden is the terminal visibility-tombstone marker for a session: it -/// removes the session from every default surface and still cascades as a -/// terminal marker, but -- unlike its former name SessionDeleted -- it does not -/// promise erasure the log does not perform; the log is never physically purged -/// (ADR#0035 facet 2, facet 7). Legal or user erasure beyond masking is a named -/// follow-up ADR (D7); the interim story is RedactionApplied plus -/// ArtifactErased. It is an invariant-bearing transition guarded by -/// WRITE_PRECONDITION = At(current_position). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionHidden { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for SessionHidden { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionHidden") - .field("session_id", &self.session_id) - .field("reason", &self.reason) - .finish() - } -} -impl SessionHidden { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionHidden"; -} -::buffa::impl_default_instance!(SessionHidden); -impl ::buffa::MessageName for SessionHidden { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionHidden"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionHidden"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionHidden"; -} -impl ::buffa::Message for SessionHidden { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.reason.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.reason = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionHidden { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_HIDDEN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionHidden", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_ordinal.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_ordinal.__view.rs deleted file mode 100644 index 941f5c762..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_ordinal.__view.rs +++ /dev/null @@ -1,265 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_ordinal.proto - -/// SessionOrdinal is a logical position on one session's own logical stream: -/// the 1-indexed position of an event in that subject's append order. It is -/// derived by counting events at fold time, never read from JetStream message -/// metadata, so it is stable across restore, backfill, migration, and -/// cold-tier relocation, which reassign physical stream sequences without -/// rewriting event bytes (ADR#0013). A payload field of this type always -/// references an already-appended event's position, never a predicted future -/// position. -#[derive(Clone, Debug, Default)] -pub struct SessionOrdinalView<'a> { - /// Field 1: `value` - pub value: u64, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, - #[doc(hidden)] - pub __buffa_phantom: ::core::marker::PhantomData<&'a ()>, -} -impl<'a> SessionOrdinalView<'a> { - /**Whether required field `value` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_value(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SessionOrdinalView<'a> { - type Owned = super::super::SessionOrdinal; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.value = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionOrdinal { - value: self.value, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionOrdinalView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.value) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.value, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionOrdinalView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "value", - &::buffa::json_helpers::ProtoJson(&self.value), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionOrdinalView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionOrdinal"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionOrdinal"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionOrdinal"; -} -::buffa::impl_default_view_instance!(SessionOrdinalView); -::buffa::impl_view_reborrow!(SessionOrdinalView); -/** Self-contained, `'static` owned view of a `SessionOrdinal` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionOrdinalView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionOrdinalView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionOrdinalOwnedView(::buffa::OwnedView>); -impl SessionOrdinalOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionOrdinalOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionOrdinalOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionOrdinal, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionOrdinalOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionOrdinalView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionOrdinalView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionOrdinal { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `value` - #[must_use] - pub fn value(&self) -> u64 { - self.0.reborrow().value - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionOrdinalOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionOrdinalOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionOrdinalOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionOrdinalOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionOrdinal { - type View<'a> = SessionOrdinalView<'a>; - type ViewHandle = SessionOrdinalOwnedView; -} -impl ::serde::Serialize for SessionOrdinalOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_ordinal.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_ordinal.rs deleted file mode 100644 index f60fb6b52..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_ordinal.rs +++ /dev/null @@ -1,111 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_ordinal.proto - -/// SessionOrdinal is a logical position on one session's own logical stream: -/// the 1-indexed position of an event in that subject's append order. It is -/// derived by counting events at fold time, never read from JetStream message -/// metadata, so it is stable across restore, backfill, migration, and -/// cold-tier relocation, which reassign physical stream sequences without -/// rewriting event bytes (ADR#0013). A payload field of this type always -/// references an already-appended event's position, never a predicted future -/// position. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionOrdinal { - /// Field 1: `value` - #[serde(rename = "value", with = "::buffa::json_helpers::uint64")] - pub value: u64, -} -impl ::core::fmt::Debug for SessionOrdinal { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionOrdinal").field("value", &self.value).finish() - } -} -impl SessionOrdinal { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionOrdinal"; -} -::buffa::impl_default_instance!(SessionOrdinal); -impl ::buffa::MessageName for SessionOrdinal { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionOrdinal"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionOrdinal"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionOrdinal"; -} -impl ::buffa::Message for SessionOrdinal { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.value) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_uint64_field(1u32, self.value, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.value = ::buffa::types::decode_uint64(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.value = 0u64; - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionOrdinal { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_ORDINAL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionOrdinal", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_recovered.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_recovered.__view.rs deleted file mode 100644 index 504b056a2..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_recovered.__view.rs +++ /dev/null @@ -1,566 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_recovered.proto - -/// SessionRecovered is the second event in the atomic -/// \[SessionStarted, SessionRecovered\] creation batch appended to a salvaged -/// session's subject under the NoStream precondition, making salvage creation -/// atomic and exactly-once (ADR#0035 facet 2). -/// -/// It exists as an event rather than only as a maintenance record because a -/// reader folding this stream alone must be able to tell that this session is a -/// copy of a damaged one. A projection is rebuilt from the stream, so provenance -/// that lived only in an operator-side journal would be lost on the next rebuild -/// and the session would then read as an ordinary session with a short history. -/// -/// This is not SessionForked. A fork inherits its source by reference within -/// context_prefix_boundary and depends on the source staying readable; a -/// recovery copies, because the source's readability is the thing that failed. -/// The copied events are this session's own events at this session's own -/// ordinals: source ordinals do not carry over, and source_boundary is -/// provenance, not an index into this stream. -#[derive(Clone, Debug, Default)] -pub struct SessionRecoveredView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `source_session_id` - pub source_session_id: &'a str, - /// The last source-stream ordinal the salvage drew from. - /// - /// Field 3: `source_boundary` - pub source_boundary: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Digest of the source cut, over the source's stored bytes. Binds this - /// session to exactly what was read, so a later salvage of the same source can - /// be told apart from a retry of this one. - /// - /// Field 4: `source_digest` - pub source_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// The salvage operation that produced this session, so the record holding the - /// enumerated omissions can be found from the session alone. - /// - /// Field 5: `salvage_key` - pub salvage_key: &'a str, - /// Field 6: `completeness` - pub completeness: ::buffa::EnumValue, - /// How many source items could not be carried. The enumeration lives in the - /// salvage record; the count lives here because a fold of this stream must be - /// able to conclude the session is incomplete without an operator-side lookup - /// that may not be available. - /// - /// Field 7: `omitted_count` - pub omitted_count: u32, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionRecoveredView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `source_session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `source_boundary` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_boundary(&self) -> bool { - self.source_boundary.is_set() - } - /**Whether required field `source_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source_digest(&self) -> bool { - self.source_digest.is_set() - } - /**Whether required field `salvage_key` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_salvage_key(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `completeness` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_completeness(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `omitted_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_omitted_count(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SessionRecoveredView<'a> { - type Owned = super::super::SessionRecovered; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source_session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.source_boundary.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.source_boundary = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.source_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.source_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.salvage_key = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.completeness = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 8u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.omitted_count = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionRecovered { - session_id: self.session_id.to_string(), - source_session_id: self.source_session_id.to_string(), - source_boundary: match self.source_boundary.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - source_digest: match self.source_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - salvage_key: self.salvage_key.to_string(), - completeness: self.completeness, - omitted_count: self.omitted_count, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionRecoveredView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.source_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.source_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.salvage_key) as u64; - { - let val = self.completeness.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.omitted_count) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.source_session_id, buf); - if self.source_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_boundary.write_to(__cache, buf); - } - if self.source_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(5u32, &self.salvage_key, buf); - ::buffa::types::put_int32_field(6u32, self.completeness.to_i32(), buf); - ::buffa::types::put_uint32_field(7u32, self.omitted_count, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionRecoveredView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("sourceSessionId", self.source_session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.source_boundary.as_option() { - __map.serialize_entry("sourceBoundary", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.source_digest.as_option() { - __map.serialize_entry("sourceDigest", __v)?; - } - } - { - __map.serialize_entry("salvageKey", self.salvage_key)?; - } - { - __map.serialize_entry("completeness", &self.completeness)?; - } - { - __map - .serialize_entry( - "omittedCount", - &::buffa::json_helpers::ProtoJson(&self.omitted_count), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionRecoveredView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionRecovered"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionRecovered"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionRecovered"; -} -::buffa::impl_default_view_instance!(SessionRecoveredView); -::buffa::impl_view_reborrow!(SessionRecoveredView); -/** Self-contained, `'static` owned view of a `SessionRecovered` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionRecoveredView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionRecoveredView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionRecoveredOwnedView(::buffa::OwnedView>); -impl SessionRecoveredOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionRecoveredOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionRecoveredOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionRecovered, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionRecoveredOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionRecoveredView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionRecoveredView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionRecovered { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `source_session_id` - #[must_use] - pub fn source_session_id(&self) -> &'_ str { - self.0.reborrow().source_session_id - } - /// The last source-stream ordinal the salvage drew from. - /// - /// Field 3: `source_boundary` - #[must_use] - pub fn source_boundary( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().source_boundary - } - /// Digest of the source cut, over the source's stored bytes. Binds this - /// session to exactly what was read, so a later salvage of the same source can - /// be told apart from a retry of this one. - /// - /// Field 4: `source_digest` - #[must_use] - pub fn source_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().source_digest - } - /// The salvage operation that produced this session, so the record holding the - /// enumerated omissions can be found from the session alone. - /// - /// Field 5: `salvage_key` - #[must_use] - pub fn salvage_key(&self) -> &'_ str { - self.0.reborrow().salvage_key - } - /// Field 6: `completeness` - #[must_use] - pub fn completeness( - &self, - ) -> ::buffa::EnumValue { - self.0.reborrow().completeness - } - /// How many source items could not be carried. The enumeration lives in the - /// salvage record; the count lives here because a fold of this stream must be - /// able to conclude the session is incomplete without an operator-side lookup - /// that may not be available. - /// - /// Field 7: `omitted_count` - #[must_use] - pub fn omitted_count(&self) -> u32 { - self.0.reborrow().omitted_count - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionRecoveredOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionRecoveredOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionRecoveredOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionRecoveredOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionRecovered { - type View<'a> = SessionRecoveredView<'a>; - type ViewHandle = SessionRecoveredOwnedView; -} -impl ::serde::Serialize for SessionRecoveredOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_recovered.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_recovered.rs deleted file mode 100644 index fe7512a79..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_recovered.rs +++ /dev/null @@ -1,439 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_recovered.proto - -/// RecoveryCompleteness is how much of the source this session carries. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum RecoveryCompleteness { - RECOVERY_COMPLETENESS_UNSPECIFIED = 0i32, - /// Every source event decoded and every referenced artifact verified. - RECOVERY_COMPLETENESS_COMPLETE = 1i32, - /// Items are missing. A reader must not present this session as the original. - RECOVERY_COMPLETENESS_PARTIAL = 2i32, -} -impl RecoveryCompleteness { - ///Idiomatic alias for [`Self::RECOVERY_COMPLETENESS_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::RECOVERY_COMPLETENESS_UNSPECIFIED; - ///Idiomatic alias for [`Self::RECOVERY_COMPLETENESS_COMPLETE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Complete: Self = Self::RECOVERY_COMPLETENESS_COMPLETE; - ///Idiomatic alias for [`Self::RECOVERY_COMPLETENESS_PARTIAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Partial: Self = Self::RECOVERY_COMPLETENESS_PARTIAL; -} -impl ::core::default::Default for RecoveryCompleteness { - fn default() -> Self { - Self::RECOVERY_COMPLETENESS_UNSPECIFIED - } -} -impl ::serde::Serialize for RecoveryCompleteness { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for RecoveryCompleteness { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = RecoveryCompleteness; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(RecoveryCompleteness) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for RecoveryCompleteness { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for RecoveryCompleteness { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::RECOVERY_COMPLETENESS_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::RECOVERY_COMPLETENESS_COMPLETE), - 2i32 => ::core::option::Option::Some(Self::RECOVERY_COMPLETENESS_PARTIAL), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::RECOVERY_COMPLETENESS_UNSPECIFIED => { - "RECOVERY_COMPLETENESS_UNSPECIFIED" - } - Self::RECOVERY_COMPLETENESS_COMPLETE => "RECOVERY_COMPLETENESS_COMPLETE", - Self::RECOVERY_COMPLETENESS_PARTIAL => "RECOVERY_COMPLETENESS_PARTIAL", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "RECOVERY_COMPLETENESS_UNSPECIFIED" => { - ::core::option::Option::Some(Self::RECOVERY_COMPLETENESS_UNSPECIFIED) - } - "RECOVERY_COMPLETENESS_COMPLETE" => { - ::core::option::Option::Some(Self::RECOVERY_COMPLETENESS_COMPLETE) - } - "RECOVERY_COMPLETENESS_PARTIAL" => { - ::core::option::Option::Some(Self::RECOVERY_COMPLETENESS_PARTIAL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::RECOVERY_COMPLETENESS_UNSPECIFIED, - Self::RECOVERY_COMPLETENESS_COMPLETE, - Self::RECOVERY_COMPLETENESS_PARTIAL, - ] - } -} -/// SessionRecovered is the second event in the atomic -/// \[SessionStarted, SessionRecovered\] creation batch appended to a salvaged -/// session's subject under the NoStream precondition, making salvage creation -/// atomic and exactly-once (ADR#0035 facet 2). -/// -/// It exists as an event rather than only as a maintenance record because a -/// reader folding this stream alone must be able to tell that this session is a -/// copy of a damaged one. A projection is rebuilt from the stream, so provenance -/// that lived only in an operator-side journal would be lost on the next rebuild -/// and the session would then read as an ordinary session with a short history. -/// -/// This is not SessionForked. A fork inherits its source by reference within -/// context_prefix_boundary and depends on the source staying readable; a -/// recovery copies, because the source's readability is the thing that failed. -/// The copied events are this session's own events at this session's own -/// ordinals: source ordinals do not carry over, and source_boundary is -/// provenance, not an index into this stream. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionRecovered { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `source_session_id` - #[serde( - rename = "sourceSessionId", - alias = "source_session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub source_session_id: ::buffa::alloc::string::String, - /// The last source-stream ordinal the salvage drew from. - /// - /// Field 3: `source_boundary` - #[serde(rename = "sourceBoundary", alias = "source_boundary")] - pub source_boundary: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Digest of the source cut, over the source's stored bytes. Binds this - /// session to exactly what was read, so a later salvage of the same source can - /// be told apart from a retry of this one. - /// - /// Field 4: `source_digest` - #[serde(rename = "sourceDigest", alias = "source_digest")] - pub source_digest: ::buffa::MessageField>, - /// The salvage operation that produced this session, so the record holding the - /// enumerated omissions can be found from the session alone. - /// - /// Field 5: `salvage_key` - #[serde( - rename = "salvageKey", - alias = "salvage_key", - with = "::buffa::json_helpers::proto_string" - )] - pub salvage_key: ::buffa::alloc::string::String, - /// Field 6: `completeness` - #[serde(rename = "completeness", with = "::buffa::json_helpers::proto_enum")] - pub completeness: ::buffa::EnumValue, - /// How many source items could not be carried. The enumeration lives in the - /// salvage record; the count lives here because a fold of this stream must be - /// able to conclude the session is incomplete without an operator-side lookup - /// that may not be available. - /// - /// Field 7: `omitted_count` - #[serde( - rename = "omittedCount", - alias = "omitted_count", - with = "::buffa::json_helpers::uint32" - )] - pub omitted_count: u32, -} -impl ::core::fmt::Debug for SessionRecovered { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionRecovered") - .field("session_id", &self.session_id) - .field("source_session_id", &self.source_session_id) - .field("source_boundary", &self.source_boundary) - .field("source_digest", &self.source_digest) - .field("salvage_key", &self.salvage_key) - .field("completeness", &self.completeness) - .field("omitted_count", &self.omitted_count) - .finish() - } -} -impl SessionRecovered { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionRecovered"; -} -::buffa::impl_default_instance!(SessionRecovered); -impl ::buffa::MessageName for SessionRecovered { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionRecovered"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionRecovered"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionRecovered"; -} -impl ::buffa::Message for SessionRecovered { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.source_session_id) as u64; - if self.source_boundary.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_boundary.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.source_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.source_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.salvage_key) as u64; - { - let val = self.completeness.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.omitted_count) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.source_session_id, buf); - if self.source_boundary.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_boundary.write_to(__cache, buf); - } - if self.source_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.source_digest.write_to(__cache, buf); - } - ::buffa::types::put_string_field(5u32, &self.salvage_key, buf); - ::buffa::types::put_int32_field(6u32, self.completeness.to_i32(), buf); - ::buffa::types::put_uint32_field(7u32, self.omitted_count, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.source_session_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.source_boundary.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.source_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.salvage_key, buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.completeness = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.omitted_count = ::buffa::types::decode_uint32(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.source_session_id.clear(); - self.source_boundary = ::buffa::MessageField::none(); - self.source_digest = ::buffa::MessageField::none(); - self.salvage_key.clear(); - self.completeness = ::buffa::EnumValue::from(0); - self.omitted_count = 0u32; - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionRecovered { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_RECOVERED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionRecovered", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_renamed.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_renamed.__view.rs deleted file mode 100644 index 298ccb2c7..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_renamed.__view.rs +++ /dev/null @@ -1,283 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_renamed.proto - -/// SessionRenamed records a change to the session's display name: reversible -/// organization state, distinct from the terminal SessionHidden (D11). It is a -/// commuting happened-fact (WRITE_PRECONDITION = Any). -#[derive(Clone, Debug, Default)] -pub struct SessionRenamedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `display_name` - pub display_name: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionRenamedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `display_name` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_display_name(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SessionRenamedView<'a> { - type Owned = super::super::SessionRenamed; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.display_name = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionRenamed { - session_id: self.session_id.to_string(), - display_name: self.display_name.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionRenamedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.display_name) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.display_name, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionRenamedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("displayName", self.display_name)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionRenamedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionRenamed"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionRenamed"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionRenamed"; -} -::buffa::impl_default_view_instance!(SessionRenamedView); -::buffa::impl_view_reborrow!(SessionRenamedView); -/** Self-contained, `'static` owned view of a `SessionRenamed` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionRenamedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionRenamedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionRenamedOwnedView(::buffa::OwnedView>); -impl SessionRenamedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionRenamedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionRenamedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionRenamed, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionRenamedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionRenamedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionRenamedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionRenamed { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `display_name` - #[must_use] - pub fn display_name(&self) -> &'_ str { - self.0.reborrow().display_name - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionRenamedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionRenamedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionRenamedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionRenamedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionRenamed { - type View<'a> = SessionRenamedView<'a>; - type ViewHandle = SessionRenamedOwnedView; -} -impl ::serde::Serialize for SessionRenamedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_renamed.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_renamed.rs deleted file mode 100644 index 0a5628758..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_renamed.rs +++ /dev/null @@ -1,130 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_renamed.proto - -/// SessionRenamed records a change to the session's display name: reversible -/// organization state, distinct from the terminal SessionHidden (D11). It is a -/// commuting happened-fact (WRITE_PRECONDITION = Any). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionRenamed { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `display_name` - #[serde( - rename = "displayName", - alias = "display_name", - with = "::buffa::json_helpers::proto_string" - )] - pub display_name: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for SessionRenamed { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionRenamed") - .field("session_id", &self.session_id) - .field("display_name", &self.display_name) - .finish() - } -} -impl SessionRenamed { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionRenamed"; -} -::buffa::impl_default_instance!(SessionRenamed); -impl ::buffa::MessageName for SessionRenamed { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionRenamed"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionRenamed"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionRenamed"; -} -impl ::buffa::Message for SessionRenamed { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.display_name) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.display_name, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.display_name, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.display_name.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionRenamed { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_RENAMED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionRenamed", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_rewound.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_rewound.__view.rs deleted file mode 100644 index 1fcccc935..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_rewound.__view.rs +++ /dev/null @@ -1,372 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_rewound.proto - -/// SessionRewound records a retroactive rewind as a new event, never an edit of -/// stored events; keep_through is the inclusive kept boundary on this session's -/// own stream, so events \[1..keep_through\] remain valid. Children whose -/// ParentLinked.parent_dispatched_at is strictly greater than keep_through are -/// invalidated by the reconciler's atomic \[ParentHistoryInvalidated, -/// SessionCancelled{reason = PARENT_REWIND_CASCADE}\] batch when their -/// cascade_policy is CASCADE_ON_PARENT_TERMINAL; children dispatched at or -/// before the boundary survive untouched (ADR#0035 facet 6). It is an -/// invariant-bearing transition guarded by WRITE_PRECONDITION = At(current_position). -#[derive(Clone, Debug, Default)] -pub struct SessionRewoundView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `keep_through` - pub keep_through: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Why the rewind happened; a command-time input not derivable from the log, - /// mirroring ForkReason and CompactionTrigger. - /// - /// Field 3: `reason` - pub reason: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionRewoundView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `keep_through` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_keep_through(&self) -> bool { - self.keep_through.is_set() - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SessionRewoundView<'a> { - type Owned = super::super::SessionRewound; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.keep_through.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.keep_through = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionRewound { - session_id: self.session_id.to_string(), - keep_through: match self.keep_through.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - reason: self.reason, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionRewoundView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.keep_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.keep_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.keep_through.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.keep_through.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.reason.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionRewoundView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.keep_through.as_option() { - __map.serialize_entry("keepThrough", __v)?; - } - } - { - __map.serialize_entry("reason", &self.reason)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionRewoundView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionRewound"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionRewound"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionRewound"; -} -::buffa::impl_default_view_instance!(SessionRewoundView); -::buffa::impl_view_reborrow!(SessionRewoundView); -/** Self-contained, `'static` owned view of a `SessionRewound` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionRewoundView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionRewoundView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionRewoundOwnedView(::buffa::OwnedView>); -impl SessionRewoundOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionRewoundOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionRewoundOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionRewound, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionRewoundOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionRewoundView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionRewoundView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionRewound { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `keep_through` - #[must_use] - pub fn keep_through( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().keep_through - } - /// Why the rewind happened; a command-time input not derivable from the log, - /// mirroring ForkReason and CompactionTrigger. - /// - /// Field 3: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionRewoundOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionRewoundOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionRewoundOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionRewoundOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionRewound { - type View<'a> = SessionRewoundView<'a>; - type ViewHandle = SessionRewoundOwnedView; -} -impl ::serde::Serialize for SessionRewoundOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_rewound.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_rewound.rs deleted file mode 100644 index 05037e75a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_rewound.rs +++ /dev/null @@ -1,339 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_rewound.proto - -/// RewindReason is why a session was rewound. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum RewindReason { - REWIND_REASON_UNSPECIFIED = 0i32, - /// An explicit user rewind/undo. - REWIND_REASON_MANUAL = 1i32, - /// A message was edited and the turn re-sent from that point. - REWIND_REASON_EDIT_AND_RESEND = 2i32, - /// A retry of a turn from an earlier point. - REWIND_REASON_RETRY = 3i32, -} -impl RewindReason { - ///Idiomatic alias for [`Self::REWIND_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::REWIND_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::REWIND_REASON_MANUAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Manual: Self = Self::REWIND_REASON_MANUAL; - ///Idiomatic alias for [`Self::REWIND_REASON_EDIT_AND_RESEND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const EditAndResend: Self = Self::REWIND_REASON_EDIT_AND_RESEND; - ///Idiomatic alias for [`Self::REWIND_REASON_RETRY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Retry: Self = Self::REWIND_REASON_RETRY; -} -impl ::core::default::Default for RewindReason { - fn default() -> Self { - Self::REWIND_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for RewindReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for RewindReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = RewindReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(RewindReason)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for RewindReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for RewindReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::REWIND_REASON_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::REWIND_REASON_MANUAL), - 2i32 => ::core::option::Option::Some(Self::REWIND_REASON_EDIT_AND_RESEND), - 3i32 => ::core::option::Option::Some(Self::REWIND_REASON_RETRY), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::REWIND_REASON_UNSPECIFIED => "REWIND_REASON_UNSPECIFIED", - Self::REWIND_REASON_MANUAL => "REWIND_REASON_MANUAL", - Self::REWIND_REASON_EDIT_AND_RESEND => "REWIND_REASON_EDIT_AND_RESEND", - Self::REWIND_REASON_RETRY => "REWIND_REASON_RETRY", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "REWIND_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::REWIND_REASON_UNSPECIFIED) - } - "REWIND_REASON_MANUAL" => { - ::core::option::Option::Some(Self::REWIND_REASON_MANUAL) - } - "REWIND_REASON_EDIT_AND_RESEND" => { - ::core::option::Option::Some(Self::REWIND_REASON_EDIT_AND_RESEND) - } - "REWIND_REASON_RETRY" => { - ::core::option::Option::Some(Self::REWIND_REASON_RETRY) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::REWIND_REASON_UNSPECIFIED, - Self::REWIND_REASON_MANUAL, - Self::REWIND_REASON_EDIT_AND_RESEND, - Self::REWIND_REASON_RETRY, - ] - } -} -/// SessionRewound records a retroactive rewind as a new event, never an edit of -/// stored events; keep_through is the inclusive kept boundary on this session's -/// own stream, so events \[1..keep_through\] remain valid. Children whose -/// ParentLinked.parent_dispatched_at is strictly greater than keep_through are -/// invalidated by the reconciler's atomic \[ParentHistoryInvalidated, -/// SessionCancelled{reason = PARENT_REWIND_CASCADE}\] batch when their -/// cascade_policy is CASCADE_ON_PARENT_TERMINAL; children dispatched at or -/// before the boundary survive untouched (ADR#0035 facet 6). It is an -/// invariant-bearing transition guarded by WRITE_PRECONDITION = At(current_position). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionRewound { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `keep_through` - #[serde(rename = "keepThrough", alias = "keep_through")] - pub keep_through: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Why the rewind happened; a command-time input not derivable from the log, - /// mirroring ForkReason and CompactionTrigger. - /// - /// Field 3: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for SessionRewound { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionRewound") - .field("session_id", &self.session_id) - .field("keep_through", &self.keep_through) - .field("reason", &self.reason) - .finish() - } -} -impl SessionRewound { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionRewound"; -} -::buffa::impl_default_instance!(SessionRewound); -impl ::buffa::MessageName for SessionRewound { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionRewound"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionRewound"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionRewound"; -} -impl ::buffa::Message for SessionRewound { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.keep_through.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.keep_through.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.keep_through.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.keep_through.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.reason.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.keep_through.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.keep_through = ::buffa::MessageField::none(); - self.reason = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionRewound { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_REWOUND_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionRewound", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_started.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_started.__view.rs deleted file mode 100644 index 932379545..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_started.__view.rs +++ /dev/null @@ -1,411 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_started.proto - -/// SessionStarted is the creation fact for a session's logical stream and stores -/// the immutable StoredSessionExecutionPlan exactly once (ADR#0031 §6). The -/// plan's working directory is immutable for the life of the session and -/// bound to this plan; changing it requires a new session or a fork (D11). It -/// is always the first event in a NoStream creation batch: alone for -/// CreateSession, as \[SessionStarted, SessionForked\] for ForkSession (D2), or -/// as \[SessionStarted, ParentLinked\] for a delegated child (D5) -- every case -/// making creation atomic and exactly-once (ADR#0035 facet 2). -#[derive(Clone, Debug, Default)] -pub struct SessionStartedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `execution_plan` - pub execution_plan: ::buffa::MessageFieldView< - super::super::__buffa::view::StoredSessionExecutionPlanView<'a>, - >, - /// Workspace this session is bound to, carried inline so workspace-scoped - /// reads never decode plan_bytes. It must agree with the plan's working - /// directory; this field is the projection surface, the plan stays - /// authoritative. - /// - /// Field 3: `workspace` - pub workspace: ::buffa::MessageFieldView< - super::super::__buffa::view::WorkspaceRefView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionStartedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `execution_plan` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_execution_plan(&self) -> bool { - self.execution_plan.is_set() - } - /**Whether required field `workspace` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_workspace(&self) -> bool { - self.workspace.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for SessionStartedView<'a> { - type Owned = super::super::SessionStarted; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.execution_plan.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.execution_plan = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.workspace.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.workspace = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionStarted { - session_id: self.session_id.to_string(), - execution_plan: match self.execution_plan.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::StoredSessionExecutionPlan, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - workspace: match self.workspace.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::WorkspaceRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionStartedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.execution_plan.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.execution_plan.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.workspace.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.workspace.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.execution_plan.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.execution_plan.write_to(__cache, buf); - } - if self.workspace.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.workspace.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionStartedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.execution_plan.as_option() { - __map.serialize_entry("executionPlan", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.workspace.as_option() { - __map.serialize_entry("workspace", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionStartedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionStarted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionStarted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionStarted"; -} -::buffa::impl_default_view_instance!(SessionStartedView); -::buffa::impl_view_reborrow!(SessionStartedView); -/** Self-contained, `'static` owned view of a `SessionStarted` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionStartedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionStartedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionStartedOwnedView(::buffa::OwnedView>); -impl SessionStartedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionStartedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionStartedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionStarted, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionStartedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionStartedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionStartedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionStarted { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `execution_plan` - #[must_use] - pub fn execution_plan( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::StoredSessionExecutionPlanView<'_>, - > { - &self.0.reborrow().execution_plan - } - /// Workspace this session is bound to, carried inline so workspace-scoped - /// reads never decode plan_bytes. It must agree with the plan's working - /// directory; this field is the projection surface, the plan stays - /// authoritative. - /// - /// Field 3: `workspace` - #[must_use] - pub fn workspace( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().workspace - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionStartedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionStartedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionStartedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionStartedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionStarted { - type View<'a> = SessionStartedView<'a>; - type ViewHandle = SessionStartedOwnedView; -} -impl ::serde::Serialize for SessionStartedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_started.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_started.rs deleted file mode 100644 index 86c3d3ca6..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_started.rs +++ /dev/null @@ -1,189 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_started.proto - -/// SessionStarted is the creation fact for a session's logical stream and stores -/// the immutable StoredSessionExecutionPlan exactly once (ADR#0031 §6). The -/// plan's working directory is immutable for the life of the session and -/// bound to this plan; changing it requires a new session or a fork (D11). It -/// is always the first event in a NoStream creation batch: alone for -/// CreateSession, as \[SessionStarted, SessionForked\] for ForkSession (D2), or -/// as \[SessionStarted, ParentLinked\] for a delegated child (D5) -- every case -/// making creation atomic and exactly-once (ADR#0035 facet 2). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionStarted { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `execution_plan` - #[serde(rename = "executionPlan", alias = "execution_plan")] - pub execution_plan: ::buffa::MessageField< - StoredSessionExecutionPlan, - ::buffa::Inline, - >, - /// Workspace this session is bound to, carried inline so workspace-scoped - /// reads never decode plan_bytes. It must agree with the plan's working - /// directory; this field is the projection surface, the plan stays - /// authoritative. - /// - /// Field 3: `workspace` - #[serde(rename = "workspace")] - pub workspace: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for SessionStarted { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionStarted") - .field("session_id", &self.session_id) - .field("execution_plan", &self.execution_plan) - .field("workspace", &self.workspace) - .finish() - } -} -impl SessionStarted { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionStarted"; -} -::buffa::impl_default_instance!(SessionStarted); -impl ::buffa::MessageName for SessionStarted { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionStarted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionStarted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionStarted"; -} -impl ::buffa::Message for SessionStarted { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.execution_plan.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.execution_plan.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.workspace.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.workspace.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.execution_plan.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.execution_plan.write_to(__cache, buf); - } - if self.workspace.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.workspace.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.execution_plan.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.workspace.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.execution_plan = ::buffa::MessageField::none(); - self.workspace = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionStarted { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_STARTED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionStarted", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_unarchived.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_unarchived.__view.rs deleted file mode 100644 index 30528b52d..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_unarchived.__view.rs +++ /dev/null @@ -1,257 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_unarchived.proto - -/// SessionUnarchived reverses a prior SessionArchived, restoring a session to -/// the default listing view: reversible organization state, distinct from the -/// terminal SessionHidden (D11). It is a commuting happened-fact -/// (WRITE_PRECONDITION = Any). -#[derive(Clone, Debug, Default)] -pub struct SessionUnarchivedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SessionUnarchivedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SessionUnarchivedView<'a> { - type Owned = super::super::SessionUnarchived; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SessionUnarchived { - session_id: self.session_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SessionUnarchivedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SessionUnarchivedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SessionUnarchivedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionUnarchived"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionUnarchived"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionUnarchived"; -} -::buffa::impl_default_view_instance!(SessionUnarchivedView); -::buffa::impl_view_reborrow!(SessionUnarchivedView); -/** Self-contained, `'static` owned view of a `SessionUnarchived` message. - - Wraps [`::buffa::OwnedView`]`<`[`SessionUnarchivedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SessionUnarchivedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SessionUnarchivedOwnedView( - ::buffa::OwnedView>, -); -impl SessionUnarchivedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionUnarchivedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionUnarchivedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SessionUnarchived, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SessionUnarchivedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SessionUnarchivedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SessionUnarchivedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SessionUnarchived { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SessionUnarchivedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SessionUnarchivedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SessionUnarchivedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SessionUnarchivedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SessionUnarchived { - type View<'a> = SessionUnarchivedView<'a>; - type ViewHandle = SessionUnarchivedOwnedView; -} -impl ::serde::Serialize for SessionUnarchivedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_unarchived.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_unarchived.rs deleted file mode 100644 index 5690b42f1..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.session_unarchived.rs +++ /dev/null @@ -1,113 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/session_unarchived.proto - -/// SessionUnarchived reverses a prior SessionArchived, restoring a session to -/// the default listing view: reversible organization state, distinct from the -/// terminal SessionHidden (D11). It is a commuting happened-fact -/// (WRITE_PRECONDITION = Any). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SessionUnarchived { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for SessionUnarchived { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SessionUnarchived") - .field("session_id", &self.session_id) - .finish() - } -} -impl SessionUnarchived { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionUnarchived"; -} -::buffa::impl_default_instance!(SessionUnarchived); -impl ::buffa::MessageName for SessionUnarchived { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SessionUnarchived"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SessionUnarchived"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionUnarchived"; -} -impl ::buffa::Message for SessionUnarchived { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SessionUnarchived { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SESSION_UNARCHIVED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SessionUnarchived", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_assistant_message.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_assistant_message.__view.rs deleted file mode 100644 index 3737a580d..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_assistant_message.__view.rs +++ /dev/null @@ -1,423 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/start_assistant_message.proto - -/// StartAssistantMessage opens an assistant turn, recording -/// \[AssistantMessageStarted\]. Streamed token deltas are delivered out of band -/// and never appended per token. -/// -/// Write precondition Any. -#[derive(Clone, Debug, Default)] -pub struct StartAssistantMessageView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `message_id` - pub message_id: &'a str, - /// Carried so a replay reproduces the request that was made, not the - /// request today's defaults would produce. - /// - /// Field 3: `model` - pub model: &'a str, - /// Field 4: `turn_id` - pub turn_id: &'a str, - /// Unset when every setting was left at the provider default. - /// - /// Field 5: `settings` - pub settings: ::buffa::MessageFieldView< - super::super::__buffa::view::ModelSettingsView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> StartAssistantMessageView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `message_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `model` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_model(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for StartAssistantMessageView<'a> { - type Owned = super::super::StartAssistantMessage; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.message_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.model = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.settings.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.settings = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::StartAssistantMessage, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::StartAssistantMessage, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::StartAssistantMessage { - session_id: self.session_id.to_string(), - message_id: self.message_id.to_string(), - model: self.model.to_string(), - turn_id: self.turn_id.to_string(), - settings: match self.settings.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ModelSettings, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for StartAssistantMessageView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.model) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if self.settings.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.settings.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.message_id, buf); - ::buffa::types::put_string_field(3u32, &self.model, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - if self.settings.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.settings.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for StartAssistantMessageView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("messageId", self.message_id)?; - } - { - __map.serialize_entry("model", self.model)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.settings.as_option() { - __map.serialize_entry("settings", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for StartAssistantMessageView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "StartAssistantMessage"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.StartAssistantMessage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StartAssistantMessage"; -} -::buffa::impl_default_view_instance!(StartAssistantMessageView); -::buffa::impl_view_reborrow!(StartAssistantMessageView); -/** Self-contained, `'static` owned view of a `StartAssistantMessage` message. - - Wraps [`::buffa::OwnedView`]`<`[`StartAssistantMessageView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`StartAssistantMessageView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct StartAssistantMessageOwnedView( - ::buffa::OwnedView>, -); -impl StartAssistantMessageOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StartAssistantMessageOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StartAssistantMessageOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::StartAssistantMessage, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StartAssistantMessageOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`StartAssistantMessageView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &StartAssistantMessageView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::StartAssistantMessage { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `message_id` - #[must_use] - pub fn message_id(&self) -> &'_ str { - self.0.reborrow().message_id - } - /// Carried so a replay reproduces the request that was made, not the - /// request today's defaults would produce. - /// - /// Field 3: `model` - #[must_use] - pub fn model(&self) -> &'_ str { - self.0.reborrow().model - } - /// Field 4: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } - /// Unset when every setting was left at the provider default. - /// - /// Field 5: `settings` - #[must_use] - pub fn settings( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().settings - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for StartAssistantMessageOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - StartAssistantMessageOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: StartAssistantMessageOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for StartAssistantMessageOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::StartAssistantMessage { - type View<'a> = StartAssistantMessageView<'a>; - type ViewHandle = StartAssistantMessageOwnedView; -} -impl ::serde::Serialize for StartAssistantMessageOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_assistant_message.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_assistant_message.rs deleted file mode 100644 index ec047e917..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_assistant_message.rs +++ /dev/null @@ -1,204 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/start_assistant_message.proto - -/// StartAssistantMessage opens an assistant turn, recording -/// \[AssistantMessageStarted\]. Streamed token deltas are delivered out of band -/// and never appended per token. -/// -/// Write precondition Any. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct StartAssistantMessage { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `message_id` - #[serde( - rename = "messageId", - alias = "message_id", - with = "::buffa::json_helpers::proto_string" - )] - pub message_id: ::buffa::alloc::string::String, - /// Carried so a replay reproduces the request that was made, not the - /// request today's defaults would produce. - /// - /// Field 3: `model` - #[serde(rename = "model", with = "::buffa::json_helpers::proto_string")] - pub model: ::buffa::alloc::string::String, - /// Field 4: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, - /// Unset when every setting was left at the provider default. - /// - /// Field 5: `settings` - #[serde( - rename = "settings", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub settings: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for StartAssistantMessage { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("StartAssistantMessage") - .field("session_id", &self.session_id) - .field("message_id", &self.message_id) - .field("model", &self.model) - .field("turn_id", &self.turn_id) - .field("settings", &self.settings) - .finish() - } -} -impl StartAssistantMessage { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StartAssistantMessage"; -} -::buffa::impl_default_instance!(StartAssistantMessage); -impl ::buffa::MessageName for StartAssistantMessage { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "StartAssistantMessage"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.StartAssistantMessage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StartAssistantMessage"; -} -impl ::buffa::Message for StartAssistantMessage { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.message_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.model) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if self.settings.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.settings.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.message_id, buf); - ::buffa::types::put_string_field(3u32, &self.model, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - if self.settings.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.settings.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.message_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.model, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.settings.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.message_id.clear(); - self.model.clear(); - self.turn_id.clear(); - self.settings = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for StartAssistantMessage { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __START_ASSISTANT_MESSAGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.StartAssistantMessage", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_execution_attempt.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_execution_attempt.__view.rs deleted file mode 100644 index 7e176e958..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_execution_attempt.__view.rs +++ /dev/null @@ -1,736 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/start_execution_attempt.proto - -/// StartExecutionAttempt claims the session for a runner, recording -/// \[ExecutionAttemptStarted\]. -/// -/// Write precondition At: one active attempt at a time, monotonic attempt -/// numbers, and a restored checkpoint that exactly equals the first admitted -/// evidence for its id with no later redaction or erasure reaching at or before -/// its covers_through (ADR#0035 harness recovery). -#[derive(Clone, Debug, Default)] -pub struct StartExecutionAttemptView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `execution_attempt_id` - pub execution_attempt_id: &'a str, - /// Must equal the session's stored plan digest; a mismatch means the runner - /// is about to execute a different plan than the session was started with. - /// - /// Field 3: `session_execution_plan_digest` - pub session_execution_plan_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Field 4: `attempt_number` - pub attempt_number: u64, - /// Field 5: `previous_attempt_id` - pub previous_attempt_id: ::core::option::Option<&'a str>, - /// Unset when the attempt starts from scratch rather than restoring. - /// - /// Field 6: `restored_checkpoint` - pub restored_checkpoint: ::buffa::MessageFieldView< - super::super::__buffa::view::CheckpointView<'a>, - >, - /// Field 7: `host_artifact_ref` - pub host_artifact_ref: &'a str, - /// Field 8: `host_artifact_digest` - pub host_artifact_digest: ::buffa::MessageFieldView< - super::super::__buffa::view::DigestView<'a>, - >, - /// Field 9: `authenticated_remote_subject` - pub authenticated_remote_subject: ::core::option::Option<&'a str>, - /// Field 10: `isolation_placement` - pub isolation_placement: ::core::option::Option<&'a str>, - /// Supplied by the caller: deciding is deterministic and reads no clock. - /// - /// Field 11: `started_at` - pub started_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> StartExecutionAttemptView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `execution_attempt_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_execution_attempt_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `session_execution_plan_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_execution_plan_digest(&self) -> bool { - self.session_execution_plan_digest.is_set() - } - /**Whether required field `attempt_number` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_attempt_number(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `host_artifact_ref` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_host_artifact_ref(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `host_artifact_digest` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_host_artifact_digest(&self) -> bool { - self.host_artifact_digest.is_set() - } - /**Whether required field `started_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_started_at(&self) -> bool { - self.started_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for StartExecutionAttemptView<'a> { - type Owned = super::super::StartExecutionAttempt; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.execution_attempt_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.session_execution_plan_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.session_execution_plan_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.attempt_number = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.previous_attempt_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.restored_checkpoint.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.restored_checkpoint = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.host_artifact_ref = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.host_artifact_digest.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.host_artifact_digest = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.authenticated_remote_subject = Some( - ::buffa::types::borrow_str(&mut cur)?, - ); - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.isolation_placement = Some(::buffa::types::borrow_str(&mut cur)?); - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.started_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.started_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::StartExecutionAttempt, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::StartExecutionAttempt, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::StartExecutionAttempt { - session_id: self.session_id.to_string(), - execution_attempt_id: self.execution_attempt_id.to_string(), - session_execution_plan_digest: match self - .session_execution_plan_digest - .as_option() - { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - attempt_number: self.attempt_number, - previous_attempt_id: self.previous_attempt_id.map(|s| s.to_string()), - restored_checkpoint: match self.restored_checkpoint.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Checkpoint, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - host_artifact_ref: self.host_artifact_ref.to_string(), - host_artifact_digest: match self.host_artifact_digest.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Digest, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - authenticated_remote_subject: self - .authenticated_remote_subject - .map(|s| s.to_string()), - isolation_placement: self.isolation_placement.map(|s| s.to_string()), - started_at: match self.started_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for StartExecutionAttemptView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - if self.session_execution_plan_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.session_execution_plan_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.attempt_number) as u64; - if let Some(ref v) = self.previous_attempt_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.restored_checkpoint.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.restored_checkpoint.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.host_artifact_ref) as u64; - if self.host_artifact_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.host_artifact_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.authenticated_remote_subject { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.isolation_placement { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.started_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.started_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.execution_attempt_id, buf); - if self.session_execution_plan_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.session_execution_plan_digest.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(4u32, self.attempt_number, buf); - if let Some(ref v) = self.previous_attempt_id { - ::buffa::types::put_string_field(5u32, v, buf); - } - if self.restored_checkpoint.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.restored_checkpoint.write_to(__cache, buf); - } - ::buffa::types::put_string_field(7u32, &self.host_artifact_ref, buf); - if self.host_artifact_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.host_artifact_digest.write_to(__cache, buf); - } - if let Some(ref v) = self.authenticated_remote_subject { - ::buffa::types::put_string_field(9u32, v, buf); - } - if let Some(ref v) = self.isolation_placement { - ::buffa::types::put_string_field(10u32, v, buf); - } - if self.started_at.is_set() { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - self.started_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for StartExecutionAttemptView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("executionAttemptId", self.execution_attempt_id)?; - } - { - if let ::core::option::Option::Some(__v) = self - .session_execution_plan_digest - .as_option() - { - __map.serialize_entry("sessionExecutionPlanDigest", __v)?; - } - } - { - __map - .serialize_entry( - "attemptNumber", - &::buffa::json_helpers::ProtoJson(&self.attempt_number), - )?; - } - if let ::core::option::Option::Some(__v) = self.previous_attempt_id { - __map.serialize_entry("previousAttemptId", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self - .restored_checkpoint - .as_option() - { - __map.serialize_entry("restoredCheckpoint", __v)?; - } - } - { - __map.serialize_entry("hostArtifactRef", self.host_artifact_ref)?; - } - { - if let ::core::option::Option::Some(__v) = self - .host_artifact_digest - .as_option() - { - __map.serialize_entry("hostArtifactDigest", __v)?; - } - } - if let ::core::option::Option::Some(__v) = self.authenticated_remote_subject { - __map.serialize_entry("authenticatedRemoteSubject", __v)?; - } - if let ::core::option::Option::Some(__v) = self.isolation_placement { - __map.serialize_entry("isolationPlacement", __v)?; - } - { - if let ::core::option::Option::Some(__v) = self.started_at.as_option() { - __map.serialize_entry("startedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for StartExecutionAttemptView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "StartExecutionAttempt"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.StartExecutionAttempt"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StartExecutionAttempt"; -} -::buffa::impl_default_view_instance!(StartExecutionAttemptView); -::buffa::impl_view_reborrow!(StartExecutionAttemptView); -/** Self-contained, `'static` owned view of a `StartExecutionAttempt` message. - - Wraps [`::buffa::OwnedView`]`<`[`StartExecutionAttemptView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`StartExecutionAttemptView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct StartExecutionAttemptOwnedView( - ::buffa::OwnedView>, -); -impl StartExecutionAttemptOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StartExecutionAttemptOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StartExecutionAttemptOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::StartExecutionAttempt, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StartExecutionAttemptOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`StartExecutionAttemptView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &StartExecutionAttemptView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::StartExecutionAttempt { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `execution_attempt_id` - #[must_use] - pub fn execution_attempt_id(&self) -> &'_ str { - self.0.reborrow().execution_attempt_id - } - /// Must equal the session's stored plan digest; a mismatch means the runner - /// is about to execute a different plan than the session was started with. - /// - /// Field 3: `session_execution_plan_digest` - #[must_use] - pub fn session_execution_plan_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().session_execution_plan_digest - } - /// Field 4: `attempt_number` - #[must_use] - pub fn attempt_number(&self) -> u64 { - self.0.reborrow().attempt_number - } - /// Field 5: `previous_attempt_id` - #[must_use] - pub fn previous_attempt_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().previous_attempt_id - } - /// Unset when the attempt starts from scratch rather than restoring. - /// - /// Field 6: `restored_checkpoint` - #[must_use] - pub fn restored_checkpoint( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().restored_checkpoint - } - /// Field 7: `host_artifact_ref` - #[must_use] - pub fn host_artifact_ref(&self) -> &'_ str { - self.0.reborrow().host_artifact_ref - } - /// Field 8: `host_artifact_digest` - #[must_use] - pub fn host_artifact_digest( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().host_artifact_digest - } - /// Field 9: `authenticated_remote_subject` - #[must_use] - pub fn authenticated_remote_subject(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().authenticated_remote_subject - } - /// Field 10: `isolation_placement` - #[must_use] - pub fn isolation_placement(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().isolation_placement - } - /// Supplied by the caller: deciding is deterministic and reads no clock. - /// - /// Field 11: `started_at` - #[must_use] - pub fn started_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().started_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for StartExecutionAttemptOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - StartExecutionAttemptOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: StartExecutionAttemptOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for StartExecutionAttemptOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::StartExecutionAttempt { - type View<'a> = StartExecutionAttemptView<'a>; - type ViewHandle = StartExecutionAttemptOwnedView; -} -impl ::serde::Serialize for StartExecutionAttemptOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_execution_attempt.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_execution_attempt.rs deleted file mode 100644 index 3cfff3267..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_execution_attempt.rs +++ /dev/null @@ -1,439 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/start_execution_attempt.proto - -/// StartExecutionAttempt claims the session for a runner, recording -/// \[ExecutionAttemptStarted\]. -/// -/// Write precondition At: one active attempt at a time, monotonic attempt -/// numbers, and a restored checkpoint that exactly equals the first admitted -/// evidence for its id with no later redaction or erasure reaching at or before -/// its covers_through (ADR#0035 harness recovery). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct StartExecutionAttempt { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `execution_attempt_id` - #[serde( - rename = "executionAttemptId", - alias = "execution_attempt_id", - with = "::buffa::json_helpers::proto_string" - )] - pub execution_attempt_id: ::buffa::alloc::string::String, - /// Must equal the session's stored plan digest; a mismatch means the runner - /// is about to execute a different plan than the session was started with. - /// - /// Field 3: `session_execution_plan_digest` - #[serde( - rename = "sessionExecutionPlanDigest", - alias = "session_execution_plan_digest" - )] - pub session_execution_plan_digest: ::buffa::MessageField< - Digest, - ::buffa::Inline, - >, - /// Field 4: `attempt_number` - #[serde( - rename = "attemptNumber", - alias = "attempt_number", - with = "::buffa::json_helpers::uint64" - )] - pub attempt_number: u64, - /// Field 5: `previous_attempt_id` - #[serde( - rename = "previousAttemptId", - alias = "previous_attempt_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub previous_attempt_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Unset when the attempt starts from scratch rather than restoring. - /// - /// Field 6: `restored_checkpoint` - #[serde( - rename = "restoredCheckpoint", - alias = "restored_checkpoint", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub restored_checkpoint: ::buffa::MessageField< - Checkpoint, - ::buffa::Inline, - >, - /// Field 7: `host_artifact_ref` - #[serde( - rename = "hostArtifactRef", - alias = "host_artifact_ref", - with = "::buffa::json_helpers::proto_string" - )] - pub host_artifact_ref: ::buffa::alloc::string::String, - /// Field 8: `host_artifact_digest` - #[serde(rename = "hostArtifactDigest", alias = "host_artifact_digest")] - pub host_artifact_digest: ::buffa::MessageField>, - /// Field 9: `authenticated_remote_subject` - #[serde( - rename = "authenticatedRemoteSubject", - alias = "authenticated_remote_subject", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub authenticated_remote_subject: ::core::option::Option< - ::buffa::alloc::string::String, - >, - /// Field 10: `isolation_placement` - #[serde( - rename = "isolationPlacement", - alias = "isolation_placement", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub isolation_placement: ::core::option::Option<::buffa::alloc::string::String>, - /// Supplied by the caller: deciding is deterministic and reads no clock. - /// - /// Field 11: `started_at` - #[serde(rename = "startedAt", alias = "started_at")] - pub started_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for StartExecutionAttempt { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("StartExecutionAttempt") - .field("session_id", &self.session_id) - .field("execution_attempt_id", &self.execution_attempt_id) - .field("session_execution_plan_digest", &self.session_execution_plan_digest) - .field("attempt_number", &self.attempt_number) - .field("previous_attempt_id", &self.previous_attempt_id) - .field("restored_checkpoint", &self.restored_checkpoint) - .field("host_artifact_ref", &self.host_artifact_ref) - .field("host_artifact_digest", &self.host_artifact_digest) - .field("authenticated_remote_subject", &self.authenticated_remote_subject) - .field("isolation_placement", &self.isolation_placement) - .field("started_at", &self.started_at) - .finish() - } -} -impl StartExecutionAttempt { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StartExecutionAttempt"; -} -impl StartExecutionAttempt { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::previous_attempt_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_previous_attempt_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.previous_attempt_id = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::authenticated_remote_subject`] to `Some(value)`, consuming and returning `self`. - pub fn with_authenticated_remote_subject( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.authenticated_remote_subject = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::isolation_placement`] to `Some(value)`, consuming and returning `self`. - pub fn with_isolation_placement( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.isolation_placement = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(StartExecutionAttempt); -impl ::buffa::MessageName for StartExecutionAttempt { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "StartExecutionAttempt"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.StartExecutionAttempt"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StartExecutionAttempt"; -} -impl ::buffa::Message for StartExecutionAttempt { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.execution_attempt_id) as u64; - if self.session_execution_plan_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.session_execution_plan_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.attempt_number) as u64; - if let Some(ref v) = self.previous_attempt_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.restored_checkpoint.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.restored_checkpoint.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 + ::buffa::types::string_encoded_len(&self.host_artifact_ref) as u64; - if self.host_artifact_digest.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.host_artifact_digest.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.authenticated_remote_subject { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.isolation_placement { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if self.started_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.started_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.execution_attempt_id, buf); - if self.session_execution_plan_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.session_execution_plan_digest.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(4u32, self.attempt_number, buf); - if let Some(ref v) = self.previous_attempt_id { - ::buffa::types::put_string_field(5u32, v, buf); - } - if self.restored_checkpoint.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.restored_checkpoint.write_to(__cache, buf); - } - ::buffa::types::put_string_field(7u32, &self.host_artifact_ref, buf); - if self.host_artifact_digest.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.host_artifact_digest.write_to(__cache, buf); - } - if let Some(ref v) = self.authenticated_remote_subject { - ::buffa::types::put_string_field(9u32, v, buf); - } - if let Some(ref v) = self.isolation_placement { - ::buffa::types::put_string_field(10u32, v, buf); - } - if self.started_at.is_set() { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - self.started_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.execution_attempt_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.session_execution_plan_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.attempt_number = ::buffa::types::decode_uint64(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .previous_attempt_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.restored_checkpoint.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.host_artifact_ref, buf)?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.host_artifact_digest.get_or_insert_default(), - buf, - ctx, - )?; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .authenticated_remote_subject - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .isolation_placement - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.started_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.execution_attempt_id.clear(); - self.session_execution_plan_digest = ::buffa::MessageField::none(); - self.attempt_number = 0u64; - self.previous_attempt_id = ::core::option::Option::None; - self.restored_checkpoint = ::buffa::MessageField::none(); - self.host_artifact_ref.clear(); - self.host_artifact_digest = ::buffa::MessageField::none(); - self.authenticated_remote_subject = ::core::option::Option::None; - self.isolation_placement = ::core::option::Option::None; - self.started_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for StartExecutionAttempt { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __START_EXECUTION_ATTEMPT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.StartExecutionAttempt", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_tool_call.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_tool_call.__view.rs deleted file mode 100644 index 0cb4ec894..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_tool_call.__view.rs +++ /dev/null @@ -1,343 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/start_tool_call.proto - -/// StartToolCall records that execution began, recording \[ToolCallStarted\]. -/// -/// Write precondition Any. This is the fact a crash strands: a started call with -/// no terminal outcome is exactly what replay must expose so reconciliation can -/// finish or reject it. A start whose tool_call_id matches no request folds as -/// unjoined and is flagged, never refused (ADR#0035 orphan happened-fact rule). -#[derive(Clone, Debug, Default)] -pub struct StartToolCallView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Field 3: `tool_execution_id` - pub tool_execution_id: &'a str, - /// Field 4: `turn_id` - pub turn_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> StartToolCallView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_execution_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_execution_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for StartToolCallView<'a> { - type Owned = super::super::StartToolCall; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_execution_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::StartToolCall { - session_id: self.session_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - tool_execution_id: self.tool_execution_id.to_string(), - turn_id: self.turn_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for StartToolCallView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for StartToolCallView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolExecutionId", self.tool_execution_id)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for StartToolCallView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "StartToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.StartToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StartToolCall"; -} -::buffa::impl_default_view_instance!(StartToolCallView); -::buffa::impl_view_reborrow!(StartToolCallView); -/** Self-contained, `'static` owned view of a `StartToolCall` message. - - Wraps [`::buffa::OwnedView`]`<`[`StartToolCallView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`StartToolCallView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct StartToolCallOwnedView(::buffa::OwnedView>); -impl StartToolCallOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StartToolCallOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StartToolCallOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::StartToolCall, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - StartToolCallOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`StartToolCallView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &StartToolCallView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::StartToolCall { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Field 3: `tool_execution_id` - #[must_use] - pub fn tool_execution_id(&self) -> &'_ str { - self.0.reborrow().tool_execution_id - } - /// Field 4: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for StartToolCallOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - StartToolCallOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: StartToolCallOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for StartToolCallOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::StartToolCall { - type View<'a> = StartToolCallView<'a>; - type ViewHandle = StartToolCallOwnedView; -} -impl ::serde::Serialize for StartToolCallOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_tool_call.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_tool_call.rs deleted file mode 100644 index 01435e083..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.start_tool_call.rs +++ /dev/null @@ -1,170 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/start_tool_call.proto - -/// StartToolCall records that execution began, recording \[ToolCallStarted\]. -/// -/// Write precondition Any. This is the fact a crash strands: a started call with -/// no terminal outcome is exactly what replay must expose so reconciliation can -/// finish or reject it. A start whose tool_call_id matches no request folds as -/// unjoined and is flagged, never refused (ADR#0035 orphan happened-fact rule). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct StartToolCall { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Field 3: `tool_execution_id` - #[serde( - rename = "toolExecutionId", - alias = "tool_execution_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_execution_id: ::buffa::alloc::string::String, - /// Field 4: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for StartToolCall { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("StartToolCall") - .field("session_id", &self.session_id) - .field("tool_call_id", &self.tool_call_id) - .field("tool_execution_id", &self.tool_execution_id) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl StartToolCall { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StartToolCall"; -} -::buffa::impl_default_instance!(StartToolCall); -impl ::buffa::MessageName for StartToolCall { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "StartToolCall"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.StartToolCall"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.StartToolCall"; -} -impl ::buffa::Message for StartToolCall { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_execution_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.tool_call_id.clear(); - self.tool_execution_id.clear(); - self.turn_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for StartToolCall { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __START_TOOL_CALL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.StartToolCall", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.system_notice_recorded.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.system_notice_recorded.__view.rs deleted file mode 100644 index 5d4a2b261..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.system_notice_recorded.__view.rs +++ /dev/null @@ -1,355 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/system_notice_recorded.proto - -/// SystemNoticeRecorded records a system-originated notice surfaced during a -/// session (info, warning, or error) that is not tied to a specific assistant -/// turn. It is recorded so any model-visible system content and the user-visible -/// transcript rebuild from the log alone (ADR#0035 facet 8). It is a commuting -/// happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, Debug, Default)] -pub struct SystemNoticeRecordedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `level` - pub level: ::buffa::EnumValue, - /// Field 3: `text` - pub text: &'a str, - /// Tool call this notice concerns, when applicable; empty for a general notice. - /// - /// Field 4: `tool_call_id` - pub tool_call_id: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SystemNoticeRecordedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `level` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_level(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `text` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_text(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SystemNoticeRecordedView<'a> { - type Owned = super::super::SystemNoticeRecorded; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.level = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.text = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::SystemNoticeRecorded, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::SystemNoticeRecorded, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SystemNoticeRecorded { - session_id: self.session_id.to_string(), - level: self.level, - text: self.text.to_string(), - tool_call_id: self.tool_call_id.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SystemNoticeRecordedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.level.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - if let Some(ref v) = self.tool_call_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.level.to_i32(), buf); - ::buffa::types::put_string_field(3u32, &self.text, buf); - if let Some(ref v) = self.tool_call_id { - ::buffa::types::put_string_field(4u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SystemNoticeRecordedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("level", &self.level)?; - } - { - __map.serialize_entry("text", self.text)?; - } - if let ::core::option::Option::Some(__v) = self.tool_call_id { - __map.serialize_entry("toolCallId", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SystemNoticeRecordedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SystemNoticeRecorded"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SystemNoticeRecorded"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SystemNoticeRecorded"; -} -::buffa::impl_default_view_instance!(SystemNoticeRecordedView); -::buffa::impl_view_reborrow!(SystemNoticeRecordedView); -/** Self-contained, `'static` owned view of a `SystemNoticeRecorded` message. - - Wraps [`::buffa::OwnedView`]`<`[`SystemNoticeRecordedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SystemNoticeRecordedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SystemNoticeRecordedOwnedView( - ::buffa::OwnedView>, -); -impl SystemNoticeRecordedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SystemNoticeRecordedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SystemNoticeRecordedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SystemNoticeRecorded, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SystemNoticeRecordedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SystemNoticeRecordedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SystemNoticeRecordedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SystemNoticeRecorded { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `level` - #[must_use] - pub fn level(&self) -> ::buffa::EnumValue { - self.0.reborrow().level - } - /// Field 3: `text` - #[must_use] - pub fn text(&self) -> &'_ str { - self.0.reborrow().text - } - /// Tool call this notice concerns, when applicable; empty for a general notice. - /// - /// Field 4: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().tool_call_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SystemNoticeRecordedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SystemNoticeRecordedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SystemNoticeRecordedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SystemNoticeRecordedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SystemNoticeRecorded { - type View<'a> = SystemNoticeRecordedView<'a>; - type ViewHandle = SystemNoticeRecordedOwnedView; -} -impl ::serde::Serialize for SystemNoticeRecordedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.system_notice_recorded.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.system_notice_recorded.rs deleted file mode 100644 index 81bbab0c3..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.system_notice_recorded.rs +++ /dev/null @@ -1,347 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/system_notice_recorded.proto - -/// NoticeLevel is the severity of a system notice. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum NoticeLevel { - NOTICE_LEVEL_UNSPECIFIED = 0i32, - NOTICE_LEVEL_INFO = 1i32, - NOTICE_LEVEL_WARNING = 2i32, - NOTICE_LEVEL_ERROR = 3i32, -} -impl NoticeLevel { - ///Idiomatic alias for [`Self::NOTICE_LEVEL_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::NOTICE_LEVEL_UNSPECIFIED; - ///Idiomatic alias for [`Self::NOTICE_LEVEL_INFO`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Info: Self = Self::NOTICE_LEVEL_INFO; - ///Idiomatic alias for [`Self::NOTICE_LEVEL_WARNING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Warning: Self = Self::NOTICE_LEVEL_WARNING; - ///Idiomatic alias for [`Self::NOTICE_LEVEL_ERROR`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Error: Self = Self::NOTICE_LEVEL_ERROR; -} -impl ::core::default::Default for NoticeLevel { - fn default() -> Self { - Self::NOTICE_LEVEL_UNSPECIFIED - } -} -impl ::serde::Serialize for NoticeLevel { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for NoticeLevel { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = NoticeLevel; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(NoticeLevel)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for NoticeLevel { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for NoticeLevel { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::NOTICE_LEVEL_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::NOTICE_LEVEL_INFO), - 2i32 => ::core::option::Option::Some(Self::NOTICE_LEVEL_WARNING), - 3i32 => ::core::option::Option::Some(Self::NOTICE_LEVEL_ERROR), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::NOTICE_LEVEL_UNSPECIFIED => "NOTICE_LEVEL_UNSPECIFIED", - Self::NOTICE_LEVEL_INFO => "NOTICE_LEVEL_INFO", - Self::NOTICE_LEVEL_WARNING => "NOTICE_LEVEL_WARNING", - Self::NOTICE_LEVEL_ERROR => "NOTICE_LEVEL_ERROR", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "NOTICE_LEVEL_UNSPECIFIED" => { - ::core::option::Option::Some(Self::NOTICE_LEVEL_UNSPECIFIED) - } - "NOTICE_LEVEL_INFO" => ::core::option::Option::Some(Self::NOTICE_LEVEL_INFO), - "NOTICE_LEVEL_WARNING" => { - ::core::option::Option::Some(Self::NOTICE_LEVEL_WARNING) - } - "NOTICE_LEVEL_ERROR" => { - ::core::option::Option::Some(Self::NOTICE_LEVEL_ERROR) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::NOTICE_LEVEL_UNSPECIFIED, - Self::NOTICE_LEVEL_INFO, - Self::NOTICE_LEVEL_WARNING, - Self::NOTICE_LEVEL_ERROR, - ] - } -} -/// SystemNoticeRecorded records a system-originated notice surfaced during a -/// session (info, warning, or error) that is not tied to a specific assistant -/// turn. It is recorded so any model-visible system content and the user-visible -/// transcript rebuild from the log alone (ADR#0035 facet 8). It is a commuting -/// happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SystemNoticeRecorded { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `level` - #[serde(rename = "level", with = "::buffa::json_helpers::proto_enum")] - pub level: ::buffa::EnumValue, - /// Field 3: `text` - #[serde(rename = "text", with = "::buffa::json_helpers::proto_string")] - pub text: ::buffa::alloc::string::String, - /// Tool call this notice concerns, when applicable; empty for a general notice. - /// - /// Field 4: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub tool_call_id: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for SystemNoticeRecorded { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SystemNoticeRecorded") - .field("session_id", &self.session_id) - .field("level", &self.level) - .field("text", &self.text) - .field("tool_call_id", &self.tool_call_id) - .finish() - } -} -impl SystemNoticeRecorded { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SystemNoticeRecorded"; -} -impl SystemNoticeRecorded { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::tool_call_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_tool_call_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.tool_call_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(SystemNoticeRecorded); -impl ::buffa::MessageName for SystemNoticeRecorded { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "SystemNoticeRecorded"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.SystemNoticeRecorded"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.SystemNoticeRecorded"; -} -impl ::buffa::Message for SystemNoticeRecorded { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - { - let val = self.level.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.text) as u64; - if let Some(ref v) = self.tool_call_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_int32_field(2u32, self.level.to_i32(), buf); - ::buffa::types::put_string_field(3u32, &self.text, buf); - if let Some(ref v) = self.tool_call_id { - ::buffa::types::put_string_field(4u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.level = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.text, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .tool_call_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.level = ::buffa::EnumValue::from(0); - self.text.clear(); - self.tool_call_id = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for SystemNoticeRecorded { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SYSTEM_NOTICE_RECORDED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.SystemNoticeRecorded", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.target_outcome.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.target_outcome.__view.rs deleted file mode 100644 index 5038421fd..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.target_outcome.__view.rs +++ /dev/null @@ -1,337 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/target_outcome.proto - -/// TargetOutcome records one target a multi-resource tool call failed to apply. -/// -/// A batch edit over ten files that succeeds for eight and fails for two is not a -/// failure. Eight files really changed, and those changes exist independently of -/// how the call is labelled: they are FileChanged facts on the log and no result -/// status can retract them. Such a call is therefore a ToolCallCompleted with -/// result status TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR, never a -/// ToolCallFailed, which means nothing was applied at all. -/// -/// Only failures are recorded here. The successes are already durable as -/// FileChanged, and recording them a second time would create two facts for one -/// change that can disagree after a rewind or a redaction masks one of them. What -/// no other event can express is the negative: that a target was named, attempted, -/// and did not happen. Without it a reader sees eight changes for a ten-file -/// request and has to infer the gap by comparing against tool arguments, which is -/// exactly the inference a typed record exists to make unnecessary. -#[derive(Clone, Debug, Default)] -pub struct TargetOutcomeView<'a> { - /// The target as addressed by the call, in the same URI form as - /// WorkspaceRef.uri. A URI rather than a workspace-relative path because a - /// multi-resource tool's targets are not always files, and a failure against an - /// MCP resource or a remote endpoint has no path to record. - /// - /// Field 1: `target_uri` - pub target_uri: &'a str, - /// Field 2: `reason` - pub reason: ::buffa::EnumValue, - /// Detail from the tool, for humans. Never parsed. - /// - /// Field 3: `detail` - pub detail: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> TargetOutcomeView<'a> { - /**Whether required field `target_uri` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_target_uri(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for TargetOutcomeView<'a> { - type Owned = super::super::TargetOutcome; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.target_uri = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::TargetOutcome { - target_uri: self.target_uri.to_string(), - reason: self.reason, - detail: self.detail.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for TargetOutcomeView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.target_uri) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.target_uri, buf); - ::buffa::types::put_int32_field(2u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for TargetOutcomeView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("targetUri", self.target_uri)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for TargetOutcomeView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "TargetOutcome"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.TargetOutcome"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TargetOutcome"; -} -::buffa::impl_default_view_instance!(TargetOutcomeView); -::buffa::impl_view_reborrow!(TargetOutcomeView); -/** Self-contained, `'static` owned view of a `TargetOutcome` message. - - Wraps [`::buffa::OwnedView`]`<`[`TargetOutcomeView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TargetOutcomeView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct TargetOutcomeOwnedView(::buffa::OwnedView>); -impl TargetOutcomeOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TargetOutcomeOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TargetOutcomeOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::TargetOutcome, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TargetOutcomeOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`TargetOutcomeView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &TargetOutcomeView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::TargetOutcome { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The target as addressed by the call, in the same URI form as - /// WorkspaceRef.uri. A URI rather than a workspace-relative path because a - /// multi-resource tool's targets are not always files, and a failure against an - /// MCP resource or a remote endpoint has no path to record. - /// - /// Field 1: `target_uri` - #[must_use] - pub fn target_uri(&self) -> &'_ str { - self.0.reborrow().target_uri - } - /// Field 2: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// Detail from the tool, for humans. Never parsed. - /// - /// Field 3: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for TargetOutcomeOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - TargetOutcomeOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: TargetOutcomeOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for TargetOutcomeOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::TargetOutcome { - type View<'a> = TargetOutcomeView<'a>; - type ViewHandle = TargetOutcomeOwnedView; -} -impl ::serde::Serialize for TargetOutcomeOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.target_outcome.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.target_outcome.rs deleted file mode 100644 index 3787d0faa..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.target_outcome.rs +++ /dev/null @@ -1,449 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/target_outcome.proto - -/// TargetFailureReason is why one target of a multi-target call did not apply. -/// -/// Typed because the reasons carry different meanings for whether retrying is -/// sound. A permission fault is durable and a retry repeats it; a stale -/// precondition means the resource moved under the agent and a retry against -/// fresh content may well succeed; a not-attempted target failed for no reason of -/// its own at all. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum TargetFailureReason { - TARGET_FAILURE_REASON_UNSPECIFIED = 0i32, - /// The target did not exist. - TARGET_FAILURE_REASON_NOT_FOUND = 1i32, - /// Access was refused by the underlying system. - TARGET_FAILURE_REASON_PERMISSION_DENIED = 2i32, - /// The target's content no longer matched what the change was decided against, - /// which is the ResourceObservation digest that justified the write. - TARGET_FAILURE_REASON_PRECONDITION_FAILED = 3i32, - /// The requested edit did not match anything in the target. - TARGET_FAILURE_REASON_NO_MATCH = 4i32, - /// The edit matched ambiguously and was refused rather than guessed at. - TARGET_FAILURE_REASON_AMBIGUOUS_MATCH = 5i32, - /// The target could not be interpreted in the form the tool required. - TARGET_FAILURE_REASON_UNSUPPORTED_CONTENT = 6i32, - /// The call stopped before reaching this target. It is not a failure of the - /// target and says nothing about whether it would have succeeded; recorded so a - /// reader never concludes an unreached target was rejected. - TARGET_FAILURE_REASON_NOT_ATTEMPTED = 7i32, - /// The underlying system failed in a way the tool could not classify. - TARGET_FAILURE_REASON_IO_ERROR = 8i32, -} -impl TargetFailureReason { - ///Idiomatic alias for [`Self::TARGET_FAILURE_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::TARGET_FAILURE_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::TARGET_FAILURE_REASON_NOT_FOUND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NotFound: Self = Self::TARGET_FAILURE_REASON_NOT_FOUND; - ///Idiomatic alias for [`Self::TARGET_FAILURE_REASON_PERMISSION_DENIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const PermissionDenied: Self = Self::TARGET_FAILURE_REASON_PERMISSION_DENIED; - ///Idiomatic alias for [`Self::TARGET_FAILURE_REASON_PRECONDITION_FAILED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const PreconditionFailed: Self = Self::TARGET_FAILURE_REASON_PRECONDITION_FAILED; - ///Idiomatic alias for [`Self::TARGET_FAILURE_REASON_NO_MATCH`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NoMatch: Self = Self::TARGET_FAILURE_REASON_NO_MATCH; - ///Idiomatic alias for [`Self::TARGET_FAILURE_REASON_AMBIGUOUS_MATCH`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const AmbiguousMatch: Self = Self::TARGET_FAILURE_REASON_AMBIGUOUS_MATCH; - ///Idiomatic alias for [`Self::TARGET_FAILURE_REASON_UNSUPPORTED_CONTENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const UnsupportedContent: Self = Self::TARGET_FAILURE_REASON_UNSUPPORTED_CONTENT; - ///Idiomatic alias for [`Self::TARGET_FAILURE_REASON_NOT_ATTEMPTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NotAttempted: Self = Self::TARGET_FAILURE_REASON_NOT_ATTEMPTED; - ///Idiomatic alias for [`Self::TARGET_FAILURE_REASON_IO_ERROR`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const IoError: Self = Self::TARGET_FAILURE_REASON_IO_ERROR; -} -impl ::core::default::Default for TargetFailureReason { - fn default() -> Self { - Self::TARGET_FAILURE_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for TargetFailureReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for TargetFailureReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = TargetFailureReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(TargetFailureReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for TargetFailureReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for TargetFailureReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::TARGET_FAILURE_REASON_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::TARGET_FAILURE_REASON_NOT_FOUND), - 2i32 => { - ::core::option::Option::Some( - Self::TARGET_FAILURE_REASON_PERMISSION_DENIED, - ) - } - 3i32 => { - ::core::option::Option::Some( - Self::TARGET_FAILURE_REASON_PRECONDITION_FAILED, - ) - } - 4i32 => ::core::option::Option::Some(Self::TARGET_FAILURE_REASON_NO_MATCH), - 5i32 => { - ::core::option::Option::Some(Self::TARGET_FAILURE_REASON_AMBIGUOUS_MATCH) - } - 6i32 => { - ::core::option::Option::Some( - Self::TARGET_FAILURE_REASON_UNSUPPORTED_CONTENT, - ) - } - 7i32 => { - ::core::option::Option::Some(Self::TARGET_FAILURE_REASON_NOT_ATTEMPTED) - } - 8i32 => ::core::option::Option::Some(Self::TARGET_FAILURE_REASON_IO_ERROR), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::TARGET_FAILURE_REASON_UNSPECIFIED => { - "TARGET_FAILURE_REASON_UNSPECIFIED" - } - Self::TARGET_FAILURE_REASON_NOT_FOUND => "TARGET_FAILURE_REASON_NOT_FOUND", - Self::TARGET_FAILURE_REASON_PERMISSION_DENIED => { - "TARGET_FAILURE_REASON_PERMISSION_DENIED" - } - Self::TARGET_FAILURE_REASON_PRECONDITION_FAILED => { - "TARGET_FAILURE_REASON_PRECONDITION_FAILED" - } - Self::TARGET_FAILURE_REASON_NO_MATCH => "TARGET_FAILURE_REASON_NO_MATCH", - Self::TARGET_FAILURE_REASON_AMBIGUOUS_MATCH => { - "TARGET_FAILURE_REASON_AMBIGUOUS_MATCH" - } - Self::TARGET_FAILURE_REASON_UNSUPPORTED_CONTENT => { - "TARGET_FAILURE_REASON_UNSUPPORTED_CONTENT" - } - Self::TARGET_FAILURE_REASON_NOT_ATTEMPTED => { - "TARGET_FAILURE_REASON_NOT_ATTEMPTED" - } - Self::TARGET_FAILURE_REASON_IO_ERROR => "TARGET_FAILURE_REASON_IO_ERROR", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "TARGET_FAILURE_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::TARGET_FAILURE_REASON_UNSPECIFIED) - } - "TARGET_FAILURE_REASON_NOT_FOUND" => { - ::core::option::Option::Some(Self::TARGET_FAILURE_REASON_NOT_FOUND) - } - "TARGET_FAILURE_REASON_PERMISSION_DENIED" => { - ::core::option::Option::Some( - Self::TARGET_FAILURE_REASON_PERMISSION_DENIED, - ) - } - "TARGET_FAILURE_REASON_PRECONDITION_FAILED" => { - ::core::option::Option::Some( - Self::TARGET_FAILURE_REASON_PRECONDITION_FAILED, - ) - } - "TARGET_FAILURE_REASON_NO_MATCH" => { - ::core::option::Option::Some(Self::TARGET_FAILURE_REASON_NO_MATCH) - } - "TARGET_FAILURE_REASON_AMBIGUOUS_MATCH" => { - ::core::option::Option::Some(Self::TARGET_FAILURE_REASON_AMBIGUOUS_MATCH) - } - "TARGET_FAILURE_REASON_UNSUPPORTED_CONTENT" => { - ::core::option::Option::Some( - Self::TARGET_FAILURE_REASON_UNSUPPORTED_CONTENT, - ) - } - "TARGET_FAILURE_REASON_NOT_ATTEMPTED" => { - ::core::option::Option::Some(Self::TARGET_FAILURE_REASON_NOT_ATTEMPTED) - } - "TARGET_FAILURE_REASON_IO_ERROR" => { - ::core::option::Option::Some(Self::TARGET_FAILURE_REASON_IO_ERROR) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::TARGET_FAILURE_REASON_UNSPECIFIED, - Self::TARGET_FAILURE_REASON_NOT_FOUND, - Self::TARGET_FAILURE_REASON_PERMISSION_DENIED, - Self::TARGET_FAILURE_REASON_PRECONDITION_FAILED, - Self::TARGET_FAILURE_REASON_NO_MATCH, - Self::TARGET_FAILURE_REASON_AMBIGUOUS_MATCH, - Self::TARGET_FAILURE_REASON_UNSUPPORTED_CONTENT, - Self::TARGET_FAILURE_REASON_NOT_ATTEMPTED, - Self::TARGET_FAILURE_REASON_IO_ERROR, - ] - } -} -/// TargetOutcome records one target a multi-resource tool call failed to apply. -/// -/// A batch edit over ten files that succeeds for eight and fails for two is not a -/// failure. Eight files really changed, and those changes exist independently of -/// how the call is labelled: they are FileChanged facts on the log and no result -/// status can retract them. Such a call is therefore a ToolCallCompleted with -/// result status TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR, never a -/// ToolCallFailed, which means nothing was applied at all. -/// -/// Only failures are recorded here. The successes are already durable as -/// FileChanged, and recording them a second time would create two facts for one -/// change that can disagree after a rewind or a redaction masks one of them. What -/// no other event can express is the negative: that a target was named, attempted, -/// and did not happen. Without it a reader sees eight changes for a ten-file -/// request and has to infer the gap by comparing against tool arguments, which is -/// exactly the inference a typed record exists to make unnecessary. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct TargetOutcome { - /// The target as addressed by the call, in the same URI form as - /// WorkspaceRef.uri. A URI rather than a workspace-relative path because a - /// multi-resource tool's targets are not always files, and a failure against an - /// MCP resource or a remote endpoint has no path to record. - /// - /// Field 1: `target_uri` - #[serde( - rename = "targetUri", - alias = "target_uri", - with = "::buffa::json_helpers::proto_string" - )] - pub target_uri: ::buffa::alloc::string::String, - /// Field 2: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// Detail from the tool, for humans. Never parsed. - /// - /// Field 3: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for TargetOutcome { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("TargetOutcome") - .field("target_uri", &self.target_uri) - .field("reason", &self.reason) - .field("detail", &self.detail) - .finish() - } -} -impl TargetOutcome { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TargetOutcome"; -} -impl TargetOutcome { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(TargetOutcome); -impl ::buffa::MessageName for TargetOutcome { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "TargetOutcome"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.TargetOutcome"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TargetOutcome"; -} -impl ::buffa::Message for TargetOutcome { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.target_uri) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.target_uri, buf); - ::buffa::types::put_int32_field(2u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.target_uri, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.target_uri.clear(); - self.reason = ::buffa::EnumValue::from(0); - self.detail = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for TargetOutcome { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TARGET_OUTCOME_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.TargetOutcome", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.todo_updated.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.todo_updated.__view.rs deleted file mode 100644 index a1f2082b1..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.todo_updated.__view.rs +++ /dev/null @@ -1,658 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/todo_updated.proto - -/// TodoUpdated records the agent's current task/plan list as a full snapshot on -/// change, so the plan is a first-class domain fact rather than something a -/// projection must parse out of a tool call's input. revision is monotonic per -/// session from the single logical writer (the active attempt's loop); the -/// fold keeps the highest-revision update, order-independent and so truly -/// commuting, with ties resolved to the first in fold order (D11). It is a -/// commuting happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, Debug, Default)] -pub struct TodoUpdatedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// The complete todo list as of this update; readers replace, not merge. - /// - /// Field 2: `items` - pub items: ::buffa::RepeatedView<'a, super::super::__buffa::view::TodoItemView<'a>>, - /// Monotonic revision from the single logical writer; the fold keeps the - /// highest-revision update. - /// - /// Field 3: `revision` - pub revision: u64, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> TodoUpdatedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `revision` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_revision(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for TodoUpdatedView<'a> { - type Owned = super::super::TodoUpdated; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.revision = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::(), - )?; - view.items - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::TodoUpdated { - session_id: self.session_id.to_string(), - items: self - .items - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - revision: self.revision, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for TodoUpdatedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - for v in &self.items { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.revision) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - for v in &self.items { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(3u32, self.revision, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for TodoUpdatedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - if !self.items.is_empty() { - __map.serialize_entry("items", &*self.items)?; - } - { - __map - .serialize_entry( - "revision", - &::buffa::json_helpers::ProtoJson(&self.revision), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for TodoUpdatedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "TodoUpdated"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.TodoUpdated"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TodoUpdated"; -} -::buffa::impl_default_view_instance!(TodoUpdatedView); -::buffa::impl_view_reborrow!(TodoUpdatedView); -/** Self-contained, `'static` owned view of a `TodoUpdated` message. - - Wraps [`::buffa::OwnedView`]`<`[`TodoUpdatedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TodoUpdatedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct TodoUpdatedOwnedView(::buffa::OwnedView>); -impl TodoUpdatedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TodoUpdatedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TodoUpdatedOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::TodoUpdated, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TodoUpdatedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`TodoUpdatedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &TodoUpdatedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::TodoUpdated { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// The complete todo list as of this update; readers replace, not merge. - /// - /// Field 2: `items` - #[must_use] - pub fn items( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::TodoItemView<'_>> { - &self.0.reborrow().items - } - /// Monotonic revision from the single logical writer; the fold keeps the - /// highest-revision update. - /// - /// Field 3: `revision` - #[must_use] - pub fn revision(&self) -> u64 { - self.0.reborrow().revision - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for TodoUpdatedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - TodoUpdatedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: TodoUpdatedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for TodoUpdatedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::TodoUpdated { - type View<'a> = TodoUpdatedView<'a>; - type ViewHandle = TodoUpdatedOwnedView; -} -impl ::serde::Serialize for TodoUpdatedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// TodoItem is one entry in the agent's task/plan list. -#[derive(Clone, Debug, Default)] -pub struct TodoItemView<'a> { - /// Field 1: `id` - pub id: &'a str, - /// Field 2: `content` - pub content: &'a str, - /// Field 3: `status` - pub status: ::buffa::EnumValue, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> TodoItemView<'a> { - /**Whether required field `id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `content` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_content(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `status` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_status(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for TodoItemView<'a> { - type Owned = super::super::TodoItem; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.content = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.status = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::TodoItem { - id: self.id.to_string(), - content: self.content.to_string(), - status: self.status, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for TodoItemView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.content) as u64; - { - let val = self.status.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.id, buf); - ::buffa::types::put_string_field(2u32, &self.content, buf); - ::buffa::types::put_int32_field(3u32, self.status.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for TodoItemView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("id", self.id)?; - } - { - __map.serialize_entry("content", self.content)?; - } - { - __map.serialize_entry("status", &self.status)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for TodoItemView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "TodoItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.TodoItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TodoItem"; -} -::buffa::impl_default_view_instance!(TodoItemView); -::buffa::impl_view_reborrow!(TodoItemView); -/** Self-contained, `'static` owned view of a `TodoItem` message. - - Wraps [`::buffa::OwnedView`]`<`[`TodoItemView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TodoItemView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct TodoItemOwnedView(::buffa::OwnedView>); -impl TodoItemOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok(TodoItemOwnedView(::buffa::OwnedView::decode(bytes)?)) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TodoItemOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::TodoItem, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TodoItemOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`TodoItemView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &TodoItemView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::TodoItem { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `id` - #[must_use] - pub fn id(&self) -> &'_ str { - self.0.reborrow().id - } - /// Field 2: `content` - #[must_use] - pub fn content(&self) -> &'_ str { - self.0.reborrow().content - } - /// Field 3: `status` - #[must_use] - pub fn status(&self) -> ::buffa::EnumValue { - self.0.reborrow().status - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for TodoItemOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - TodoItemOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: TodoItemOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for TodoItemOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::TodoItem { - type View<'a> = TodoItemView<'a>; - type ViewHandle = TodoItemOwnedView; -} -impl ::serde::Serialize for TodoItemOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.todo_updated.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.todo_updated.rs deleted file mode 100644 index 616a5e753..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.todo_updated.rs +++ /dev/null @@ -1,469 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/todo_updated.proto - -/// TodoStatus is the state of a todo item. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum TodoStatus { - TODO_STATUS_UNSPECIFIED = 0i32, - TODO_STATUS_PENDING = 1i32, - TODO_STATUS_IN_PROGRESS = 2i32, - TODO_STATUS_COMPLETED = 3i32, -} -impl TodoStatus { - ///Idiomatic alias for [`Self::TODO_STATUS_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::TODO_STATUS_UNSPECIFIED; - ///Idiomatic alias for [`Self::TODO_STATUS_PENDING`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Pending: Self = Self::TODO_STATUS_PENDING; - ///Idiomatic alias for [`Self::TODO_STATUS_IN_PROGRESS`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const InProgress: Self = Self::TODO_STATUS_IN_PROGRESS; - ///Idiomatic alias for [`Self::TODO_STATUS_COMPLETED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Completed: Self = Self::TODO_STATUS_COMPLETED; -} -impl ::core::default::Default for TodoStatus { - fn default() -> Self { - Self::TODO_STATUS_UNSPECIFIED - } -} -impl ::serde::Serialize for TodoStatus { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for TodoStatus { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = TodoStatus; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(TodoStatus)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for TodoStatus { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for TodoStatus { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::TODO_STATUS_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::TODO_STATUS_PENDING), - 2i32 => ::core::option::Option::Some(Self::TODO_STATUS_IN_PROGRESS), - 3i32 => ::core::option::Option::Some(Self::TODO_STATUS_COMPLETED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::TODO_STATUS_UNSPECIFIED => "TODO_STATUS_UNSPECIFIED", - Self::TODO_STATUS_PENDING => "TODO_STATUS_PENDING", - Self::TODO_STATUS_IN_PROGRESS => "TODO_STATUS_IN_PROGRESS", - Self::TODO_STATUS_COMPLETED => "TODO_STATUS_COMPLETED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "TODO_STATUS_UNSPECIFIED" => { - ::core::option::Option::Some(Self::TODO_STATUS_UNSPECIFIED) - } - "TODO_STATUS_PENDING" => { - ::core::option::Option::Some(Self::TODO_STATUS_PENDING) - } - "TODO_STATUS_IN_PROGRESS" => { - ::core::option::Option::Some(Self::TODO_STATUS_IN_PROGRESS) - } - "TODO_STATUS_COMPLETED" => { - ::core::option::Option::Some(Self::TODO_STATUS_COMPLETED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::TODO_STATUS_UNSPECIFIED, - Self::TODO_STATUS_PENDING, - Self::TODO_STATUS_IN_PROGRESS, - Self::TODO_STATUS_COMPLETED, - ] - } -} -/// TodoUpdated records the agent's current task/plan list as a full snapshot on -/// change, so the plan is a first-class domain fact rather than something a -/// projection must parse out of a tool call's input. revision is monotonic per -/// session from the single logical writer (the active attempt's loop); the -/// fold keeps the highest-revision update, order-independent and so truly -/// commuting, with ties resolved to the first in fold order (D11). It is a -/// commuting happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct TodoUpdated { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// The complete todo list as of this update; readers replace, not merge. - /// - /// Field 2: `items` - #[serde( - rename = "items", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub items: ::buffa::alloc::vec::Vec, - /// Monotonic revision from the single logical writer; the fold keeps the - /// highest-revision update. - /// - /// Field 3: `revision` - #[serde(rename = "revision", with = "::buffa::json_helpers::uint64")] - pub revision: u64, -} -impl ::core::fmt::Debug for TodoUpdated { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("TodoUpdated") - .field("session_id", &self.session_id) - .field("items", &self.items) - .field("revision", &self.revision) - .finish() - } -} -impl TodoUpdated { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TodoUpdated"; -} -::buffa::impl_default_instance!(TodoUpdated); -impl ::buffa::MessageName for TodoUpdated { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "TodoUpdated"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.TodoUpdated"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TodoUpdated"; -} -impl ::buffa::Message for TodoUpdated { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - for v in &self.items { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.revision) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - for v in &self.items { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(3u32, self.revision, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.items.push(elem); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.revision = ::buffa::types::decode_uint64(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.items.clear(); - self.revision = 0u64; - } -} -impl ::buffa::json_helpers::ProtoElemJson for TodoUpdated { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TODO_UPDATED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.TodoUpdated", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// TodoItem is one entry in the agent's task/plan list. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct TodoItem { - /// Field 1: `id` - #[serde(rename = "id", with = "::buffa::json_helpers::proto_string")] - pub id: ::buffa::alloc::string::String, - /// Field 2: `content` - #[serde(rename = "content", with = "::buffa::json_helpers::proto_string")] - pub content: ::buffa::alloc::string::String, - /// Field 3: `status` - #[serde(rename = "status", with = "::buffa::json_helpers::proto_enum")] - pub status: ::buffa::EnumValue, -} -impl ::core::fmt::Debug for TodoItem { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("TodoItem") - .field("id", &self.id) - .field("content", &self.content) - .field("status", &self.status) - .finish() - } -} -impl TodoItem { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TodoItem"; -} -::buffa::impl_default_instance!(TodoItem); -impl ::buffa::MessageName for TodoItem { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "TodoItem"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.TodoItem"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TodoItem"; -} -impl ::buffa::Message for TodoItem { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.content) as u64; - { - let val = self.status.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.id, buf); - ::buffa::types::put_string_field(2u32, &self.content, buf); - ::buffa::types::put_int32_field(3u32, self.status.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.content, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.status = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.id.clear(); - self.content.clear(); - self.status = ::buffa::EnumValue::from(0); - } -} -impl ::buffa::json_helpers::ProtoElemJson for TodoItem { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TODO_ITEM_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.TodoItem", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.token_usage.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.token_usage.__view.rs deleted file mode 100644 index e9186454c..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.token_usage.__view.rs +++ /dev/null @@ -1,759 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/token_usage.proto - -/// TokenUsage is the token accounting recorded for one completed assistant -/// message; audit and budgeting input, never an identity or ordering input. -#[derive(Clone, Debug, Default)] -pub struct TokenUsageView<'a> { - /// Counters are intentionally not required: a provider may not report every - /// class (e.g. cache tokens), and edition-2024 presence distinguishes an unset - /// "not reported" counter from a reported 0. - /// - /// Field 1: `input_tokens` - pub input_tokens: ::core::option::Option, - /// Field 2: `output_tokens` - pub output_tokens: ::core::option::Option, - /// Field 3: `cache_creation_tokens` - pub cache_creation_tokens: ::core::option::Option, - /// Field 4: `cache_read_tokens` - pub cache_read_tokens: ::core::option::Option, - /// Monetary cost of this usage, priced at generation time. Recorded as a fact so - /// a deterministic cost projection folds recorded amounts and never re-reads a - /// drifting price catalog. Unset when cost is not tracked. - /// - /// Field 5: `cost` - pub cost: ::buffa::MessageFieldView>, - /// Whether these counters are the provider's final accounting for the message - /// or a mid-generation reading. A partial reading exists so a turn that failed - /// or was interrupted still accounts for what it consumed, but summing partial - /// and final readings for the same message double-counts. Unset is read as - /// final, which is what every counter recorded before this field meant. - /// - /// Field 6: `completeness` - pub completeness: ::core::option::Option< - ::buffa::EnumValue, - >, -} -impl<'a> ::buffa::MessageView<'a> for TokenUsageView<'a> { - type Owned = super::super::TokenUsage; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.input_tokens = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.output_tokens = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.cache_creation_tokens = Some( - ::buffa::types::decode_uint64(&mut cur)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.cache_read_tokens = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.cost.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.cost = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.completeness = Some( - ::buffa::EnumValue::from(::buffa::types::decode_int32(&mut cur)?), - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::TokenUsage { - input_tokens: self.input_tokens, - output_tokens: self.output_tokens, - cache_creation_tokens: self.cache_creation_tokens, - cache_read_tokens: self.cache_read_tokens, - cost: match self.cost.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::Cost, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - completeness: self.completeness, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for TokenUsageView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(v) = self.input_tokens { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.output_tokens { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.cache_creation_tokens { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.cache_read_tokens { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.cost.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.cost.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.completeness { - size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(v) = self.input_tokens { - ::buffa::types::put_uint64_field(1u32, v, buf); - } - if let Some(v) = self.output_tokens { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if let Some(v) = self.cache_creation_tokens { - ::buffa::types::put_uint64_field(3u32, v, buf); - } - if let Some(v) = self.cache_read_tokens { - ::buffa::types::put_uint64_field(4u32, v, buf); - } - if self.cost.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.cost.write_to(__cache, buf); - } - if let Some(ref v) = self.completeness { - ::buffa::types::put_int32_field(6u32, v.to_i32(), buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for TokenUsageView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - if let ::core::option::Option::Some(__v) = self.input_tokens { - __map - .serialize_entry( - "inputTokens", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.output_tokens { - __map - .serialize_entry( - "outputTokens", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.cache_creation_tokens { - __map - .serialize_entry( - "cacheCreationTokens", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - if let ::core::option::Option::Some(__v) = self.cache_read_tokens { - __map - .serialize_entry( - "cacheReadTokens", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.cost.as_option() { - __map.serialize_entry("cost", __v)?; - } - } - if let ::core::option::Option::Some(ref __v) = self.completeness { - __map.serialize_entry("completeness", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for TokenUsageView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "TokenUsage"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.TokenUsage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TokenUsage"; -} -::buffa::impl_default_view_instance!(TokenUsageView); -::buffa::impl_view_reborrow!(TokenUsageView); -/** Self-contained, `'static` owned view of a `TokenUsage` message. - - Wraps [`::buffa::OwnedView`]`<`[`TokenUsageView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TokenUsageView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct TokenUsageOwnedView(::buffa::OwnedView>); -impl TokenUsageOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TokenUsageOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TokenUsageOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::TokenUsage, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TokenUsageOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`TokenUsageView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &TokenUsageView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::TokenUsage { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Counters are intentionally not required: a provider may not report every - /// class (e.g. cache tokens), and edition-2024 presence distinguishes an unset - /// "not reported" counter from a reported 0. - /// - /// Field 1: `input_tokens` - #[must_use] - pub fn input_tokens(&self) -> ::core::option::Option { - self.0.reborrow().input_tokens - } - /// Field 2: `output_tokens` - #[must_use] - pub fn output_tokens(&self) -> ::core::option::Option { - self.0.reborrow().output_tokens - } - /// Field 3: `cache_creation_tokens` - #[must_use] - pub fn cache_creation_tokens(&self) -> ::core::option::Option { - self.0.reborrow().cache_creation_tokens - } - /// Field 4: `cache_read_tokens` - #[must_use] - pub fn cache_read_tokens(&self) -> ::core::option::Option { - self.0.reborrow().cache_read_tokens - } - /// Monetary cost of this usage, priced at generation time. Recorded as a fact so - /// a deterministic cost projection folds recorded amounts and never re-reads a - /// drifting price catalog. Unset when cost is not tracked. - /// - /// Field 5: `cost` - #[must_use] - pub fn cost( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().cost - } - /// Whether these counters are the provider's final accounting for the message - /// or a mid-generation reading. A partial reading exists so a turn that failed - /// or was interrupted still accounts for what it consumed, but summing partial - /// and final readings for the same message double-counts. Unset is read as - /// final, which is what every counter recorded before this field meant. - /// - /// Field 6: `completeness` - #[must_use] - pub fn completeness( - &self, - ) -> ::core::option::Option<::buffa::EnumValue> { - self.0.reborrow().completeness - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for TokenUsageOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - TokenUsageOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: TokenUsageOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for TokenUsageOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::TokenUsage { - type View<'a> = TokenUsageView<'a>; - type ViewHandle = TokenUsageOwnedView; -} -impl ::serde::Serialize for TokenUsageOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// Cost is a fixed-point monetary amount priced when the usage was recorded. -#[derive(Clone, Debug, Default)] -pub struct CostView<'a> { - /// Amount in millionths of one currency unit (micros); avoids floating point. - /// - /// Field 1: `amount_micros` - pub amount_micros: i64, - /// ISO 4217 currency code, for example "USD". - /// - /// Field 2: `currency_code` - pub currency_code: &'a str, - /// Reference to the price catalog or rate version applied; empty when untracked. - /// - /// Field 3: `rate_ref` - pub rate_ref: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> CostView<'a> { - /**Whether required field `amount_micros` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_amount_micros(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `currency_code` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_currency_code(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for CostView<'a> { - type Owned = super::super::Cost; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.amount_micros = ::buffa::types::decode_int64(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.currency_code = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.rate_ref = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::Cost { - amount_micros: self.amount_micros, - currency_code: self.currency_code.to_string(), - rate_ref: self.rate_ref.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for CostView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::int64_encoded_len(self.amount_micros) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.currency_code) as u64; - if let Some(ref v) = self.rate_ref { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int64_field(1u32, self.amount_micros, buf); - ::buffa::types::put_string_field(2u32, &self.currency_code, buf); - if let Some(ref v) = self.rate_ref { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for CostView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map - .serialize_entry( - "amountMicros", - &::buffa::json_helpers::ProtoJson(&self.amount_micros), - )?; - } - { - __map.serialize_entry("currencyCode", self.currency_code)?; - } - if let ::core::option::Option::Some(__v) = self.rate_ref { - __map.serialize_entry("rateRef", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for CostView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "Cost"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.Cost"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.Cost"; -} -::buffa::impl_default_view_instance!(CostView); -::buffa::impl_view_reborrow!(CostView); -/** Self-contained, `'static` owned view of a `Cost` message. - - Wraps [`::buffa::OwnedView`]`<`[`CostView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CostView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct CostOwnedView(::buffa::OwnedView>); -impl CostOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok(CostOwnedView(::buffa::OwnedView::decode(bytes)?)) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - CostOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::Cost, - ) -> ::core::result::Result { - ::core::result::Result::Ok(CostOwnedView(::buffa::OwnedView::from_owned(msg)?)) - } - /// Borrow the full [`CostView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &CostView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::Cost { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Amount in millionths of one currency unit (micros); avoids floating point. - /// - /// Field 1: `amount_micros` - #[must_use] - pub fn amount_micros(&self) -> i64 { - self.0.reborrow().amount_micros - } - /// ISO 4217 currency code, for example "USD". - /// - /// Field 2: `currency_code` - #[must_use] - pub fn currency_code(&self) -> &'_ str { - self.0.reborrow().currency_code - } - /// Reference to the price catalog or rate version applied; empty when untracked. - /// - /// Field 3: `rate_ref` - #[must_use] - pub fn rate_ref(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().rate_ref - } -} -impl ::core::convert::From<::buffa::OwnedView>> for CostOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - CostOwnedView(inner) - } -} -impl ::core::convert::From for ::buffa::OwnedView> { - fn from(wrapper: CostOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> for CostOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::Cost { - type View<'a> = CostView<'a>; - type ViewHandle = CostOwnedView; -} -impl ::serde::Serialize for CostOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.token_usage.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.token_usage.rs deleted file mode 100644 index 6204f8595..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.token_usage.rs +++ /dev/null @@ -1,633 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/token_usage.proto - -/// UsageCompleteness distinguishes a settled token accounting from a reading -/// taken while generation was still in flight. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum UsageCompleteness { - USAGE_COMPLETENESS_UNSPECIFIED = 0i32, - /// The provider's final accounting for the message; safe to sum. - USAGE_COMPLETENESS_FINAL = 1i32, - /// A reading taken before the message settled; superseded by any later final - /// accounting for the same message and never summed with one. - USAGE_COMPLETENESS_PARTIAL = 2i32, -} -impl UsageCompleteness { - ///Idiomatic alias for [`Self::USAGE_COMPLETENESS_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::USAGE_COMPLETENESS_UNSPECIFIED; - ///Idiomatic alias for [`Self::USAGE_COMPLETENESS_FINAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Final: Self = Self::USAGE_COMPLETENESS_FINAL; - ///Idiomatic alias for [`Self::USAGE_COMPLETENESS_PARTIAL`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Partial: Self = Self::USAGE_COMPLETENESS_PARTIAL; -} -impl ::core::default::Default for UsageCompleteness { - fn default() -> Self { - Self::USAGE_COMPLETENESS_UNSPECIFIED - } -} -impl ::serde::Serialize for UsageCompleteness { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for UsageCompleteness { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = UsageCompleteness; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(UsageCompleteness) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for UsageCompleteness { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for UsageCompleteness { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::USAGE_COMPLETENESS_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::USAGE_COMPLETENESS_FINAL), - 2i32 => ::core::option::Option::Some(Self::USAGE_COMPLETENESS_PARTIAL), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::USAGE_COMPLETENESS_UNSPECIFIED => "USAGE_COMPLETENESS_UNSPECIFIED", - Self::USAGE_COMPLETENESS_FINAL => "USAGE_COMPLETENESS_FINAL", - Self::USAGE_COMPLETENESS_PARTIAL => "USAGE_COMPLETENESS_PARTIAL", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "USAGE_COMPLETENESS_UNSPECIFIED" => { - ::core::option::Option::Some(Self::USAGE_COMPLETENESS_UNSPECIFIED) - } - "USAGE_COMPLETENESS_FINAL" => { - ::core::option::Option::Some(Self::USAGE_COMPLETENESS_FINAL) - } - "USAGE_COMPLETENESS_PARTIAL" => { - ::core::option::Option::Some(Self::USAGE_COMPLETENESS_PARTIAL) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::USAGE_COMPLETENESS_UNSPECIFIED, - Self::USAGE_COMPLETENESS_FINAL, - Self::USAGE_COMPLETENESS_PARTIAL, - ] - } -} -/// TokenUsage is the token accounting recorded for one completed assistant -/// message; audit and budgeting input, never an identity or ordering input. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct TokenUsage { - /// Counters are intentionally not required: a provider may not report every - /// class (e.g. cache tokens), and edition-2024 presence distinguishes an unset - /// "not reported" counter from a reported 0. - /// - /// Field 1: `input_tokens` - #[serde( - rename = "inputTokens", - alias = "input_tokens", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub input_tokens: ::core::option::Option, - /// Field 2: `output_tokens` - #[serde( - rename = "outputTokens", - alias = "output_tokens", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub output_tokens: ::core::option::Option, - /// Field 3: `cache_creation_tokens` - #[serde( - rename = "cacheCreationTokens", - alias = "cache_creation_tokens", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub cache_creation_tokens: ::core::option::Option, - /// Field 4: `cache_read_tokens` - #[serde( - rename = "cacheReadTokens", - alias = "cache_read_tokens", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub cache_read_tokens: ::core::option::Option, - /// Monetary cost of this usage, priced at generation time. Recorded as a fact so - /// a deterministic cost projection folds recorded amounts and never re-reads a - /// drifting price catalog. Unset when cost is not tracked. - /// - /// Field 5: `cost` - #[serde( - rename = "cost", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub cost: ::buffa::MessageField>, - /// Whether these counters are the provider's final accounting for the message - /// or a mid-generation reading. A partial reading exists so a turn that failed - /// or was interrupted still accounts for what it consumed, but summing partial - /// and final readings for the same message double-counts. Unset is read as - /// final, which is what every counter recorded before this field meant. - /// - /// Field 6: `completeness` - #[serde( - rename = "completeness", - with = "::buffa::json_helpers::opt_enum", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub completeness: ::core::option::Option<::buffa::EnumValue>, -} -impl ::core::fmt::Debug for TokenUsage { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("TokenUsage") - .field("input_tokens", &self.input_tokens) - .field("output_tokens", &self.output_tokens) - .field("cache_creation_tokens", &self.cache_creation_tokens) - .field("cache_read_tokens", &self.cache_read_tokens) - .field("cost", &self.cost) - .field("completeness", &self.completeness) - .finish() - } -} -impl TokenUsage { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TokenUsage"; -} -impl TokenUsage { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::input_tokens`] to `Some(value)`, consuming and returning `self`. - pub fn with_input_tokens(mut self, value: u64) -> Self { - self.input_tokens = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::output_tokens`] to `Some(value)`, consuming and returning `self`. - pub fn with_output_tokens(mut self, value: u64) -> Self { - self.output_tokens = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::cache_creation_tokens`] to `Some(value)`, consuming and returning `self`. - pub fn with_cache_creation_tokens(mut self, value: u64) -> Self { - self.cache_creation_tokens = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::cache_read_tokens`] to `Some(value)`, consuming and returning `self`. - pub fn with_cache_read_tokens(mut self, value: u64) -> Self { - self.cache_read_tokens = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::completeness`] to `Some(value)`, consuming and returning `self`. - pub fn with_completeness( - mut self, - value: impl Into<::buffa::EnumValue>, - ) -> Self { - self.completeness = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(TokenUsage); -impl ::buffa::MessageName for TokenUsage { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "TokenUsage"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.TokenUsage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TokenUsage"; -} -impl ::buffa::Message for TokenUsage { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let Some(v) = self.input_tokens { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.output_tokens { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.cache_creation_tokens { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if let Some(v) = self.cache_read_tokens { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - if self.cost.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.cost.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.completeness { - size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let Some(v) = self.input_tokens { - ::buffa::types::put_uint64_field(1u32, v, buf); - } - if let Some(v) = self.output_tokens { - ::buffa::types::put_uint64_field(2u32, v, buf); - } - if let Some(v) = self.cache_creation_tokens { - ::buffa::types::put_uint64_field(3u32, v, buf); - } - if let Some(v) = self.cache_read_tokens { - ::buffa::types::put_uint64_field(4u32, v, buf); - } - if self.cost.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.cost.write_to(__cache, buf); - } - if let Some(ref v) = self.completeness { - ::buffa::types::put_int32_field(6u32, v.to_i32(), buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.input_tokens = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.output_tokens = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.cache_creation_tokens = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.cache_read_tokens = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.cost.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.completeness = ::core::option::Option::Some( - ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?), - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.input_tokens = ::core::option::Option::None; - self.output_tokens = ::core::option::Option::None; - self.cache_creation_tokens = ::core::option::Option::None; - self.cache_read_tokens = ::core::option::Option::None; - self.cost = ::buffa::MessageField::none(); - self.completeness = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for TokenUsage { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TOKEN_USAGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.TokenUsage", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// Cost is a fixed-point monetary amount priced when the usage was recorded. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct Cost { - /// Amount in millionths of one currency unit (micros); avoids floating point. - /// - /// Field 1: `amount_micros` - #[serde( - rename = "amountMicros", - alias = "amount_micros", - with = "::buffa::json_helpers::int64" - )] - pub amount_micros: i64, - /// ISO 4217 currency code, for example "USD". - /// - /// Field 2: `currency_code` - #[serde( - rename = "currencyCode", - alias = "currency_code", - with = "::buffa::json_helpers::proto_string" - )] - pub currency_code: ::buffa::alloc::string::String, - /// Reference to the price catalog or rate version applied; empty when untracked. - /// - /// Field 3: `rate_ref` - #[serde( - rename = "rateRef", - alias = "rate_ref", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub rate_ref: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for Cost { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Cost") - .field("amount_micros", &self.amount_micros) - .field("currency_code", &self.currency_code) - .field("rate_ref", &self.rate_ref) - .finish() - } -} -impl Cost { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.Cost"; -} -impl Cost { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::rate_ref`] to `Some(value)`, consuming and returning `self`. - pub fn with_rate_ref( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.rate_ref = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(Cost); -impl ::buffa::MessageName for Cost { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "Cost"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.Cost"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.Cost"; -} -impl ::buffa::Message for Cost { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::int64_encoded_len(self.amount_micros) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.currency_code) as u64; - if let Some(ref v) = self.rate_ref { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int64_field(1u32, self.amount_micros, buf); - ::buffa::types::put_string_field(2u32, &self.currency_code, buf); - if let Some(ref v) = self.rate_ref { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.amount_micros = ::buffa::types::decode_int64(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.currency_code, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .rate_ref - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.amount_micros = 0i64; - self.currency_code.clear(); - self.rate_ref = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for Cost { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __COST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.Cost", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call.__oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call.__oneof.rs deleted file mode 100644 index abe9ee999..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call.__oneof.rs +++ /dev/null @@ -1,51 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call.proto - -pub mod tool_call_result { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, PartialEq, Debug)] - pub enum Kind { - Text(::buffa::alloc::boxed::Box), - ArtifactRef(::buffa::alloc::boxed::Box), - } - impl ::buffa::Oneof for Kind {} - impl From for Kind { - fn from(v: super::super::super::TextToolResult) -> Self { - Self::Text(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::TextToolResult) -> Self { - Self::Some(Kind::from(v)) - } - } - impl From for Kind { - fn from(v: super::super::super::ArtifactRef) -> Self { - Self::ArtifactRef(::buffa::alloc::boxed::Box::new(v)) - } - } - impl From for ::core::option::Option { - fn from(v: super::super::super::ArtifactRef) -> Self { - Self::Some(Kind::from(v)) - } - } - impl serde::Serialize for Kind { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - use serde::ser::SerializeMap; - let mut map = s.serialize_map(Some(1))?; - match self { - Self::Text(v) => { - map.serialize_entry("text", v)?; - } - Self::ArtifactRef(v) => { - map.serialize_entry("artifactRef", v)?; - } - } - map.end() - } - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call.__view.rs deleted file mode 100644 index d59a5d5b4..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call.__view.rs +++ /dev/null @@ -1,699 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call.proto - -/// ToolCallResult is the typed outcome of a completed tool call: either inline -/// text or a claim-check reference to a stored artifact, plus a status outside -/// the content oneof so an artifact-backed result can also represent an -/// application-level error (D11) -- ToolCallResultStatus.status carries what -/// TextToolResult.is_error used to carry alone, now applicable to either arm. -#[derive(Clone, Debug, Default)] -pub struct ToolCallResultView<'a> { - /// Field 3: `status` - pub status: ::buffa::EnumValue, - pub kind: ::core::option::Option< - super::super::__buffa::view::oneof::tool_call_result::Kind<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ToolCallResultView<'a> { - /**Whether required field `status` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_status(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ToolCallResultView<'a> { - type Owned = super::super::ToolCallResult; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.status = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::tool_call_result::Kind::Text( - ref mut existing, - ), - ) = view.kind - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.kind = Some( - super::super::__buffa::view::oneof::tool_call_result::Kind::Text( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - if let Some( - super::super::__buffa::view::oneof::tool_call_result::Kind::ArtifactRef( - ref mut existing, - ), - ) = view.kind - { - ::buffa::MessageView::merge_into_view( - &mut **existing, - sub, - __sub_ctx, - )?; - } else { - view.kind = Some( - super::super::__buffa::view::oneof::tool_call_result::Kind::ArtifactRef( - ::buffa::alloc::boxed::Box::new( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ), - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ToolCallResult { - status: self.status, - kind: match self.kind.as_ref() { - ::core::option::Option::Some(v) => { - ::core::option::Option::Some( - match v { - super::super::__buffa::view::oneof::tool_call_result::Kind::Text( - v, - ) => { - super::super::__buffa::oneof::tool_call_result::Kind::Text( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - super::super::__buffa::view::oneof::tool_call_result::Kind::ArtifactRef( - v, - ) => { - super::super::__buffa::oneof::tool_call_result::Kind::ArtifactRef( - ::buffa::alloc::boxed::Box::new( - v.to_owned_from_source(__buffa_src)?, - ), - ) - } - }, - ) - } - ::core::option::Option::None => ::core::option::Option::None, - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ToolCallResultView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let ::core::option::Option::Some(ref v) = self.kind { - match v { - super::super::__buffa::view::oneof::tool_call_result::Kind::Text(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - super::super::__buffa::view::oneof::tool_call_result::Kind::ArtifactRef( - x, - ) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - { - let val = self.status.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let ::core::option::Option::Some(ref v) = self.kind { - match v { - super::super::__buffa::view::oneof::tool_call_result::Kind::Text(x) => { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - super::super::__buffa::view::oneof::tool_call_result::Kind::ArtifactRef( - x, - ) => { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - ::buffa::types::put_int32_field(3u32, self.status.to_i32(), buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ToolCallResultView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("status", &self.status)?; - } - if let ::core::option::Option::Some(ref __ov) = self.kind { - match __ov { - super::super::__buffa::view::oneof::tool_call_result::Kind::Text(v) => { - __map.serialize_entry("text", v)?; - } - super::super::__buffa::view::oneof::tool_call_result::Kind::ArtifactRef( - v, - ) => { - __map.serialize_entry("artifactRef", v)?; - } - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ToolCallResultView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallResult"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallResult"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallResult"; -} -::buffa::impl_default_view_instance!(ToolCallResultView); -::buffa::impl_view_reborrow!(ToolCallResultView); -/** Self-contained, `'static` owned view of a `ToolCallResult` message. - - Wraps [`::buffa::OwnedView`]`<`[`ToolCallResultView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ToolCallResultView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ToolCallResultOwnedView(::buffa::OwnedView>); -impl ToolCallResultOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallResultOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallResultOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ToolCallResult, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallResultOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ToolCallResultView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ToolCallResultView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ToolCallResult { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 3: `status` - #[must_use] - pub fn status(&self) -> ::buffa::EnumValue { - self.0.reborrow().status - } - /// Oneof `kind`. - #[must_use] - pub fn kind( - &self, - ) -> ::core::option::Option< - &super::super::__buffa::view::oneof::tool_call_result::Kind<'_>, - > { - self.0.reborrow().kind.as_ref() - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ToolCallResultOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ToolCallResultOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ToolCallResultOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ToolCallResultOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ToolCallResult { - type View<'a> = ToolCallResultView<'a>; - type ViewHandle = ToolCallResultOwnedView; -} -impl ::serde::Serialize for ToolCallResultOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// TextToolResult is an inline text tool result. -#[derive(Clone, Debug, Default)] -pub struct TextToolResultView<'a> { - /// Result text. - /// - /// Field 1: `content` - pub content: &'a str, - /// True when content is a truncation of the full result. - /// - /// Field 2: `truncated` - pub truncated: ::core::option::Option, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> TextToolResultView<'a> { - /**Whether required field `content` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_content(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for TextToolResultView<'a> { - type Owned = super::super::TextToolResult; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.content = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.truncated = Some(::buffa::types::decode_bool(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::TextToolResult { - content: self.content.to_string(), - truncated: self.truncated, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for TextToolResultView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.content) as u64; - if self.truncated.is_some() { - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.content, buf); - if let Some(v) = self.truncated { - ::buffa::types::put_bool_field(2u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for TextToolResultView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("content", self.content)?; - } - if let ::core::option::Option::Some(__v) = self.truncated { - __map.serialize_entry("truncated", &__v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for TextToolResultView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "TextToolResult"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.TextToolResult"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TextToolResult"; -} -::buffa::impl_default_view_instance!(TextToolResultView); -::buffa::impl_view_reborrow!(TextToolResultView); -/** Self-contained, `'static` owned view of a `TextToolResult` message. - - Wraps [`::buffa::OwnedView`]`<`[`TextToolResultView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TextToolResultView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct TextToolResultOwnedView(::buffa::OwnedView>); -impl TextToolResultOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TextToolResultOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TextToolResultOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::TextToolResult, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - TextToolResultOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`TextToolResultView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &TextToolResultView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::TextToolResult { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Result text. - /// - /// Field 1: `content` - #[must_use] - pub fn content(&self) -> &'_ str { - self.0.reborrow().content - } - /// True when content is a truncation of the full result. - /// - /// Field 2: `truncated` - #[must_use] - pub fn truncated(&self) -> ::core::option::Option { - self.0.reborrow().truncated - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for TextToolResultOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - TextToolResultOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: TextToolResultOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for TextToolResultOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::TextToolResult { - type View<'a> = TextToolResultView<'a>; - type ViewHandle = TextToolResultOwnedView; -} -impl ::serde::Serialize for TextToolResultOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call.__view_oneof.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call.__view_oneof.rs deleted file mode 100644 index faa3125f7..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call.__view_oneof.rs +++ /dev/null @@ -1,20 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call.proto - -pub mod tool_call_result { - #[allow(unused_imports)] - use super::*; - #[derive(Clone, Debug)] - pub enum Kind<'a> { - Text( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::TextToolResultView<'a>, - >, - ), - ArtifactRef( - ::buffa::alloc::boxed::Box< - super::super::super::super::__buffa::view::ArtifactRefView<'a>, - >, - ), - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call.rs deleted file mode 100644 index c1d0e2f44..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call.rs +++ /dev/null @@ -1,619 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call.proto - -/// ToolCallResultStatus is whether a completed tool call's result represents a -/// genuine success or an application-level error surfaced through its result -/// content (mirrors the MCP tool-result isError flag). -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ToolCallResultStatus { - TOOL_CALL_RESULT_STATUS_UNSPECIFIED = 0i32, - TOOL_CALL_RESULT_STATUS_SUCCESS = 1i32, - TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR = 2i32, -} -impl ToolCallResultStatus { - ///Idiomatic alias for [`Self::TOOL_CALL_RESULT_STATUS_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::TOOL_CALL_RESULT_STATUS_UNSPECIFIED; - ///Idiomatic alias for [`Self::TOOL_CALL_RESULT_STATUS_SUCCESS`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Success: Self = Self::TOOL_CALL_RESULT_STATUS_SUCCESS; - ///Idiomatic alias for [`Self::TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ApplicationError: Self = Self::TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR; -} -impl ::core::default::Default for ToolCallResultStatus { - fn default() -> Self { - Self::TOOL_CALL_RESULT_STATUS_UNSPECIFIED - } -} -impl ::serde::Serialize for ToolCallResultStatus { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ToolCallResultStatus { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ToolCallResultStatus; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(ToolCallResultStatus) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolCallResultStatus { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ToolCallResultStatus { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some(Self::TOOL_CALL_RESULT_STATUS_UNSPECIFIED) - } - 1i32 => ::core::option::Option::Some(Self::TOOL_CALL_RESULT_STATUS_SUCCESS), - 2i32 => { - ::core::option::Option::Some( - Self::TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR, - ) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::TOOL_CALL_RESULT_STATUS_UNSPECIFIED => { - "TOOL_CALL_RESULT_STATUS_UNSPECIFIED" - } - Self::TOOL_CALL_RESULT_STATUS_SUCCESS => "TOOL_CALL_RESULT_STATUS_SUCCESS", - Self::TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR => { - "TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "TOOL_CALL_RESULT_STATUS_UNSPECIFIED" => { - ::core::option::Option::Some(Self::TOOL_CALL_RESULT_STATUS_UNSPECIFIED) - } - "TOOL_CALL_RESULT_STATUS_SUCCESS" => { - ::core::option::Option::Some(Self::TOOL_CALL_RESULT_STATUS_SUCCESS) - } - "TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR" => { - ::core::option::Option::Some( - Self::TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR, - ) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::TOOL_CALL_RESULT_STATUS_UNSPECIFIED, - Self::TOOL_CALL_RESULT_STATUS_SUCCESS, - Self::TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR, - ] - } -} -/// ToolCallResult is the typed outcome of a completed tool call: either inline -/// text or a claim-check reference to a stored artifact, plus a status outside -/// the content oneof so an artifact-backed result can also represent an -/// application-level error (D11) -- ToolCallResultStatus.status carries what -/// TextToolResult.is_error used to carry alone, now applicable to either arm. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize)] -#[serde(default)] -pub struct ToolCallResult { - /// Field 3: `status` - #[serde(rename = "status", with = "::buffa::json_helpers::proto_enum")] - pub status: ::buffa::EnumValue, - #[serde(flatten)] - pub kind: ::core::option::Option<__buffa::oneof::tool_call_result::Kind>, -} -impl ::core::fmt::Debug for ToolCallResult { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ToolCallResult") - .field("status", &self.status) - .field("kind", &self.kind) - .finish() - } -} -impl ToolCallResult { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallResult"; -} -::buffa::impl_default_instance!(ToolCallResult); -impl ::buffa::MessageName for ToolCallResult { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallResult"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallResult"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallResult"; -} -impl ::buffa::Message for ToolCallResult { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - if let ::core::option::Option::Some(ref v) = self.kind { - match v { - __buffa::oneof::tool_call_result::Kind::Text(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - __buffa::oneof::tool_call_result::Kind::ArtifactRef(x) => { - let __slot = __cache.reserve(); - let inner = x.compute_size(__cache); - __cache.set(__slot, inner); - size - += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 - + inner as u64; - } - } - } - { - let val = self.status.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - if let ::core::option::Option::Some(ref v) = self.kind { - match v { - __buffa::oneof::tool_call_result::Kind::Text(x) => { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - __buffa::oneof::tool_call_result::Kind::ArtifactRef(x) => { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - x.write_to(__cache, buf); - } - } - } - ::buffa::types::put_int32_field(3u32, self.status.to_i32(), buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::tool_call_result::Kind::Text(ref mut existing), - ) = self.kind - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.kind = ::core::option::Option::Some( - __buffa::oneof::tool_call_result::Kind::Text( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - if let ::core::option::Option::Some( - __buffa::oneof::tool_call_result::Kind::ArtifactRef(ref mut existing), - ) = self.kind - { - ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; - } else { - let mut val = ::core::default::Default::default(); - ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; - self.kind = ::core::option::Option::Some( - __buffa::oneof::tool_call_result::Kind::ArtifactRef( - ::buffa::alloc::boxed::Box::new(val), - ), - ); - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.status = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.kind = ::core::option::Option::None; - self.status = ::buffa::EnumValue::from(0); - } -} -impl<'de> serde::Deserialize<'de> for ToolCallResult { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl<'de> serde::de::Visitor<'de> for _V { - type Value = ToolCallResult; - fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str("struct ToolCallResult") - } - #[allow(clippy::field_reassign_with_default)] - fn visit_map>( - self, - mut map: A, - ) -> ::core::result::Result { - let mut __f_status: ::core::option::Option< - ::buffa::EnumValue, - > = None; - let mut __oneof_kind: ::core::option::Option< - __buffa::oneof::tool_call_result::Kind, - > = None; - while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? { - match key.as_str() { - "status" => { - __f_status = Some({ - struct _S; - impl<'de> serde::de::DeserializeSeed<'de> for _S { - type Value = ::buffa::EnumValue; - fn deserialize>( - self, - d: D, - ) -> ::core::result::Result< - ::buffa::EnumValue, - D::Error, - > { - ::buffa::json_helpers::proto_enum::deserialize(d) - } - } - map.next_value_seed(_S)? - }); - } - "text" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - TextToolResult, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_kind.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'kind'", - ), - ); - } - __oneof_kind = Some( - __buffa::oneof::tool_call_result::Kind::Text( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - "artifactRef" | "artifact_ref" => { - let v: ::core::option::Option = map - .next_value_seed( - ::buffa::json_helpers::NullableDeserializeSeed( - ::buffa::json_helpers::DefaultDeserializeSeed::< - ArtifactRef, - >::new(), - ), - )?; - if let Some(v) = v { - if __oneof_kind.is_some() { - return Err( - serde::de::Error::custom( - "multiple oneof fields set for 'kind'", - ), - ); - } - __oneof_kind = Some( - __buffa::oneof::tool_call_result::Kind::ArtifactRef( - ::buffa::alloc::boxed::Box::new(v), - ), - ); - } - } - _ => { - map.next_value::()?; - } - } - } - let mut __r = ::default(); - if let ::core::option::Option::Some(v) = __f_status { - __r.status = v; - } - __r.kind = __oneof_kind; - Ok(__r) - } - } - d.deserialize_map(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolCallResult { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TOOL_CALL_RESULT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallResult", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -pub mod tool_call_result { - #[allow(unused_imports)] - use super::*; - #[doc(inline)] - pub use super::__buffa::oneof::tool_call_result::Kind; - #[doc(inline)] - pub use super::__buffa::view::oneof::tool_call_result::Kind as KindView; -} -/// TextToolResult is an inline text tool result. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct TextToolResult { - /// Result text. - /// - /// Field 1: `content` - #[serde(rename = "content", with = "::buffa::json_helpers::proto_string")] - pub content: ::buffa::alloc::string::String, - /// True when content is a truncation of the full result. - /// - /// Field 2: `truncated` - #[serde( - rename = "truncated", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub truncated: ::core::option::Option, -} -impl ::core::fmt::Debug for TextToolResult { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("TextToolResult") - .field("content", &self.content) - .field("truncated", &self.truncated) - .finish() - } -} -impl TextToolResult { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TextToolResult"; -} -impl TextToolResult { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::truncated`] to `Some(value)`, consuming and returning `self`. - pub fn with_truncated(mut self, value: bool) -> Self { - self.truncated = Some(value); - self - } -} -::buffa::impl_default_instance!(TextToolResult); -impl ::buffa::MessageName for TextToolResult { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "TextToolResult"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.TextToolResult"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.TextToolResult"; -} -impl ::buffa::Message for TextToolResult { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.content) as u64; - if self.truncated.is_some() { - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.content, buf); - if let Some(v) = self.truncated { - ::buffa::types::put_bool_field(2u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.content, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.truncated = ::core::option::Option::Some( - ::buffa::types::decode_bool(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.content.clear(); - self.truncated = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for TextToolResult { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TEXT_TOOL_RESULT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.TextToolResult", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_approved.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_approved.__view.rs deleted file mode 100644 index 36a10cebb..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_approved.__view.rs +++ /dev/null @@ -1,380 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call_approved.proto - -/// ToolCallApproved records that a requested tool call was approved. Approval -/// and denial are mutually exclusive human-paced decisions guarding a -/// transition whose outcome depends on current lifecycle state, so it is -/// invariant-bearing (WRITE_PRECONDITION = At, ADR#0035 facet 2), not a -/// commuting happened-fact. -#[derive(Clone, Debug, Default)] -pub struct ToolCallApprovedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Field 3: `tool_execution_id` - pub tool_execution_id: &'a str, - /// Field 4: `approved_by` - pub approved_by: &'a str, - /// Turn the approved call belongs to (see UserMessageRecorded.turn_id). - /// Optional here, unlike on the lifecycle events the agent loop writes: an - /// approval may be recorded by an external approver that holds the call - /// identity without the turn context, and forcing a value would invite a - /// fabricated one. - /// - /// Field 5: `turn_id` - pub turn_id: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ToolCallApprovedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_execution_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_execution_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `approved_by` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_approved_by(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ToolCallApprovedView<'a> { - type Owned = super::super::ToolCallApproved; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_execution_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.approved_by = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ToolCallApproved { - session_id: self.session_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - tool_execution_id: self.tool_execution_id.to_string(), - approved_by: self.approved_by.to_string(), - turn_id: self.turn_id.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ToolCallApprovedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.approved_by) as u64; - if let Some(ref v) = self.turn_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.approved_by, buf); - if let Some(ref v) = self.turn_id { - ::buffa::types::put_string_field(5u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ToolCallApprovedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolExecutionId", self.tool_execution_id)?; - } - { - __map.serialize_entry("approvedBy", self.approved_by)?; - } - if let ::core::option::Option::Some(__v) = self.turn_id { - __map.serialize_entry("turnId", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ToolCallApprovedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallApproved"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallApproved"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallApproved"; -} -::buffa::impl_default_view_instance!(ToolCallApprovedView); -::buffa::impl_view_reborrow!(ToolCallApprovedView); -/** Self-contained, `'static` owned view of a `ToolCallApproved` message. - - Wraps [`::buffa::OwnedView`]`<`[`ToolCallApprovedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ToolCallApprovedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ToolCallApprovedOwnedView(::buffa::OwnedView>); -impl ToolCallApprovedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallApprovedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallApprovedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ToolCallApproved, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallApprovedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ToolCallApprovedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ToolCallApprovedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ToolCallApproved { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Field 3: `tool_execution_id` - #[must_use] - pub fn tool_execution_id(&self) -> &'_ str { - self.0.reborrow().tool_execution_id - } - /// Field 4: `approved_by` - #[must_use] - pub fn approved_by(&self) -> &'_ str { - self.0.reborrow().approved_by - } - /// Turn the approved call belongs to (see UserMessageRecorded.turn_id). - /// Optional here, unlike on the lifecycle events the agent loop writes: an - /// approval may be recorded by an external approver that holds the call - /// identity without the turn context, and forcing a value would invite a - /// fabricated one. - /// - /// Field 5: `turn_id` - #[must_use] - pub fn turn_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ToolCallApprovedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ToolCallApprovedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ToolCallApprovedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ToolCallApprovedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ToolCallApproved { - type View<'a> = ToolCallApprovedView<'a>; - type ViewHandle = ToolCallApprovedOwnedView; -} -impl ::serde::Serialize for ToolCallApprovedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_approved.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_approved.rs deleted file mode 100644 index bb0fcb22b..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_approved.rs +++ /dev/null @@ -1,212 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call_approved.proto - -/// ToolCallApproved records that a requested tool call was approved. Approval -/// and denial are mutually exclusive human-paced decisions guarding a -/// transition whose outcome depends on current lifecycle state, so it is -/// invariant-bearing (WRITE_PRECONDITION = At, ADR#0035 facet 2), not a -/// commuting happened-fact. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ToolCallApproved { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Field 3: `tool_execution_id` - #[serde( - rename = "toolExecutionId", - alias = "tool_execution_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_execution_id: ::buffa::alloc::string::String, - /// Field 4: `approved_by` - #[serde( - rename = "approvedBy", - alias = "approved_by", - with = "::buffa::json_helpers::proto_string" - )] - pub approved_by: ::buffa::alloc::string::String, - /// Turn the approved call belongs to (see UserMessageRecorded.turn_id). - /// Optional here, unlike on the lifecycle events the agent loop writes: an - /// approval may be recorded by an external approver that holds the call - /// identity without the turn context, and forcing a value would invite a - /// fabricated one. - /// - /// Field 5: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub turn_id: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for ToolCallApproved { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ToolCallApproved") - .field("session_id", &self.session_id) - .field("tool_call_id", &self.tool_call_id) - .field("tool_execution_id", &self.tool_execution_id) - .field("approved_by", &self.approved_by) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl ToolCallApproved { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallApproved"; -} -impl ToolCallApproved { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::turn_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_turn_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.turn_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ToolCallApproved); -impl ::buffa::MessageName for ToolCallApproved { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallApproved"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallApproved"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallApproved"; -} -impl ::buffa::Message for ToolCallApproved { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.approved_by) as u64; - if let Some(ref v) = self.turn_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.approved_by, buf); - if let Some(ref v) = self.turn_id { - ::buffa::types::put_string_field(5u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_execution_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.approved_by, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.turn_id.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.tool_call_id.clear(); - self.tool_execution_id.clear(); - self.approved_by.clear(); - self.turn_id = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolCallApproved { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TOOL_CALL_APPROVED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallApproved", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_completed.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_completed.__view.rs deleted file mode 100644 index 42ebfa69a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_completed.__view.rs +++ /dev/null @@ -1,967 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call_completed.proto - -/// ToolCallCompleted records that a tool call finished successfully. Per -/// tool_execution_id, this competes with ToolCallFailed under a -/// first-terminal-outcome-wins fold rule: the first of the two to appear in -/// fold order is authoritative, and a later conflicting outcome is retained as -/// audit-only, surfaced by a projection flag, never folded into state (D4). It -/// is a commuting happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, Debug, Default)] -pub struct ToolCallCompletedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Field 3: `tool_execution_id` - pub tool_execution_id: &'a str, - /// Field 4: `result` - pub result: ::buffa::MessageFieldView< - super::super::__buffa::view::ToolCallResultView<'a>, - >, - /// Turn this call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 5: `turn_id` - pub turn_id: &'a str, - /// How the process ended, for a tool that executes one; unset for every other - /// tool. A command that ran and exited non-zero completes here with result - /// status TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR and a termination set; a - /// command that never ran is a ToolCallFailed and has none. - /// - /// Field 6: `termination` - pub termination: ::buffa::MessageFieldView< - super::super::__buffa::view::CommandTerminationView<'a>, - >, - /// Wall-clock execution time from start to this completion. Recorded rather - /// than derived from the two events' append times, which measure when the - /// writer got its append acknowledged, not how long the tool ran (D10). - /// - /// Field 7: `duration` - pub duration: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, - /// Resources this call put into the model's context, with the digest each - /// hashed to when it was read. Empty for a call that observed nothing. - /// - /// Field 8: `observed` - pub observed: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::ResourceObservationView<'a>, - >, - /// Claim-check to this command's captured stdout and stderr, for a tool that - /// executes a process and captured it; unset otherwise, including for a - /// command that ran with capture disabled. - /// - /// It sits here beside `termination` and not inside `result` for the reason - /// `termination` does (D11): captured output is the execution record, while - /// `result` is the transcript the model received. They routinely differ, since - /// what reaches the model is truncated or summarized, and folding raw output - /// into the replay shape would hand a later turn context the original turn - /// never had. - /// - /// Field 9: `output_replay` - pub output_replay: ::buffa::MessageFieldView< - super::super::__buffa::view::CommandOutputReplayRefView<'a>, - >, - /// Set when this call returned a handle to work that outlived the turn. Unset - /// is the ordinary case and means the call's result is its outcome; set means - /// the result is a handle and the outcome arrives later through the operation - /// ledger. - /// - /// Field 10: `detached` - pub detached: ::buffa::MessageFieldView< - super::super::__buffa::view::DetachedWorkView<'a>, - >, - /// Namespaces this call listed, searched, or otherwise touched, as distinct - /// from the content it read. Empty for a call that accessed no namespace. - /// - /// Field 11: `accessed` - pub accessed: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::ResourceAccessRecordView<'a>, - >, - /// Targets of a multi-resource call that did not apply. Empty when every target - /// succeeded, and empty is also correct for a single-target call, which has - /// nothing partial to report. - /// - /// Successes are deliberately absent: they are already FileChanged facts, and a - /// second record of the same change is a second thing to keep consistent - /// through rewind and redaction. - /// - /// Field 12: `failed_targets` - pub failed_targets: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::TargetOutcomeView<'a>, - >, - /// How many targets the call set out to apply, recorded so failed_targets can - /// be read as a fraction. Zero for a call with no target list, which is not the - /// same as a call that attempted zero targets and is why the count is here - /// rather than inferred from an empty list. - /// - /// Field 13: `targets_attempted` - pub targets_attempted: ::core::option::Option, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ToolCallCompletedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_execution_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_execution_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `result` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_result(&self) -> bool { - self.result.is_set() - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ToolCallCompletedView<'a> { - type Owned = super::super::ToolCallCompleted; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_execution_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.result.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.result = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.termination.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.termination = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.duration.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.duration = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.output_replay.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.output_replay = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.detached.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.detached = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.targets_attempted = Some(::buffa::types::decode_uint32(&mut cur)?); - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::ResourceObservationView, - >(), - )?; - view.observed - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::ResourceAccessRecordView, - >(), - )?; - view.accessed - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::TargetOutcomeView, - >(), - )?; - view.failed_targets - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ToolCallCompleted { - session_id: self.session_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - tool_execution_id: self.tool_execution_id.to_string(), - result: match self.result.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ToolCallResult, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - turn_id: self.turn_id.to_string(), - termination: match self.termination.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CommandTermination, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - duration: match self.duration.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - observed: self - .observed - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - output_replay: match self.output_replay.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CommandOutputReplayRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - detached: match self.detached.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::DetachedWork, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - accessed: self - .accessed - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - failed_targets: self - .failed_targets - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - targets_attempted: self.targets_attempted, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ToolCallCompletedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - if self.result.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.result.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if self.termination.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.termination.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.duration.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.duration.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.observed { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.output_replay.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.output_replay.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.detached.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.detached.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.accessed { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.failed_targets { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(v) = self.targets_attempted { - size += 1u64 + ::buffa::types::uint32_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - if self.result.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.result.write_to(__cache, buf); - } - ::buffa::types::put_string_field(5u32, &self.turn_id, buf); - if self.termination.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.termination.write_to(__cache, buf); - } - if self.duration.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.duration.write_to(__cache, buf); - } - for v in &self.observed { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if self.output_replay.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.output_replay.write_to(__cache, buf); - } - if self.detached.is_set() { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - self.detached.write_to(__cache, buf); - } - for v in &self.accessed { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.failed_targets { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if let Some(v) = self.targets_attempted { - ::buffa::types::put_uint32_field(13u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ToolCallCompletedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolExecutionId", self.tool_execution_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.result.as_option() { - __map.serialize_entry("result", __v)?; - } - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.termination.as_option() { - __map.serialize_entry("termination", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.duration.as_option() { - __map.serialize_entry("duration", __v)?; - } - } - if !self.observed.is_empty() { - __map.serialize_entry("observed", &*self.observed)?; - } - { - if let ::core::option::Option::Some(__v) = self.output_replay.as_option() { - __map.serialize_entry("outputReplay", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.detached.as_option() { - __map.serialize_entry("detached", __v)?; - } - } - if !self.accessed.is_empty() { - __map.serialize_entry("accessed", &*self.accessed)?; - } - if !self.failed_targets.is_empty() { - __map.serialize_entry("failedTargets", &*self.failed_targets)?; - } - if let ::core::option::Option::Some(__v) = self.targets_attempted { - __map - .serialize_entry( - "targetsAttempted", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ToolCallCompletedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallCompleted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallCompleted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallCompleted"; -} -::buffa::impl_default_view_instance!(ToolCallCompletedView); -::buffa::impl_view_reborrow!(ToolCallCompletedView); -/** Self-contained, `'static` owned view of a `ToolCallCompleted` message. - - Wraps [`::buffa::OwnedView`]`<`[`ToolCallCompletedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ToolCallCompletedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ToolCallCompletedOwnedView( - ::buffa::OwnedView>, -); -impl ToolCallCompletedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallCompletedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallCompletedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ToolCallCompleted, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallCompletedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ToolCallCompletedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ToolCallCompletedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ToolCallCompleted { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Field 3: `tool_execution_id` - #[must_use] - pub fn tool_execution_id(&self) -> &'_ str { - self.0.reborrow().tool_execution_id - } - /// Field 4: `result` - #[must_use] - pub fn result( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ToolCallResultView<'_>, - > { - &self.0.reborrow().result - } - /// Turn this call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 5: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } - /// How the process ended, for a tool that executes one; unset for every other - /// tool. A command that ran and exited non-zero completes here with result - /// status TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR and a termination set; a - /// command that never ran is a ToolCallFailed and has none. - /// - /// Field 6: `termination` - #[must_use] - pub fn termination( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CommandTerminationView<'_>, - > { - &self.0.reborrow().termination - } - /// Wall-clock execution time from start to this completion. Recorded rather - /// than derived from the two events' append times, which measure when the - /// writer got its append acknowledged, not how long the tool ran (D10). - /// - /// Field 7: `duration` - #[must_use] - pub fn duration( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().duration - } - /// Resources this call put into the model's context, with the digest each - /// hashed to when it was read. Empty for a call that observed nothing. - /// - /// Field 8: `observed` - #[must_use] - pub fn observed( - &self, - ) -> &::buffa::RepeatedView< - '_, - super::super::__buffa::view::ResourceObservationView<'_>, - > { - &self.0.reborrow().observed - } - /// Claim-check to this command's captured stdout and stderr, for a tool that - /// executes a process and captured it; unset otherwise, including for a - /// command that ran with capture disabled. - /// - /// It sits here beside `termination` and not inside `result` for the reason - /// `termination` does (D11): captured output is the execution record, while - /// `result` is the transcript the model received. They routinely differ, since - /// what reaches the model is truncated or summarized, and folding raw output - /// into the replay shape would hand a later turn context the original turn - /// never had. - /// - /// Field 9: `output_replay` - #[must_use] - pub fn output_replay( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CommandOutputReplayRefView<'_>, - > { - &self.0.reborrow().output_replay - } - /// Set when this call returned a handle to work that outlived the turn. Unset - /// is the ordinary case and means the call's result is its outcome; set means - /// the result is a handle and the outcome arrives later through the operation - /// ledger. - /// - /// Field 10: `detached` - #[must_use] - pub fn detached( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().detached - } - /// Namespaces this call listed, searched, or otherwise touched, as distinct - /// from the content it read. Empty for a call that accessed no namespace. - /// - /// Field 11: `accessed` - #[must_use] - pub fn accessed( - &self, - ) -> &::buffa::RepeatedView< - '_, - super::super::__buffa::view::ResourceAccessRecordView<'_>, - > { - &self.0.reborrow().accessed - } - /// Targets of a multi-resource call that did not apply. Empty when every target - /// succeeded, and empty is also correct for a single-target call, which has - /// nothing partial to report. - /// - /// Successes are deliberately absent: they are already FileChanged facts, and a - /// second record of the same change is a second thing to keep consistent - /// through rewind and redaction. - /// - /// Field 12: `failed_targets` - #[must_use] - pub fn failed_targets( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::TargetOutcomeView<'_>> { - &self.0.reborrow().failed_targets - } - /// How many targets the call set out to apply, recorded so failed_targets can - /// be read as a fraction. Zero for a call with no target list, which is not the - /// same as a call that attempted zero targets and is why the count is here - /// rather than inferred from an empty list. - /// - /// Field 13: `targets_attempted` - #[must_use] - pub fn targets_attempted(&self) -> ::core::option::Option { - self.0.reborrow().targets_attempted - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ToolCallCompletedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ToolCallCompletedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ToolCallCompletedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ToolCallCompletedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ToolCallCompleted { - type View<'a> = ToolCallCompletedView<'a>; - type ViewHandle = ToolCallCompletedOwnedView; -} -impl ::serde::Serialize for ToolCallCompletedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_completed.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_completed.rs deleted file mode 100644 index 942cbf7cc..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_completed.rs +++ /dev/null @@ -1,544 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call_completed.proto - -/// ToolCallCompleted records that a tool call finished successfully. Per -/// tool_execution_id, this competes with ToolCallFailed under a -/// first-terminal-outcome-wins fold rule: the first of the two to appear in -/// fold order is authoritative, and a later conflicting outcome is retained as -/// audit-only, surfaced by a projection flag, never folded into state (D4). It -/// is a commuting happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ToolCallCompleted { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Field 3: `tool_execution_id` - #[serde( - rename = "toolExecutionId", - alias = "tool_execution_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_execution_id: ::buffa::alloc::string::String, - /// Field 4: `result` - #[serde(rename = "result")] - pub result: ::buffa::MessageField>, - /// Turn this call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 5: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, - /// How the process ended, for a tool that executes one; unset for every other - /// tool. A command that ran and exited non-zero completes here with result - /// status TOOL_CALL_RESULT_STATUS_APPLICATION_ERROR and a termination set; a - /// command that never ran is a ToolCallFailed and has none. - /// - /// Field 6: `termination` - #[serde( - rename = "termination", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub termination: ::buffa::MessageField< - CommandTermination, - ::buffa::Inline, - >, - /// Wall-clock execution time from start to this completion. Recorded rather - /// than derived from the two events' append times, which measure when the - /// writer got its append acknowledged, not how long the tool ran (D10). - /// - /// Field 7: `duration` - #[serde( - rename = "duration", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub duration: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, - /// Resources this call put into the model's context, with the digest each - /// hashed to when it was read. Empty for a call that observed nothing. - /// - /// Field 8: `observed` - #[serde( - rename = "observed", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub observed: ::buffa::alloc::vec::Vec, - /// Claim-check to this command's captured stdout and stderr, for a tool that - /// executes a process and captured it; unset otherwise, including for a - /// command that ran with capture disabled. - /// - /// It sits here beside `termination` and not inside `result` for the reason - /// `termination` does (D11): captured output is the execution record, while - /// `result` is the transcript the model received. They routinely differ, since - /// what reaches the model is truncated or summarized, and folding raw output - /// into the replay shape would hand a later turn context the original turn - /// never had. - /// - /// Field 9: `output_replay` - #[serde( - rename = "outputReplay", - alias = "output_replay", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub output_replay: ::buffa::MessageField< - CommandOutputReplayRef, - ::buffa::Inline, - >, - /// Set when this call returned a handle to work that outlived the turn. Unset - /// is the ordinary case and means the call's result is its outcome; set means - /// the result is a handle and the outcome arrives later through the operation - /// ledger. - /// - /// Field 10: `detached` - #[serde( - rename = "detached", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub detached: ::buffa::MessageField>, - /// Namespaces this call listed, searched, or otherwise touched, as distinct - /// from the content it read. Empty for a call that accessed no namespace. - /// - /// Field 11: `accessed` - #[serde( - rename = "accessed", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub accessed: ::buffa::alloc::vec::Vec, - /// Targets of a multi-resource call that did not apply. Empty when every target - /// succeeded, and empty is also correct for a single-target call, which has - /// nothing partial to report. - /// - /// Successes are deliberately absent: they are already FileChanged facts, and a - /// second record of the same change is a second thing to keep consistent - /// through rewind and redaction. - /// - /// Field 12: `failed_targets` - #[serde( - rename = "failedTargets", - alias = "failed_targets", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub failed_targets: ::buffa::alloc::vec::Vec, - /// How many targets the call set out to apply, recorded so failed_targets can - /// be read as a fraction. Zero for a call with no target list, which is not the - /// same as a call that attempted zero targets and is why the count is here - /// rather than inferred from an empty list. - /// - /// Field 13: `targets_attempted` - #[serde( - rename = "targetsAttempted", - alias = "targets_attempted", - with = "::buffa::json_helpers::opt_uint32", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub targets_attempted: ::core::option::Option, -} -impl ::core::fmt::Debug for ToolCallCompleted { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ToolCallCompleted") - .field("session_id", &self.session_id) - .field("tool_call_id", &self.tool_call_id) - .field("tool_execution_id", &self.tool_execution_id) - .field("result", &self.result) - .field("turn_id", &self.turn_id) - .field("termination", &self.termination) - .field("duration", &self.duration) - .field("observed", &self.observed) - .field("output_replay", &self.output_replay) - .field("detached", &self.detached) - .field("accessed", &self.accessed) - .field("failed_targets", &self.failed_targets) - .field("targets_attempted", &self.targets_attempted) - .finish() - } -} -impl ToolCallCompleted { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallCompleted"; -} -impl ToolCallCompleted { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::targets_attempted`] to `Some(value)`, consuming and returning `self`. - pub fn with_targets_attempted(mut self, value: u32) -> Self { - self.targets_attempted = Some(value); - self - } -} -::buffa::impl_default_instance!(ToolCallCompleted); -impl ::buffa::MessageName for ToolCallCompleted { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallCompleted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallCompleted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallCompleted"; -} -impl ::buffa::Message for ToolCallCompleted { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - if self.result.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.result.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - if self.termination.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.termination.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.duration.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.duration.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.observed { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.output_replay.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.output_replay.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.detached.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.detached.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.accessed { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - for v in &self.failed_targets { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(v) = self.targets_attempted { - size += 1u64 + ::buffa::types::uint32_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - if self.result.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.result.write_to(__cache, buf); - } - ::buffa::types::put_string_field(5u32, &self.turn_id, buf); - if self.termination.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.termination.write_to(__cache, buf); - } - if self.duration.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.duration.write_to(__cache, buf); - } - for v in &self.observed { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if self.output_replay.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.output_replay.write_to(__cache, buf); - } - if self.detached.is_set() { - ::buffa::types::put_len_delimited_header( - 10u32, - u64::from(__cache.consume_next()), - buf, - ); - self.detached.write_to(__cache, buf); - } - for v in &self.accessed { - ::buffa::types::put_len_delimited_header( - 11u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - for v in &self.failed_targets { - ::buffa::types::put_len_delimited_header( - 12u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if let Some(v) = self.targets_attempted { - ::buffa::types::put_uint32_field(13u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_execution_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.result.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.termination.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.duration.get_or_insert_default(), - buf, - ctx, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.observed.push(elem); - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.output_replay.get_or_insert_default(), - buf, - ctx, - )?; - } - 10u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.detached.get_or_insert_default(), - buf, - ctx, - )?; - } - 11u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.accessed.push(elem); - } - 12u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.failed_targets.push(elem); - } - 13u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.targets_attempted = ::core::option::Option::Some( - ::buffa::types::decode_uint32(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.tool_call_id.clear(); - self.tool_execution_id.clear(); - self.result = ::buffa::MessageField::none(); - self.turn_id.clear(); - self.termination = ::buffa::MessageField::none(); - self.duration = ::buffa::MessageField::none(); - self.observed.clear(); - self.output_replay = ::buffa::MessageField::none(); - self.detached = ::buffa::MessageField::none(); - self.accessed.clear(); - self.failed_targets.clear(); - self.targets_attempted = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolCallCompleted { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TOOL_CALL_COMPLETED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallCompleted", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_denied.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_denied.__view.rs deleted file mode 100644 index 9b1d45a00..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_denied.__view.rs +++ /dev/null @@ -1,411 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call_denied.proto - -/// ToolCallDenied records that a requested tool call was refused and never -/// executed -- a human deny or a policy/hook block. Requesting a tool call is only -/// the model's intent; this is the terminal branch when the call is not approved, -/// so a denied call has no ToolCallStarted, no ToolCallCompleted, and reserves no -/// operation in the ledger because nothing ran. Approval and denial are mutually -/// exclusive human-paced decisions guarding a transition whose outcome depends -/// on current lifecycle state, so it is invariant-bearing -/// (WRITE_PRECONDITION = At, ADR#0035 facet 2), not a commuting happened-fact. -#[derive(Clone, Debug, Default)] -pub struct ToolCallDeniedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Field 3: `tool_execution_id` - pub tool_execution_id: &'a str, - /// Principal, policy, or hook that refused the call. - /// - /// Field 4: `denied_by` - pub denied_by: &'a str, - /// Human-readable reason for the refusal; empty when none. - /// - /// Field 5: `reason` - pub reason: ::core::option::Option<&'a str>, - /// Turn the denied call belongs to (see UserMessageRecorded.turn_id). Optional - /// for the same reason as on ToolCallApproved: the refusing principal, policy, - /// or hook may not hold the turn context. - /// - /// Field 6: `turn_id` - pub turn_id: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ToolCallDeniedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_execution_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_execution_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `denied_by` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_denied_by(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ToolCallDeniedView<'a> { - type Owned = super::super::ToolCallDenied; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_execution_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.denied_by = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.reason = Some(::buffa::types::borrow_str(&mut cur)?); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ToolCallDenied { - session_id: self.session_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - tool_execution_id: self.tool_execution_id.to_string(), - denied_by: self.denied_by.to_string(), - reason: self.reason.map(|s| s.to_string()), - turn_id: self.turn_id.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ToolCallDeniedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.denied_by) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.turn_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.denied_by, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(5u32, v, buf); - } - if let Some(ref v) = self.turn_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ToolCallDeniedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolExecutionId", self.tool_execution_id)?; - } - { - __map.serialize_entry("deniedBy", self.denied_by)?; - } - if let ::core::option::Option::Some(__v) = self.reason { - __map.serialize_entry("reason", __v)?; - } - if let ::core::option::Option::Some(__v) = self.turn_id { - __map.serialize_entry("turnId", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ToolCallDeniedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallDenied"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallDenied"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallDenied"; -} -::buffa::impl_default_view_instance!(ToolCallDeniedView); -::buffa::impl_view_reborrow!(ToolCallDeniedView); -/** Self-contained, `'static` owned view of a `ToolCallDenied` message. - - Wraps [`::buffa::OwnedView`]`<`[`ToolCallDeniedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ToolCallDeniedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ToolCallDeniedOwnedView(::buffa::OwnedView>); -impl ToolCallDeniedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallDeniedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallDeniedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ToolCallDenied, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallDeniedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ToolCallDeniedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ToolCallDeniedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ToolCallDenied { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Field 3: `tool_execution_id` - #[must_use] - pub fn tool_execution_id(&self) -> &'_ str { - self.0.reborrow().tool_execution_id - } - /// Principal, policy, or hook that refused the call. - /// - /// Field 4: `denied_by` - #[must_use] - pub fn denied_by(&self) -> &'_ str { - self.0.reborrow().denied_by - } - /// Human-readable reason for the refusal; empty when none. - /// - /// Field 5: `reason` - #[must_use] - pub fn reason(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().reason - } - /// Turn the denied call belongs to (see UserMessageRecorded.turn_id). Optional - /// for the same reason as on ToolCallApproved: the refusing principal, policy, - /// or hook may not hold the turn context. - /// - /// Field 6: `turn_id` - #[must_use] - pub fn turn_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ToolCallDeniedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ToolCallDeniedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ToolCallDeniedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ToolCallDeniedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ToolCallDenied { - type View<'a> = ToolCallDeniedView<'a>; - type ViewHandle = ToolCallDeniedOwnedView; -} -impl ::serde::Serialize for ToolCallDeniedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_denied.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_denied.rs deleted file mode 100644 index 2d0d5febd..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_denied.rs +++ /dev/null @@ -1,248 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call_denied.proto - -/// ToolCallDenied records that a requested tool call was refused and never -/// executed -- a human deny or a policy/hook block. Requesting a tool call is only -/// the model's intent; this is the terminal branch when the call is not approved, -/// so a denied call has no ToolCallStarted, no ToolCallCompleted, and reserves no -/// operation in the ledger because nothing ran. Approval and denial are mutually -/// exclusive human-paced decisions guarding a transition whose outcome depends -/// on current lifecycle state, so it is invariant-bearing -/// (WRITE_PRECONDITION = At, ADR#0035 facet 2), not a commuting happened-fact. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ToolCallDenied { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Field 3: `tool_execution_id` - #[serde( - rename = "toolExecutionId", - alias = "tool_execution_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_execution_id: ::buffa::alloc::string::String, - /// Principal, policy, or hook that refused the call. - /// - /// Field 4: `denied_by` - #[serde( - rename = "deniedBy", - alias = "denied_by", - with = "::buffa::json_helpers::proto_string" - )] - pub denied_by: ::buffa::alloc::string::String, - /// Human-readable reason for the refusal; empty when none. - /// - /// Field 5: `reason` - #[serde(rename = "reason", skip_serializing_if = "::core::option::Option::is_none")] - pub reason: ::core::option::Option<::buffa::alloc::string::String>, - /// Turn the denied call belongs to (see UserMessageRecorded.turn_id). Optional - /// for the same reason as on ToolCallApproved: the refusing principal, policy, - /// or hook may not hold the turn context. - /// - /// Field 6: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub turn_id: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for ToolCallDenied { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ToolCallDenied") - .field("session_id", &self.session_id) - .field("tool_call_id", &self.tool_call_id) - .field("tool_execution_id", &self.tool_execution_id) - .field("denied_by", &self.denied_by) - .field("reason", &self.reason) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl ToolCallDenied { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallDenied"; -} -impl ToolCallDenied { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::reason`] to `Some(value)`, consuming and returning `self`. - pub fn with_reason( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.reason = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::turn_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_turn_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.turn_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ToolCallDenied); -impl ::buffa::MessageName for ToolCallDenied { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallDenied"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallDenied"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallDenied"; -} -impl ::buffa::Message for ToolCallDenied { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.denied_by) as u64; - if let Some(ref v) = self.reason { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.turn_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.denied_by, buf); - if let Some(ref v) = self.reason { - ::buffa::types::put_string_field(5u32, v, buf); - } - if let Some(ref v) = self.turn_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_execution_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.denied_by, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.reason.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.turn_id.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.tool_call_id.clear(); - self.tool_execution_id.clear(); - self.denied_by.clear(); - self.reason = ::core::option::Option::None; - self.turn_id = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolCallDenied { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TOOL_CALL_DENIED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallDenied", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_failed.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_failed.__view.rs deleted file mode 100644 index 92b8f1f6e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_failed.__view.rs +++ /dev/null @@ -1,420 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call_failed.proto - -/// ToolCallFailed records that a tool call finished with an error. Per -/// tool_execution_id, this competes with ToolCallCompleted under a -/// first-terminal-outcome-wins fold rule: the first of the two to appear in -/// fold order is authoritative, and a later conflicting outcome is retained as -/// audit-only, surfaced by a projection flag, never folded into state (D4). It -/// is a commuting happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, Debug, Default)] -pub struct ToolCallFailedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Field 3: `tool_execution_id` - pub tool_execution_id: &'a str, - /// Field 4: `error` - pub error: &'a str, - /// Typed failure reason, so a cancelled or timed-out call is distinguishable - /// from a genuine error without parsing the error string (parity with - /// AssistantMessageFailed). - /// - /// Field 5: `reason` - pub reason: ::buffa::EnumValue, - /// Turn this call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 6: `turn_id` - pub turn_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ToolCallFailedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_execution_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_execution_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `error` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_error(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 32u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ToolCallFailedView<'a> { - type Owned = super::super::ToolCallFailed; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_execution_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.error = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 16u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 32u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ToolCallFailed { - session_id: self.session_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - tool_execution_id: self.tool_execution_id.to_string(), - error: self.error.to_string(), - reason: self.reason, - turn_id: self.turn_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ToolCallFailedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.error) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.error, buf); - ::buffa::types::put_int32_field(5u32, self.reason.to_i32(), buf); - ::buffa::types::put_string_field(6u32, &self.turn_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ToolCallFailedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolExecutionId", self.tool_execution_id)?; - } - { - __map.serialize_entry("error", self.error)?; - } - { - __map.serialize_entry("reason", &self.reason)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ToolCallFailedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallFailed"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallFailed"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallFailed"; -} -::buffa::impl_default_view_instance!(ToolCallFailedView); -::buffa::impl_view_reborrow!(ToolCallFailedView); -/** Self-contained, `'static` owned view of a `ToolCallFailed` message. - - Wraps [`::buffa::OwnedView`]`<`[`ToolCallFailedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ToolCallFailedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ToolCallFailedOwnedView(::buffa::OwnedView>); -impl ToolCallFailedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallFailedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallFailedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ToolCallFailed, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallFailedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ToolCallFailedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ToolCallFailedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ToolCallFailed { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Field 3: `tool_execution_id` - #[must_use] - pub fn tool_execution_id(&self) -> &'_ str { - self.0.reborrow().tool_execution_id - } - /// Field 4: `error` - #[must_use] - pub fn error(&self) -> &'_ str { - self.0.reborrow().error - } - /// Typed failure reason, so a cancelled or timed-out call is distinguishable - /// from a genuine error without parsing the error string (parity with - /// AssistantMessageFailed). - /// - /// Field 5: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// Turn this call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 6: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ToolCallFailedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ToolCallFailedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ToolCallFailedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ToolCallFailedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ToolCallFailed { - type View<'a> = ToolCallFailedView<'a>; - type ViewHandle = ToolCallFailedOwnedView; -} -impl ::serde::Serialize for ToolCallFailedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_failed.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_failed.rs deleted file mode 100644 index 24c37e4db..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_failed.rs +++ /dev/null @@ -1,400 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call_failed.proto - -/// ToolCallFailureReason is why a started tool call did not complete. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ToolCallFailureReason { - TOOL_CALL_FAILURE_REASON_UNSPECIFIED = 0i32, - /// Failed with a tool or runtime error. - TOOL_CALL_FAILURE_REASON_ERROR = 1i32, - /// Deliberately cancelled before completion. - TOOL_CALL_FAILURE_REASON_CANCELLED = 2i32, - /// Exceeded its time budget. - TOOL_CALL_FAILURE_REASON_TIMEOUT = 3i32, - /// Cut off as collateral of mid-turn user steering (parity with - /// AssistantMessageFailureReason.INTERRUPTED), distinct from a targeted cancel. - TOOL_CALL_FAILURE_REASON_INTERRUPTED = 4i32, -} -impl ToolCallFailureReason { - ///Idiomatic alias for [`Self::TOOL_CALL_FAILURE_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::TOOL_CALL_FAILURE_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::TOOL_CALL_FAILURE_REASON_ERROR`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Error: Self = Self::TOOL_CALL_FAILURE_REASON_ERROR; - ///Idiomatic alias for [`Self::TOOL_CALL_FAILURE_REASON_CANCELLED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Cancelled: Self = Self::TOOL_CALL_FAILURE_REASON_CANCELLED; - ///Idiomatic alias for [`Self::TOOL_CALL_FAILURE_REASON_TIMEOUT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Timeout: Self = Self::TOOL_CALL_FAILURE_REASON_TIMEOUT; - ///Idiomatic alias for [`Self::TOOL_CALL_FAILURE_REASON_INTERRUPTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Interrupted: Self = Self::TOOL_CALL_FAILURE_REASON_INTERRUPTED; -} -impl ::core::default::Default for ToolCallFailureReason { - fn default() -> Self { - Self::TOOL_CALL_FAILURE_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for ToolCallFailureReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ToolCallFailureReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ToolCallFailureReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(ToolCallFailureReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolCallFailureReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ToolCallFailureReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some(Self::TOOL_CALL_FAILURE_REASON_UNSPECIFIED) - } - 1i32 => ::core::option::Option::Some(Self::TOOL_CALL_FAILURE_REASON_ERROR), - 2i32 => { - ::core::option::Option::Some(Self::TOOL_CALL_FAILURE_REASON_CANCELLED) - } - 3i32 => ::core::option::Option::Some(Self::TOOL_CALL_FAILURE_REASON_TIMEOUT), - 4i32 => { - ::core::option::Option::Some(Self::TOOL_CALL_FAILURE_REASON_INTERRUPTED) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::TOOL_CALL_FAILURE_REASON_UNSPECIFIED => { - "TOOL_CALL_FAILURE_REASON_UNSPECIFIED" - } - Self::TOOL_CALL_FAILURE_REASON_ERROR => "TOOL_CALL_FAILURE_REASON_ERROR", - Self::TOOL_CALL_FAILURE_REASON_CANCELLED => { - "TOOL_CALL_FAILURE_REASON_CANCELLED" - } - Self::TOOL_CALL_FAILURE_REASON_TIMEOUT => "TOOL_CALL_FAILURE_REASON_TIMEOUT", - Self::TOOL_CALL_FAILURE_REASON_INTERRUPTED => { - "TOOL_CALL_FAILURE_REASON_INTERRUPTED" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "TOOL_CALL_FAILURE_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::TOOL_CALL_FAILURE_REASON_UNSPECIFIED) - } - "TOOL_CALL_FAILURE_REASON_ERROR" => { - ::core::option::Option::Some(Self::TOOL_CALL_FAILURE_REASON_ERROR) - } - "TOOL_CALL_FAILURE_REASON_CANCELLED" => { - ::core::option::Option::Some(Self::TOOL_CALL_FAILURE_REASON_CANCELLED) - } - "TOOL_CALL_FAILURE_REASON_TIMEOUT" => { - ::core::option::Option::Some(Self::TOOL_CALL_FAILURE_REASON_TIMEOUT) - } - "TOOL_CALL_FAILURE_REASON_INTERRUPTED" => { - ::core::option::Option::Some(Self::TOOL_CALL_FAILURE_REASON_INTERRUPTED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::TOOL_CALL_FAILURE_REASON_UNSPECIFIED, - Self::TOOL_CALL_FAILURE_REASON_ERROR, - Self::TOOL_CALL_FAILURE_REASON_CANCELLED, - Self::TOOL_CALL_FAILURE_REASON_TIMEOUT, - Self::TOOL_CALL_FAILURE_REASON_INTERRUPTED, - ] - } -} -/// ToolCallFailed records that a tool call finished with an error. Per -/// tool_execution_id, this competes with ToolCallCompleted under a -/// first-terminal-outcome-wins fold rule: the first of the two to appear in -/// fold order is authoritative, and a later conflicting outcome is retained as -/// audit-only, surfaced by a projection flag, never folded into state (D4). It -/// is a commuting happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ToolCallFailed { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Field 3: `tool_execution_id` - #[serde( - rename = "toolExecutionId", - alias = "tool_execution_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_execution_id: ::buffa::alloc::string::String, - /// Field 4: `error` - #[serde(rename = "error", with = "::buffa::json_helpers::proto_string")] - pub error: ::buffa::alloc::string::String, - /// Typed failure reason, so a cancelled or timed-out call is distinguishable - /// from a genuine error without parsing the error string (parity with - /// AssistantMessageFailed). - /// - /// Field 5: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// Turn this call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 6: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for ToolCallFailed { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ToolCallFailed") - .field("session_id", &self.session_id) - .field("tool_call_id", &self.tool_call_id) - .field("tool_execution_id", &self.tool_execution_id) - .field("error", &self.error) - .field("reason", &self.reason) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl ToolCallFailed { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallFailed"; -} -::buffa::impl_default_instance!(ToolCallFailed); -impl ::buffa::MessageName for ToolCallFailed { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallFailed"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallFailed"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallFailed"; -} -impl ::buffa::Message for ToolCallFailed { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.error) as u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.error, buf); - ::buffa::types::put_int32_field(5u32, self.reason.to_i32(), buf); - ::buffa::types::put_string_field(6u32, &self.turn_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_execution_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.error, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.tool_call_id.clear(); - self.tool_execution_id.clear(); - self.error.clear(); - self.reason = ::buffa::EnumValue::from(0); - self.turn_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolCallFailed { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TOOL_CALL_FAILED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallFailed", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_requested.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_requested.__view.rs deleted file mode 100644 index 20798d607..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_requested.__view.rs +++ /dev/null @@ -1,469 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call_requested.proto - -/// ToolCallRequested records that a tool call was requested, in arrival order. -/// It owns the execution-request record: what the platform was asked to run -/// (tool_name, input_json as dispatched, operation link), distinct from -/// ToolUseBlock/ToolResultBlock, which own the provider-visible transcript -/// form. The two join by tool_call_id/tool_use_id; equality is expected but -/// not structurally required, since normalization may differ. This event -/// cannot be slimmed to an id-only reference: under streaming, this event and -/// the approval UI precede AssistantMessageCompleted, so an id-only request -/// cannot drive approval (D11). It is a commuting happened-fact -/// (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, Debug, Default)] -pub struct ToolCallRequestedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Field 3: `tool_execution_id` - pub tool_execution_id: &'a str, - /// Field 4: `tool_name` - pub tool_name: &'a str, - /// Field 5: `input_json` - pub input_json: &'a str, - /// Field 6: `parent_tool_use_id` - pub parent_tool_use_id: ::core::option::Option<&'a str>, - /// Operation-ledger id reserved for this call's side effect, joining it to - /// OperationReserved/OperationOutcomeRecorded (mirrors DelegationDispatched.operation_id). - /// Empty for a call that reserves no operation (e.g. a read-only tool). - /// - /// Field 7: `operation_id` - pub operation_id: ::core::option::Option<&'a str>, - /// Turn this call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 8: `turn_id` - pub turn_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ToolCallRequestedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_execution_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_execution_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `tool_name` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_name(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `input_json` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_input_json(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 32u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ToolCallRequestedView<'a> { - type Owned = super::super::ToolCallRequested; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_execution_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_name = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.input_json = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.parent_tool_use_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.operation_id = Some(::buffa::types::borrow_str(&mut cur)?); - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 32u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ToolCallRequested { - session_id: self.session_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - tool_execution_id: self.tool_execution_id.to_string(), - tool_name: self.tool_name.to_string(), - input_json: self.input_json.to_string(), - parent_tool_use_id: self.parent_tool_use_id.map(|s| s.to_string()), - operation_id: self.operation_id.map(|s| s.to_string()), - turn_id: self.turn_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ToolCallRequestedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_name) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.input_json) as u64; - if let Some(ref v) = self.parent_tool_use_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.operation_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.tool_name, buf); - ::buffa::types::put_string_field(5u32, &self.input_json, buf); - if let Some(ref v) = self.parent_tool_use_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - if let Some(ref v) = self.operation_id { - ::buffa::types::put_string_field(7u32, v, buf); - } - ::buffa::types::put_string_field(8u32, &self.turn_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ToolCallRequestedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolExecutionId", self.tool_execution_id)?; - } - { - __map.serialize_entry("toolName", self.tool_name)?; - } - { - __map.serialize_entry("inputJson", self.input_json)?; - } - if let ::core::option::Option::Some(__v) = self.parent_tool_use_id { - __map.serialize_entry("parentToolUseId", __v)?; - } - if let ::core::option::Option::Some(__v) = self.operation_id { - __map.serialize_entry("operationId", __v)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ToolCallRequestedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallRequested"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallRequested"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallRequested"; -} -::buffa::impl_default_view_instance!(ToolCallRequestedView); -::buffa::impl_view_reborrow!(ToolCallRequestedView); -/** Self-contained, `'static` owned view of a `ToolCallRequested` message. - - Wraps [`::buffa::OwnedView`]`<`[`ToolCallRequestedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ToolCallRequestedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ToolCallRequestedOwnedView( - ::buffa::OwnedView>, -); -impl ToolCallRequestedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallRequestedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallRequestedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ToolCallRequested, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallRequestedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ToolCallRequestedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ToolCallRequestedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ToolCallRequested { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Field 3: `tool_execution_id` - #[must_use] - pub fn tool_execution_id(&self) -> &'_ str { - self.0.reborrow().tool_execution_id - } - /// Field 4: `tool_name` - #[must_use] - pub fn tool_name(&self) -> &'_ str { - self.0.reborrow().tool_name - } - /// Field 5: `input_json` - #[must_use] - pub fn input_json(&self) -> &'_ str { - self.0.reborrow().input_json - } - /// Field 6: `parent_tool_use_id` - #[must_use] - pub fn parent_tool_use_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().parent_tool_use_id - } - /// Operation-ledger id reserved for this call's side effect, joining it to - /// OperationReserved/OperationOutcomeRecorded (mirrors DelegationDispatched.operation_id). - /// Empty for a call that reserves no operation (e.g. a read-only tool). - /// - /// Field 7: `operation_id` - #[must_use] - pub fn operation_id(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().operation_id - } - /// Turn this call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 8: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ToolCallRequestedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ToolCallRequestedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ToolCallRequestedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ToolCallRequestedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ToolCallRequested { - type View<'a> = ToolCallRequestedView<'a>; - type ViewHandle = ToolCallRequestedOwnedView; -} -impl ::serde::Serialize for ToolCallRequestedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_requested.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_requested.rs deleted file mode 100644 index 093e84f46..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_requested.rs +++ /dev/null @@ -1,292 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call_requested.proto - -/// ToolCallRequested records that a tool call was requested, in arrival order. -/// It owns the execution-request record: what the platform was asked to run -/// (tool_name, input_json as dispatched, operation link), distinct from -/// ToolUseBlock/ToolResultBlock, which own the provider-visible transcript -/// form. The two join by tool_call_id/tool_use_id; equality is expected but -/// not structurally required, since normalization may differ. This event -/// cannot be slimmed to an id-only reference: under streaming, this event and -/// the approval UI precede AssistantMessageCompleted, so an id-only request -/// cannot drive approval (D11). It is a commuting happened-fact -/// (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ToolCallRequested { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Field 3: `tool_execution_id` - #[serde( - rename = "toolExecutionId", - alias = "tool_execution_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_execution_id: ::buffa::alloc::string::String, - /// Field 4: `tool_name` - #[serde( - rename = "toolName", - alias = "tool_name", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_name: ::buffa::alloc::string::String, - /// Field 5: `input_json` - #[serde( - rename = "inputJson", - alias = "input_json", - with = "::buffa::json_helpers::proto_string" - )] - pub input_json: ::buffa::alloc::string::String, - /// Field 6: `parent_tool_use_id` - #[serde( - rename = "parentToolUseId", - alias = "parent_tool_use_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub parent_tool_use_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Operation-ledger id reserved for this call's side effect, joining it to - /// OperationReserved/OperationOutcomeRecorded (mirrors DelegationDispatched.operation_id). - /// Empty for a call that reserves no operation (e.g. a read-only tool). - /// - /// Field 7: `operation_id` - #[serde( - rename = "operationId", - alias = "operation_id", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub operation_id: ::core::option::Option<::buffa::alloc::string::String>, - /// Turn this call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 8: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for ToolCallRequested { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ToolCallRequested") - .field("session_id", &self.session_id) - .field("tool_call_id", &self.tool_call_id) - .field("tool_execution_id", &self.tool_execution_id) - .field("tool_name", &self.tool_name) - .field("input_json", &self.input_json) - .field("parent_tool_use_id", &self.parent_tool_use_id) - .field("operation_id", &self.operation_id) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl ToolCallRequested { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallRequested"; -} -impl ToolCallRequested { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::parent_tool_use_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_parent_tool_use_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.parent_tool_use_id = Some(value.into()); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::operation_id`] to `Some(value)`, consuming and returning `self`. - pub fn with_operation_id( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.operation_id = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ToolCallRequested); -impl ::buffa::MessageName for ToolCallRequested { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallRequested"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallRequested"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallRequested"; -} -impl ::buffa::Message for ToolCallRequested { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_name) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.input_json) as u64; - if let Some(ref v) = self.parent_tool_use_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - if let Some(ref v) = self.operation_id { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.tool_name, buf); - ::buffa::types::put_string_field(5u32, &self.input_json, buf); - if let Some(ref v) = self.parent_tool_use_id { - ::buffa::types::put_string_field(6u32, v, buf); - } - if let Some(ref v) = self.operation_id { - ::buffa::types::put_string_field(7u32, v, buf); - } - ::buffa::types::put_string_field(8u32, &self.turn_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_execution_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_name, buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.input_json, buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .parent_tool_use_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .operation_id - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.tool_call_id.clear(); - self.tool_execution_id.clear(); - self.tool_name.clear(); - self.input_json.clear(); - self.parent_tool_use_id = ::core::option::Option::None; - self.operation_id = ::core::option::Option::None; - self.turn_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolCallRequested { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TOOL_CALL_REQUESTED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallRequested", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_started.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_started.__view.rs deleted file mode 100644 index 5d55bd315..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_started.__view.rs +++ /dev/null @@ -1,345 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call_started.proto - -/// ToolCallStarted records that a tool call began executing. It is a commuting -/// happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, Debug, Default)] -pub struct ToolCallStartedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `tool_call_id` - pub tool_call_id: &'a str, - /// Field 3: `tool_execution_id` - pub tool_execution_id: &'a str, - /// Turn this call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 4: `turn_id` - pub turn_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ToolCallStartedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `tool_call_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_call_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `tool_execution_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_tool_execution_id(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ToolCallStartedView<'a> { - type Owned = super::super::ToolCallStarted; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_call_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.tool_execution_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ToolCallStarted { - session_id: self.session_id.to_string(), - tool_call_id: self.tool_call_id.to_string(), - tool_execution_id: self.tool_execution_id.to_string(), - turn_id: self.turn_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ToolCallStartedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ToolCallStartedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map.serialize_entry("toolCallId", self.tool_call_id)?; - } - { - __map.serialize_entry("toolExecutionId", self.tool_execution_id)?; - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ToolCallStartedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallStarted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallStarted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallStarted"; -} -::buffa::impl_default_view_instance!(ToolCallStartedView); -::buffa::impl_view_reborrow!(ToolCallStartedView); -/** Self-contained, `'static` owned view of a `ToolCallStarted` message. - - Wraps [`::buffa::OwnedView`]`<`[`ToolCallStartedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ToolCallStartedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ToolCallStartedOwnedView(::buffa::OwnedView>); -impl ToolCallStartedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallStartedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallStartedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ToolCallStarted, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ToolCallStartedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ToolCallStartedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ToolCallStartedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ToolCallStarted { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `tool_call_id` - #[must_use] - pub fn tool_call_id(&self) -> &'_ str { - self.0.reborrow().tool_call_id - } - /// Field 3: `tool_execution_id` - #[must_use] - pub fn tool_execution_id(&self) -> &'_ str { - self.0.reborrow().tool_execution_id - } - /// Turn this call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 4: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ToolCallStartedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ToolCallStartedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ToolCallStartedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ToolCallStartedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ToolCallStarted { - type View<'a> = ToolCallStartedView<'a>; - type ViewHandle = ToolCallStartedOwnedView; -} -impl ::serde::Serialize for ToolCallStartedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_started.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_started.rs deleted file mode 100644 index c94ae6e2b..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.tool_call_started.rs +++ /dev/null @@ -1,168 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/tool_call_started.proto - -/// ToolCallStarted records that a tool call began executing. It is a commuting -/// happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ToolCallStarted { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `tool_call_id` - #[serde( - rename = "toolCallId", - alias = "tool_call_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_call_id: ::buffa::alloc::string::String, - /// Field 3: `tool_execution_id` - #[serde( - rename = "toolExecutionId", - alias = "tool_execution_id", - with = "::buffa::json_helpers::proto_string" - )] - pub tool_execution_id: ::buffa::alloc::string::String, - /// Turn this call belongs to (see UserMessageRecorded.turn_id). - /// - /// Field 4: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for ToolCallStarted { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ToolCallStarted") - .field("session_id", &self.session_id) - .field("tool_call_id", &self.tool_call_id) - .field("tool_execution_id", &self.tool_execution_id) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl ToolCallStarted { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallStarted"; -} -::buffa::impl_default_instance!(ToolCallStarted); -impl ::buffa::MessageName for ToolCallStarted { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "ToolCallStarted"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.ToolCallStarted"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallStarted"; -} -impl ::buffa::Message for ToolCallStarted { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.tool_call_id) as u64; - size - += 1u64 + ::buffa::types::string_encoded_len(&self.tool_execution_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_string_field(2u32, &self.tool_call_id, buf); - ::buffa::types::put_string_field(3u32, &self.tool_execution_id, buf); - ::buffa::types::put_string_field(4u32, &self.turn_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_call_id, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.tool_execution_id, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.tool_call_id.clear(); - self.tool_execution_id.clear(); - self.turn_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ToolCallStarted { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __TOOL_CALL_STARTED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.ToolCallStarted", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.unarchive_session.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.unarchive_session.__view.rs deleted file mode 100644 index fe8d26e70..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.unarchive_session.__view.rs +++ /dev/null @@ -1,255 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/unarchive_session.proto - -/// UnarchiveSession restores an archived session to the default listing view, -/// recording \[SessionUnarchived\]. -/// -/// Write precondition Any. -#[derive(Clone, Debug, Default)] -pub struct UnarchiveSessionView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> UnarchiveSessionView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for UnarchiveSessionView<'a> { - type Owned = super::super::UnarchiveSession; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::UnarchiveSession { - session_id: self.session_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for UnarchiveSessionView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for UnarchiveSessionView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for UnarchiveSessionView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "UnarchiveSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.UnarchiveSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.UnarchiveSession"; -} -::buffa::impl_default_view_instance!(UnarchiveSessionView); -::buffa::impl_view_reborrow!(UnarchiveSessionView); -/** Self-contained, `'static` owned view of a `UnarchiveSession` message. - - Wraps [`::buffa::OwnedView`]`<`[`UnarchiveSessionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`UnarchiveSessionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct UnarchiveSessionOwnedView(::buffa::OwnedView>); -impl UnarchiveSessionOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UnarchiveSessionOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UnarchiveSessionOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::UnarchiveSession, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UnarchiveSessionOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`UnarchiveSessionView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &UnarchiveSessionView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::UnarchiveSession { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for UnarchiveSessionOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - UnarchiveSessionOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: UnarchiveSessionOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for UnarchiveSessionOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::UnarchiveSession { - type View<'a> = UnarchiveSessionView<'a>; - type ViewHandle = UnarchiveSessionOwnedView; -} -impl ::serde::Serialize for UnarchiveSessionOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.unarchive_session.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.unarchive_session.rs deleted file mode 100644 index 82c5b7d9a..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.unarchive_session.rs +++ /dev/null @@ -1,111 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/unarchive_session.proto - -/// UnarchiveSession restores an archived session to the default listing view, -/// recording \[SessionUnarchived\]. -/// -/// Write precondition Any. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct UnarchiveSession { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for UnarchiveSession { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("UnarchiveSession").field("session_id", &self.session_id).finish() - } -} -impl UnarchiveSession { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.UnarchiveSession"; -} -::buffa::impl_default_instance!(UnarchiveSession); -impl ::buffa::MessageName for UnarchiveSession { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "UnarchiveSession"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.UnarchiveSession"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.UnarchiveSession"; -} -impl ::buffa::Message for UnarchiveSession { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for UnarchiveSession { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __UNARCHIVE_SESSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.UnarchiveSession", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.update_todo.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.update_todo.__view.rs deleted file mode 100644 index ccea2cb8e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.update_todo.__view.rs +++ /dev/null @@ -1,350 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/update_todo.proto - -/// UpdateTodo replaces the agent's task list wholesale, recording -/// \[TodoUpdated\], so the plan is a domain fact rather than something a -/// projection parses out of a tool call's input. -/// -/// Write precondition Any: the fold keeps the highest revision, which is -/// order-independent and so genuinely commuting; ties resolve to the first in -/// fold order. -#[derive(Clone, Debug, Default)] -pub struct UpdateTodoView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// The complete list as of this update; readers replace, not merge. - /// - /// Field 2: `items` - pub items: ::buffa::RepeatedView<'a, super::super::__buffa::view::TodoItemView<'a>>, - /// Monotonic per session from the single logical writer, the active - /// attempt's loop. - /// - /// Field 3: `revision` - pub revision: u64, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> UpdateTodoView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `revision` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_revision(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for UpdateTodoView<'a> { - type Owned = super::super::UpdateTodo; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.revision = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::(), - )?; - view.items - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::UpdateTodo { - session_id: self.session_id.to_string(), - items: self - .items - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - revision: self.revision, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for UpdateTodoView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - for v in &self.items { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.revision) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - for v in &self.items { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(3u32, self.revision, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for UpdateTodoView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - if !self.items.is_empty() { - __map.serialize_entry("items", &*self.items)?; - } - { - __map - .serialize_entry( - "revision", - &::buffa::json_helpers::ProtoJson(&self.revision), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for UpdateTodoView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "UpdateTodo"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.UpdateTodo"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.UpdateTodo"; -} -::buffa::impl_default_view_instance!(UpdateTodoView); -::buffa::impl_view_reborrow!(UpdateTodoView); -/** Self-contained, `'static` owned view of a `UpdateTodo` message. - - Wraps [`::buffa::OwnedView`]`<`[`UpdateTodoView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`UpdateTodoView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct UpdateTodoOwnedView(::buffa::OwnedView>); -impl UpdateTodoOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UpdateTodoOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UpdateTodoOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::UpdateTodo, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UpdateTodoOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`UpdateTodoView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &UpdateTodoView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::UpdateTodo { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// The complete list as of this update; readers replace, not merge. - /// - /// Field 2: `items` - #[must_use] - pub fn items( - &self, - ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::TodoItemView<'_>> { - &self.0.reborrow().items - } - /// Monotonic per session from the single logical writer, the active - /// attempt's loop. - /// - /// Field 3: `revision` - #[must_use] - pub fn revision(&self) -> u64 { - self.0.reborrow().revision - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for UpdateTodoOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - UpdateTodoOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: UpdateTodoOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for UpdateTodoOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::UpdateTodo { - type View<'a> = UpdateTodoView<'a>; - type ViewHandle = UpdateTodoOwnedView; -} -impl ::serde::Serialize for UpdateTodoOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.update_todo.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.update_todo.rs deleted file mode 100644 index 6bf10503d..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.update_todo.rs +++ /dev/null @@ -1,172 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/update_todo.proto - -/// UpdateTodo replaces the agent's task list wholesale, recording -/// \[TodoUpdated\], so the plan is a domain fact rather than something a -/// projection parses out of a tool call's input. -/// -/// Write precondition Any: the fold keeps the highest revision, which is -/// order-independent and so genuinely commuting; ties resolve to the first in -/// fold order. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct UpdateTodo { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// The complete list as of this update; readers replace, not merge. - /// - /// Field 2: `items` - #[serde( - rename = "items", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub items: ::buffa::alloc::vec::Vec, - /// Monotonic per session from the single logical writer, the active - /// attempt's loop. - /// - /// Field 3: `revision` - #[serde(rename = "revision", with = "::buffa::json_helpers::uint64")] - pub revision: u64, -} -impl ::core::fmt::Debug for UpdateTodo { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("UpdateTodo") - .field("session_id", &self.session_id) - .field("items", &self.items) - .field("revision", &self.revision) - .finish() - } -} -impl UpdateTodo { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.UpdateTodo"; -} -::buffa::impl_default_instance!(UpdateTodo); -impl ::buffa::MessageName for UpdateTodo { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "UpdateTodo"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.UpdateTodo"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.UpdateTodo"; -} -impl ::buffa::Message for UpdateTodo { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - for v in &self.items { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::uint64_encoded_len(self.revision) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - for v in &self.items { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - ::buffa::types::put_uint64_field(3u32, self.revision, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.items.push(elem); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.revision = ::buffa::types::decode_uint64(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.items.clear(); - self.revision = 0u64; - } -} -impl ::buffa::json_helpers::ProtoElemJson for UpdateTodo { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __UPDATE_TODO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.UpdateTodo", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.user_message_recorded.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.user_message_recorded.__view.rs deleted file mode 100644 index c9e78d749..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.user_message_recorded.__view.rs +++ /dev/null @@ -1,380 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/user_message_recorded.proto - -/// UserMessageRecorded records that a user message arrived, in arrival order. It -/// is a commuting happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, Debug, Default)] -pub struct UserMessageRecordedView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// Field 2: `message` - pub message: ::buffa::MessageFieldView< - super::super::__buffa::view::CanonicalMessageView<'a>, - >, - /// The turn this message opens. A turn is one user-prompt-to-final-assistant- - /// message cycle, and every event produced within it repeats this id, so "what - /// happened in this turn" is a filter over a decoded field rather than a - /// reconstruction that walks message and tool-call joins in fold order. The id - /// is stamped rather than folded for the same reason tool_call_id and - /// tool_execution_id are both recorded: the boundary is a fact the writer knows - /// and the fold cannot recover, since concurrent Any-precondition appends give - /// no reliable "next event after" relation to infer it from (D11). - /// - /// Field 3: `turn_id` - pub turn_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> UserMessageRecordedView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `message` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_message(&self) -> bool { - self.message.is_set() - } - /**Whether required field `turn_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_turn_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for UserMessageRecordedView<'a> { - type Owned = super::super::UserMessageRecorded; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.message.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.message = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.turn_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::UserMessageRecorded, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::UserMessageRecorded, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::UserMessageRecorded { - session_id: self.session_id.to_string(), - message: match self.message.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::CanonicalMessage, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - turn_id: self.turn_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for UserMessageRecordedView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.message.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.message.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.message.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.message.write_to(__cache, buf); - } - ::buffa::types::put_string_field(3u32, &self.turn_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for UserMessageRecordedView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.message.as_option() { - __map.serialize_entry("message", __v)?; - } - } - { - __map.serialize_entry("turnId", self.turn_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for UserMessageRecordedView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "UserMessageRecorded"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.UserMessageRecorded"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.UserMessageRecorded"; -} -::buffa::impl_default_view_instance!(UserMessageRecordedView); -::buffa::impl_view_reborrow!(UserMessageRecordedView); -/** Self-contained, `'static` owned view of a `UserMessageRecorded` message. - - Wraps [`::buffa::OwnedView`]`<`[`UserMessageRecordedView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`UserMessageRecordedView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct UserMessageRecordedOwnedView( - ::buffa::OwnedView>, -); -impl UserMessageRecordedOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UserMessageRecordedOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UserMessageRecordedOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::UserMessageRecorded, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UserMessageRecordedOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`UserMessageRecordedView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &UserMessageRecordedView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::UserMessageRecorded { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// Field 2: `message` - #[must_use] - pub fn message( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::CanonicalMessageView<'_>, - > { - &self.0.reborrow().message - } - /// The turn this message opens. A turn is one user-prompt-to-final-assistant- - /// message cycle, and every event produced within it repeats this id, so "what - /// happened in this turn" is a filter over a decoded field rather than a - /// reconstruction that walks message and tool-call joins in fold order. The id - /// is stamped rather than folded for the same reason tool_call_id and - /// tool_execution_id are both recorded: the boundary is a fact the writer knows - /// and the fold cannot recover, since concurrent Any-precondition appends give - /// no reliable "next event after" relation to infer it from (D11). - /// - /// Field 3: `turn_id` - #[must_use] - pub fn turn_id(&self) -> &'_ str { - self.0.reborrow().turn_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for UserMessageRecordedOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - UserMessageRecordedOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: UserMessageRecordedOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for UserMessageRecordedOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::UserMessageRecorded { - type View<'a> = UserMessageRecordedView<'a>; - type ViewHandle = UserMessageRecordedOwnedView; -} -impl ::serde::Serialize for UserMessageRecordedOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.user_message_recorded.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.user_message_recorded.rs deleted file mode 100644 index dd4ed013b..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.user_message_recorded.rs +++ /dev/null @@ -1,173 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/user_message_recorded.proto - -/// UserMessageRecorded records that a user message arrived, in arrival order. It -/// is a commuting happened-fact (WRITE_PRECONDITION = Any, ADR#0035 facet 2). -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct UserMessageRecorded { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// Field 2: `message` - #[serde(rename = "message")] - pub message: ::buffa::MessageField< - CanonicalMessage, - ::buffa::Inline, - >, - /// The turn this message opens. A turn is one user-prompt-to-final-assistant- - /// message cycle, and every event produced within it repeats this id, so "what - /// happened in this turn" is a filter over a decoded field rather than a - /// reconstruction that walks message and tool-call joins in fold order. The id - /// is stamped rather than folded for the same reason tool_call_id and - /// tool_execution_id are both recorded: the boundary is a fact the writer knows - /// and the fold cannot recover, since concurrent Any-precondition appends give - /// no reliable "next event after" relation to infer it from (D11). - /// - /// Field 3: `turn_id` - #[serde( - rename = "turnId", - alias = "turn_id", - with = "::buffa::json_helpers::proto_string" - )] - pub turn_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for UserMessageRecorded { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("UserMessageRecorded") - .field("session_id", &self.session_id) - .field("message", &self.message) - .field("turn_id", &self.turn_id) - .finish() - } -} -impl UserMessageRecorded { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.UserMessageRecorded"; -} -::buffa::impl_default_instance!(UserMessageRecorded); -impl ::buffa::MessageName for UserMessageRecorded { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "UserMessageRecorded"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.UserMessageRecorded"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.UserMessageRecorded"; -} -impl ::buffa::Message for UserMessageRecorded { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - if self.message.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.message.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.turn_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - if self.message.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.message.write_to(__cache, buf); - } - ::buffa::types::put_string_field(3u32, &self.turn_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.message.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.turn_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.message = ::buffa::MessageField::none(); - self.turn_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for UserMessageRecorded { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __USER_MESSAGE_RECORDED_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.UserMessageRecorded", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.workspace.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.workspace.__view.rs deleted file mode 100644 index f1192a3fc..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.workspace.__view.rs +++ /dev/null @@ -1,326 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/workspace.proto - -/// WorkspaceRef identifies the workspace a session is bound to. SessionStarted -/// carries it inline rather than leaving it inside the opaque -/// StoredSessionExecutionPlan bytes, so "every session for this workspace" is a -/// projection over decoded event fields and never a decode-and-verify pass over -/// every plan in the store (ADR#0031 §6). -/// -/// The binding is immutable for the life of the session, exactly as the plan's -/// working directory is: a different workspace requires a new session or a fork. -#[derive(Clone, Debug, Default)] -pub struct WorkspaceRefView<'a> { - /// Stable workspace id, assigned by the platform and independent of location. - /// - /// Field 1: `workspace_id` - pub workspace_id: &'a str, - /// Location the workspace resolved to at session start, for example - /// "file:///srv/checkouts/api" or "git+ssh://host/org/repo". - /// - /// Field 2: `uri` - pub uri: &'a str, - /// Source-control revision the workspace was at when the session started; - /// empty when the workspace is not version controlled or was not resolved. - /// - /// Field 3: `revision` - pub revision: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> WorkspaceRefView<'a> { - /**Whether required field `workspace_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_workspace_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `uri` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_uri(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for WorkspaceRefView<'a> { - type Owned = super::super::WorkspaceRef; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.workspace_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.uri = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.revision = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::WorkspaceRef { - workspace_id: self.workspace_id.to_string(), - uri: self.uri.to_string(), - revision: self.revision.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for WorkspaceRefView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.workspace_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.uri) as u64; - if let Some(ref v) = self.revision { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.workspace_id, buf); - ::buffa::types::put_string_field(2u32, &self.uri, buf); - if let Some(ref v) = self.revision { - ::buffa::types::put_string_field(3u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for WorkspaceRefView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("workspaceId", self.workspace_id)?; - } - { - __map.serialize_entry("uri", self.uri)?; - } - if let ::core::option::Option::Some(__v) = self.revision { - __map.serialize_entry("revision", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for WorkspaceRefView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "WorkspaceRef"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.WorkspaceRef"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.WorkspaceRef"; -} -::buffa::impl_default_view_instance!(WorkspaceRefView); -::buffa::impl_view_reborrow!(WorkspaceRefView); -/** Self-contained, `'static` owned view of a `WorkspaceRef` message. - - Wraps [`::buffa::OwnedView`]`<`[`WorkspaceRefView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`WorkspaceRefView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct WorkspaceRefOwnedView(::buffa::OwnedView>); -impl WorkspaceRefOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - WorkspaceRefOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - WorkspaceRefOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::WorkspaceRef, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - WorkspaceRefOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`WorkspaceRefView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &WorkspaceRefView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::WorkspaceRef { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Stable workspace id, assigned by the platform and independent of location. - /// - /// Field 1: `workspace_id` - #[must_use] - pub fn workspace_id(&self) -> &'_ str { - self.0.reborrow().workspace_id - } - /// Location the workspace resolved to at session start, for example - /// "file:///srv/checkouts/api" or "git+ssh://host/org/repo". - /// - /// Field 2: `uri` - #[must_use] - pub fn uri(&self) -> &'_ str { - self.0.reborrow().uri - } - /// Source-control revision the workspace was at when the session started; - /// empty when the workspace is not version controlled or was not resolved. - /// - /// Field 3: `revision` - #[must_use] - pub fn revision(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().revision - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for WorkspaceRefOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - WorkspaceRefOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: WorkspaceRefOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for WorkspaceRefOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::WorkspaceRef { - type View<'a> = WorkspaceRefView<'a>; - type ViewHandle = WorkspaceRefOwnedView; -} -impl ::serde::Serialize for WorkspaceRefOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.workspace.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.workspace.rs deleted file mode 100644 index 6eeb4834d..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.workspace.rs +++ /dev/null @@ -1,177 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/workspace.proto - -/// WorkspaceRef identifies the workspace a session is bound to. SessionStarted -/// carries it inline rather than leaving it inside the opaque -/// StoredSessionExecutionPlan bytes, so "every session for this workspace" is a -/// projection over decoded event fields and never a decode-and-verify pass over -/// every plan in the store (ADR#0031 §6). -/// -/// The binding is immutable for the life of the session, exactly as the plan's -/// working directory is: a different workspace requires a new session or a fork. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct WorkspaceRef { - /// Stable workspace id, assigned by the platform and independent of location. - /// - /// Field 1: `workspace_id` - #[serde( - rename = "workspaceId", - alias = "workspace_id", - with = "::buffa::json_helpers::proto_string" - )] - pub workspace_id: ::buffa::alloc::string::String, - /// Location the workspace resolved to at session start, for example - /// "file:///srv/checkouts/api" or "git+ssh://host/org/repo". - /// - /// Field 2: `uri` - #[serde(rename = "uri", with = "::buffa::json_helpers::proto_string")] - pub uri: ::buffa::alloc::string::String, - /// Source-control revision the workspace was at when the session started; - /// empty when the workspace is not version controlled or was not resolved. - /// - /// Field 3: `revision` - #[serde( - rename = "revision", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub revision: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for WorkspaceRef { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("WorkspaceRef") - .field("workspace_id", &self.workspace_id) - .field("uri", &self.uri) - .field("revision", &self.revision) - .finish() - } -} -impl WorkspaceRef { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.WorkspaceRef"; -} -impl WorkspaceRef { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::revision`] to `Some(value)`, consuming and returning `self`. - pub fn with_revision( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.revision = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(WorkspaceRef); -impl ::buffa::MessageName for WorkspaceRef { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "WorkspaceRef"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.WorkspaceRef"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.WorkspaceRef"; -} -impl ::buffa::Message for WorkspaceRef { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.workspace_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.uri) as u64; - if let Some(ref v) = self.revision { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.workspace_id, buf); - ::buffa::types::put_string_field(2u32, &self.uri, buf); - if let Some(ref v) = self.revision { - ::buffa::types::put_string_field(3u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.workspace_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.uri, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self - .revision - .get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.workspace_id.clear(); - self.uri.clear(); - self.revision = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for WorkspaceRef { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __WORKSPACE_REF_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.WorkspaceRef", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.write_outcome.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.write_outcome.__view.rs deleted file mode 100644 index 287964f7e..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.write_outcome.__view.rs +++ /dev/null @@ -1,1184 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/write_outcome.proto - -/// WriteOutcome is what a caller learned about its own append. -/// -/// Every command response carries one. It exists because the interesting -/// failures of an append are not "it failed": they are the states between -/// success and failure that a boolean cannot express, and that a caller must -/// distinguish before it can decide whether retrying is safe. -/// -/// The reference case is the one this contract is named for. The store accepts -/// an event and the acknowledgment is lost. The caller knows only that it -/// published. It must not report failure, because the event may be committed. -/// It must not blindly retry into a second copy either. It has to be told the -/// outcome is unknown, and then be able to resolve it. -/// -/// There is deliberately no second field naming what the caller should do. -/// Disposition is derived from `state`, because two fields for one fact can -/// disagree, and the one that disagrees is the one a caller trusted. -#[derive(Clone, Debug, Default)] -pub struct WriteOutcomeView<'a> { - /// Field 1: `state` - pub state: ::buffa::EnumValue, - /// Where the write landed. Present for COMMITTED and DEDUPLICATED, and absent - /// for every other state, including UNKNOWN: a position reported for a write - /// nobody confirmed is the exact fiction this message exists to prevent. - /// - /// Field 2: `ordinal` - pub ordinal: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Present when and only when state is UNKNOWN. - /// - /// Field 3: `indeterminate` - pub indeterminate: ::buffa::MessageFieldView< - super::super::__buffa::view::IndeterminateWriteView<'a>, - >, - /// Present when and only when state is CONFLICT. - /// - /// Field 4: `conflict` - pub conflict: ::buffa::MessageFieldView< - super::super::__buffa::view::WriteConflictView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> WriteOutcomeView<'a> { - /**Whether required field `state` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_state(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for WriteOutcomeView<'a> { - type Owned = super::super::WriteOutcome; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.state = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.ordinal.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.ordinal = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.indeterminate.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.indeterminate = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.conflict.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.conflict = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::WriteOutcome { - state: self.state, - ordinal: match self.ordinal.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - indeterminate: match self.indeterminate.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::IndeterminateWrite, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - conflict: match self.conflict.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::WriteConflict, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for WriteOutcomeView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.state.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.ordinal.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ordinal.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.indeterminate.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.indeterminate.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.conflict.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.conflict.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.state.to_i32(), buf); - if self.ordinal.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ordinal.write_to(__cache, buf); - } - if self.indeterminate.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.indeterminate.write_to(__cache, buf); - } - if self.conflict.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.conflict.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for WriteOutcomeView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("state", &self.state)?; - } - { - if let ::core::option::Option::Some(__v) = self.ordinal.as_option() { - __map.serialize_entry("ordinal", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.indeterminate.as_option() { - __map.serialize_entry("indeterminate", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.conflict.as_option() { - __map.serialize_entry("conflict", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for WriteOutcomeView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "WriteOutcome"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.WriteOutcome"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.WriteOutcome"; -} -::buffa::impl_default_view_instance!(WriteOutcomeView); -::buffa::impl_view_reborrow!(WriteOutcomeView); -/** Self-contained, `'static` owned view of a `WriteOutcome` message. - - Wraps [`::buffa::OwnedView`]`<`[`WriteOutcomeView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`WriteOutcomeView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct WriteOutcomeOwnedView(::buffa::OwnedView>); -impl WriteOutcomeOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - WriteOutcomeOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - WriteOutcomeOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::WriteOutcome, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - WriteOutcomeOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`WriteOutcomeView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &WriteOutcomeView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::WriteOutcome { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `state` - #[must_use] - pub fn state(&self) -> ::buffa::EnumValue { - self.0.reborrow().state - } - /// Where the write landed. Present for COMMITTED and DEDUPLICATED, and absent - /// for every other state, including UNKNOWN: a position reported for a write - /// nobody confirmed is the exact fiction this message exists to prevent. - /// - /// Field 2: `ordinal` - #[must_use] - pub fn ordinal( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().ordinal - } - /// Present when and only when state is UNKNOWN. - /// - /// Field 3: `indeterminate` - #[must_use] - pub fn indeterminate( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::IndeterminateWriteView<'_>, - > { - &self.0.reborrow().indeterminate - } - /// Present when and only when state is CONFLICT. - /// - /// Field 4: `conflict` - #[must_use] - pub fn conflict( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().conflict - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for WriteOutcomeOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - WriteOutcomeOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: WriteOutcomeOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for WriteOutcomeOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::WriteOutcome { - type View<'a> = WriteOutcomeView<'a>; - type ViewHandle = WriteOutcomeOwnedView; -} -impl ::serde::Serialize for WriteOutcomeOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// IndeterminateWrite is why an outcome could not be determined. -/// -/// The reasons are separated because they are resolved differently, and merging -/// them would make a condition that resolves itself on retry indistinguishable -/// from one that never will. -#[derive(Clone, Debug, Default)] -pub struct IndeterminateWriteView<'a> { - /// Field 1: `reason` - pub reason: ::buffa::EnumValue, - /// Human-readable, non-contractual. Never parse it. - /// - /// Field 2: `detail` - pub detail: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> IndeterminateWriteView<'a> { - /**Whether required field `reason` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_reason(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for IndeterminateWriteView<'a> { - type Owned = super::super::IndeterminateWrite; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::IndeterminateWrite { - reason: self.reason, - detail: self.detail.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for IndeterminateWriteView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(2u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for IndeterminateWriteView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("reason", &self.reason)?; - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for IndeterminateWriteView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "IndeterminateWrite"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.IndeterminateWrite"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.IndeterminateWrite"; -} -::buffa::impl_default_view_instance!(IndeterminateWriteView); -::buffa::impl_view_reborrow!(IndeterminateWriteView); -/** Self-contained, `'static` owned view of a `IndeterminateWrite` message. - - Wraps [`::buffa::OwnedView`]`<`[`IndeterminateWriteView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`IndeterminateWriteView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct IndeterminateWriteOwnedView( - ::buffa::OwnedView>, -); -impl IndeterminateWriteOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - IndeterminateWriteOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - IndeterminateWriteOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::IndeterminateWrite, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - IndeterminateWriteOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`IndeterminateWriteView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &IndeterminateWriteView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::IndeterminateWrite { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `reason` - #[must_use] - pub fn reason(&self) -> ::buffa::EnumValue { - self.0.reborrow().reason - } - /// Human-readable, non-contractual. Never parse it. - /// - /// Field 2: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for IndeterminateWriteOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - IndeterminateWriteOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: IndeterminateWriteOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for IndeterminateWriteOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::IndeterminateWrite { - type View<'a> = IndeterminateWriteView<'a>; - type ViewHandle = IndeterminateWriteOwnedView; -} -impl ::serde::Serialize for IndeterminateWriteOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// WriteConflict is what the writer believed that the stream did not. -#[derive(Clone, Debug, Default)] -pub struct WriteConflictView<'a> { - /// Field 1: `kind` - pub kind: ::buffa::EnumValue, - /// The head the writer guarded against. Absent when the writer guarded - /// against an empty stream. - /// - /// Field 2: `expected_head` - pub expected_head: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// The head the stream actually had. Absent when it could not be read, which - /// is itself informative: the conflict is real and its shape is not known. - /// - /// Field 3: `observed_head` - pub observed_head: ::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'a>, - >, - /// Human-readable, non-contractual. Never parse it. - /// - /// Field 4: `detail` - pub detail: ::core::option::Option<&'a str>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> WriteConflictView<'a> { - /**Whether required field `kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_kind(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for WriteConflictView<'a> { - type Owned = super::super::WriteConflict; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.expected_head.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.expected_head = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_head.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_head = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.detail = Some(::buffa::types::borrow_str(&mut cur)?); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::WriteConflict { - kind: self.kind, - expected_head: match self.expected_head.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - observed_head: match self.observed_head.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SessionOrdinal, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - detail: self.detail.map(|s| s.to_string()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for WriteConflictView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.expected_head.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.expected_head.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_head.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_head.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.kind.to_i32(), buf); - if self.expected_head.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.expected_head.write_to(__cache, buf); - } - if self.observed_head.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_head.write_to(__cache, buf); - } - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for WriteConflictView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("kind", &self.kind)?; - } - { - if let ::core::option::Option::Some(__v) = self.expected_head.as_option() { - __map.serialize_entry("expectedHead", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.observed_head.as_option() { - __map.serialize_entry("observedHead", __v)?; - } - } - if let ::core::option::Option::Some(__v) = self.detail { - __map.serialize_entry("detail", __v)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for WriteConflictView<'a> { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "WriteConflict"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.WriteConflict"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.WriteConflict"; -} -::buffa::impl_default_view_instance!(WriteConflictView); -::buffa::impl_view_reborrow!(WriteConflictView); -/** Self-contained, `'static` owned view of a `WriteConflict` message. - - Wraps [`::buffa::OwnedView`]`<`[`WriteConflictView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`WriteConflictView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct WriteConflictOwnedView(::buffa::OwnedView>); -impl WriteConflictOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - WriteConflictOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - WriteConflictOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::WriteConflict, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - WriteConflictOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`WriteConflictView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &WriteConflictView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::WriteConflict { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `kind` - #[must_use] - pub fn kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().kind - } - /// The head the writer guarded against. Absent when the writer guarded - /// against an empty stream. - /// - /// Field 2: `expected_head` - #[must_use] - pub fn expected_head( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().expected_head - } - /// The head the stream actually had. Absent when it could not be read, which - /// is itself informative: the conflict is real and its shape is not known. - /// - /// Field 3: `observed_head` - #[must_use] - pub fn observed_head( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SessionOrdinalView<'_>, - > { - &self.0.reborrow().observed_head - } - /// Human-readable, non-contractual. Never parse it. - /// - /// Field 4: `detail` - #[must_use] - pub fn detail(&self) -> ::core::option::Option<&'_ str> { - self.0.reborrow().detail - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for WriteConflictOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - WriteConflictOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: WriteConflictOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for WriteConflictOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::WriteConflict { - type View<'a> = WriteConflictView<'a>; - type ViewHandle = WriteConflictOwnedView; -} -impl ::serde::Serialize for WriteConflictOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.write_outcome.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.write_outcome.rs deleted file mode 100644 index 1c415cb46..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.session.sessions.v1alpha1.write_outcome.rs +++ /dev/null @@ -1,1227 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/session/sessions/v1alpha1/write_outcome.proto - -/// WriteState is what happened to the append, from the caller's vantage point. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum WriteState { - WRITE_STATE_UNSPECIFIED = 0i32, - /// Definitely not appended. The store rejected the publish before it could - /// reach the log, or refused it outright. Retrying is safe. - WRITE_STATE_NOT_APPENDED = 1i32, - /// Appended and acknowledged. `ordinal` names where. - WRITE_STATE_COMMITTED = 2i32, - /// The identical event was already committed and this append was recognized - /// as a repeat of it. This is a success, not a failure: it is what a correct - /// retry of a lost acknowledgment looks like, and `ordinal` names where the - /// original landed. - /// - /// Distinguished from COMMITTED rather than folded into it because the two - /// mean different things to anything counting side effects. A caller that - /// notifies on every commit would notify twice. - WRITE_STATE_DEDUPLICATED = 3i32, - /// The append was refused because something about the stream disagreed with - /// what the writer believed. Retrying the same command unchanged will fail - /// the same way; the writer must re-read and decide again. - WRITE_STATE_CONFLICT = 4i32, - /// The append outcome is unknown. The event may or may not be committed, and - /// nothing observed so far decides it. This is not a failure and must not be - /// reported as one. - WRITE_STATE_UNKNOWN = 5i32, -} -impl WriteState { - ///Idiomatic alias for [`Self::WRITE_STATE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::WRITE_STATE_UNSPECIFIED; - ///Idiomatic alias for [`Self::WRITE_STATE_NOT_APPENDED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const NotAppended: Self = Self::WRITE_STATE_NOT_APPENDED; - ///Idiomatic alias for [`Self::WRITE_STATE_COMMITTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Committed: Self = Self::WRITE_STATE_COMMITTED; - ///Idiomatic alias for [`Self::WRITE_STATE_DEDUPLICATED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Deduplicated: Self = Self::WRITE_STATE_DEDUPLICATED; - ///Idiomatic alias for [`Self::WRITE_STATE_CONFLICT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Conflict: Self = Self::WRITE_STATE_CONFLICT; - ///Idiomatic alias for [`Self::WRITE_STATE_UNKNOWN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unknown: Self = Self::WRITE_STATE_UNKNOWN; -} -impl ::core::default::Default for WriteState { - fn default() -> Self { - Self::WRITE_STATE_UNSPECIFIED - } -} -impl ::serde::Serialize for WriteState { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for WriteState { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = WriteState; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(WriteState)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for WriteState { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for WriteState { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::WRITE_STATE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::WRITE_STATE_NOT_APPENDED), - 2i32 => ::core::option::Option::Some(Self::WRITE_STATE_COMMITTED), - 3i32 => ::core::option::Option::Some(Self::WRITE_STATE_DEDUPLICATED), - 4i32 => ::core::option::Option::Some(Self::WRITE_STATE_CONFLICT), - 5i32 => ::core::option::Option::Some(Self::WRITE_STATE_UNKNOWN), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::WRITE_STATE_UNSPECIFIED => "WRITE_STATE_UNSPECIFIED", - Self::WRITE_STATE_NOT_APPENDED => "WRITE_STATE_NOT_APPENDED", - Self::WRITE_STATE_COMMITTED => "WRITE_STATE_COMMITTED", - Self::WRITE_STATE_DEDUPLICATED => "WRITE_STATE_DEDUPLICATED", - Self::WRITE_STATE_CONFLICT => "WRITE_STATE_CONFLICT", - Self::WRITE_STATE_UNKNOWN => "WRITE_STATE_UNKNOWN", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "WRITE_STATE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::WRITE_STATE_UNSPECIFIED) - } - "WRITE_STATE_NOT_APPENDED" => { - ::core::option::Option::Some(Self::WRITE_STATE_NOT_APPENDED) - } - "WRITE_STATE_COMMITTED" => { - ::core::option::Option::Some(Self::WRITE_STATE_COMMITTED) - } - "WRITE_STATE_DEDUPLICATED" => { - ::core::option::Option::Some(Self::WRITE_STATE_DEDUPLICATED) - } - "WRITE_STATE_CONFLICT" => { - ::core::option::Option::Some(Self::WRITE_STATE_CONFLICT) - } - "WRITE_STATE_UNKNOWN" => { - ::core::option::Option::Some(Self::WRITE_STATE_UNKNOWN) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::WRITE_STATE_UNSPECIFIED, - Self::WRITE_STATE_NOT_APPENDED, - Self::WRITE_STATE_COMMITTED, - Self::WRITE_STATE_DEDUPLICATED, - Self::WRITE_STATE_CONFLICT, - Self::WRITE_STATE_UNKNOWN, - ] - } -} -/// UnknownWriteReason is what prevented the outcome from being determined. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum UnknownWriteReason { - UNKNOWN_WRITE_REASON_UNSPECIFIED = 0i32, - /// The event was published and no acknowledgment was observed within the - /// caller's deadline. The canonical case, and the recoverable one: the - /// deterministic event identity makes a retry either commit or deduplicate. - UNKNOWN_WRITE_REASON_ACK_TIMEOUT = 1i32, - /// An acknowledgment arrived and could not be interpreted. Distinct from a - /// timeout because the store demonstrably responded, so a transport-level - /// retry is answering a different question than a store-level one. - UNKNOWN_WRITE_REASON_ACK_UNREADABLE = 2i32, - /// A multi-event batch acknowledged some members and not others. The stream - /// may now hold a partial batch, which no fold expects, so this resolves by - /// reading the stream rather than by retrying the batch. - UNKNOWN_WRITE_REASON_BATCH_PARTIALLY_ACKNOWLEDGED = 3i32, - /// The retry arrived after the store's duplicate-detection window elapsed, so - /// the store can no longer tell a repeat from a first attempt. The window is a - /// provisioning knob with a bounded lifetime, not a delivery guarantee. - /// - /// Past it, deduplication moves rather than disappearing: a guarded command - /// re-replays and no-ops on its idempotency key at the aggregate, and an - /// unguarded fact relies on readers collapsing identical ids. So this reason - /// says the outcome is determinable and not determinable from here, which is - /// why it is distinct from ACK_TIMEOUT: it points at a different resolver - /// rather than at a retry the store can no longer make safe. - UNKNOWN_WRITE_REASON_DEDUPLICATION_WINDOW_EXPIRED = 4i32, -} -impl UnknownWriteReason { - ///Idiomatic alias for [`Self::UNKNOWN_WRITE_REASON_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::UNKNOWN_WRITE_REASON_UNSPECIFIED; - ///Idiomatic alias for [`Self::UNKNOWN_WRITE_REASON_ACK_TIMEOUT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const AckTimeout: Self = Self::UNKNOWN_WRITE_REASON_ACK_TIMEOUT; - ///Idiomatic alias for [`Self::UNKNOWN_WRITE_REASON_ACK_UNREADABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const AckUnreadable: Self = Self::UNKNOWN_WRITE_REASON_ACK_UNREADABLE; - ///Idiomatic alias for [`Self::UNKNOWN_WRITE_REASON_BATCH_PARTIALLY_ACKNOWLEDGED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const BatchPartiallyAcknowledged: Self = Self::UNKNOWN_WRITE_REASON_BATCH_PARTIALLY_ACKNOWLEDGED; - ///Idiomatic alias for [`Self::UNKNOWN_WRITE_REASON_DEDUPLICATION_WINDOW_EXPIRED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const DeduplicationWindowExpired: Self = Self::UNKNOWN_WRITE_REASON_DEDUPLICATION_WINDOW_EXPIRED; -} -impl ::core::default::Default for UnknownWriteReason { - fn default() -> Self { - Self::UNKNOWN_WRITE_REASON_UNSPECIFIED - } -} -impl ::serde::Serialize for UnknownWriteReason { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for UnknownWriteReason { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = UnknownWriteReason; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(UnknownWriteReason) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for UnknownWriteReason { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for UnknownWriteReason { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::UNKNOWN_WRITE_REASON_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::UNKNOWN_WRITE_REASON_ACK_TIMEOUT), - 2i32 => { - ::core::option::Option::Some(Self::UNKNOWN_WRITE_REASON_ACK_UNREADABLE) - } - 3i32 => { - ::core::option::Option::Some( - Self::UNKNOWN_WRITE_REASON_BATCH_PARTIALLY_ACKNOWLEDGED, - ) - } - 4i32 => { - ::core::option::Option::Some( - Self::UNKNOWN_WRITE_REASON_DEDUPLICATION_WINDOW_EXPIRED, - ) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::UNKNOWN_WRITE_REASON_UNSPECIFIED => "UNKNOWN_WRITE_REASON_UNSPECIFIED", - Self::UNKNOWN_WRITE_REASON_ACK_TIMEOUT => "UNKNOWN_WRITE_REASON_ACK_TIMEOUT", - Self::UNKNOWN_WRITE_REASON_ACK_UNREADABLE => { - "UNKNOWN_WRITE_REASON_ACK_UNREADABLE" - } - Self::UNKNOWN_WRITE_REASON_BATCH_PARTIALLY_ACKNOWLEDGED => { - "UNKNOWN_WRITE_REASON_BATCH_PARTIALLY_ACKNOWLEDGED" - } - Self::UNKNOWN_WRITE_REASON_DEDUPLICATION_WINDOW_EXPIRED => { - "UNKNOWN_WRITE_REASON_DEDUPLICATION_WINDOW_EXPIRED" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "UNKNOWN_WRITE_REASON_UNSPECIFIED" => { - ::core::option::Option::Some(Self::UNKNOWN_WRITE_REASON_UNSPECIFIED) - } - "UNKNOWN_WRITE_REASON_ACK_TIMEOUT" => { - ::core::option::Option::Some(Self::UNKNOWN_WRITE_REASON_ACK_TIMEOUT) - } - "UNKNOWN_WRITE_REASON_ACK_UNREADABLE" => { - ::core::option::Option::Some(Self::UNKNOWN_WRITE_REASON_ACK_UNREADABLE) - } - "UNKNOWN_WRITE_REASON_BATCH_PARTIALLY_ACKNOWLEDGED" => { - ::core::option::Option::Some( - Self::UNKNOWN_WRITE_REASON_BATCH_PARTIALLY_ACKNOWLEDGED, - ) - } - "UNKNOWN_WRITE_REASON_DEDUPLICATION_WINDOW_EXPIRED" => { - ::core::option::Option::Some( - Self::UNKNOWN_WRITE_REASON_DEDUPLICATION_WINDOW_EXPIRED, - ) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::UNKNOWN_WRITE_REASON_UNSPECIFIED, - Self::UNKNOWN_WRITE_REASON_ACK_TIMEOUT, - Self::UNKNOWN_WRITE_REASON_ACK_UNREADABLE, - Self::UNKNOWN_WRITE_REASON_BATCH_PARTIALLY_ACKNOWLEDGED, - Self::UNKNOWN_WRITE_REASON_DEDUPLICATION_WINDOW_EXPIRED, - ] - } -} -/// ConflictKind is which disagreement refused the append. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ConflictKind { - CONFLICT_KIND_UNSPECIFIED = 0i32, - /// Optimistic concurrency: the head moved between the read and the append. - /// The ordinary contended case, and the only one that is not a defect. - CONFLICT_KIND_WRONG_EXPECTED_HEAD = 1i32, - /// A creation batch guarded against an empty stream and found one that is - /// not. The identity is already in use. - CONFLICT_KIND_STREAM_ALREADY_EXISTS = 2i32, - /// An event carrying an already-committed identity did not match the - /// committed content. - /// - /// Event identity is derived in part from a caller-supplied idempotency key, - /// so a caller that reuses one key across two different commands produces - /// exactly this. It is reported rather than deduplicated because the store's - /// duplicate detection keys on identity alone: left to itself it would - /// discard the divergent content and acknowledge success, which is silent - /// data loss wearing the shape of idempotency. - CONFLICT_KIND_IDENTITY_REUSED_WITH_DIFFERENT_CONTENT = 3i32, - /// The subject the writer resolved belongs to a retired stream incarnation - /// and no longer accepts writes (ADR#0059). The writer must re-resolve rather - /// than retry, because a sealed incarnation refuses every retry forever. - CONFLICT_KIND_INCARNATION_RETIRED = 4i32, -} -impl ConflictKind { - ///Idiomatic alias for [`Self::CONFLICT_KIND_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::CONFLICT_KIND_UNSPECIFIED; - ///Idiomatic alias for [`Self::CONFLICT_KIND_WRONG_EXPECTED_HEAD`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const WrongExpectedHead: Self = Self::CONFLICT_KIND_WRONG_EXPECTED_HEAD; - ///Idiomatic alias for [`Self::CONFLICT_KIND_STREAM_ALREADY_EXISTS`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const StreamAlreadyExists: Self = Self::CONFLICT_KIND_STREAM_ALREADY_EXISTS; - ///Idiomatic alias for [`Self::CONFLICT_KIND_IDENTITY_REUSED_WITH_DIFFERENT_CONTENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const IdentityReusedWithDifferentContent: Self = Self::CONFLICT_KIND_IDENTITY_REUSED_WITH_DIFFERENT_CONTENT; - ///Idiomatic alias for [`Self::CONFLICT_KIND_INCARNATION_RETIRED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const IncarnationRetired: Self = Self::CONFLICT_KIND_INCARNATION_RETIRED; -} -impl ::core::default::Default for ConflictKind { - fn default() -> Self { - Self::CONFLICT_KIND_UNSPECIFIED - } -} -impl ::serde::Serialize for ConflictKind { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ConflictKind { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ConflictKind; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(ConflictKind)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ConflictKind { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ConflictKind { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::CONFLICT_KIND_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::CONFLICT_KIND_WRONG_EXPECTED_HEAD), - 2i32 => { - ::core::option::Option::Some(Self::CONFLICT_KIND_STREAM_ALREADY_EXISTS) - } - 3i32 => { - ::core::option::Option::Some( - Self::CONFLICT_KIND_IDENTITY_REUSED_WITH_DIFFERENT_CONTENT, - ) - } - 4i32 => ::core::option::Option::Some(Self::CONFLICT_KIND_INCARNATION_RETIRED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::CONFLICT_KIND_UNSPECIFIED => "CONFLICT_KIND_UNSPECIFIED", - Self::CONFLICT_KIND_WRONG_EXPECTED_HEAD => { - "CONFLICT_KIND_WRONG_EXPECTED_HEAD" - } - Self::CONFLICT_KIND_STREAM_ALREADY_EXISTS => { - "CONFLICT_KIND_STREAM_ALREADY_EXISTS" - } - Self::CONFLICT_KIND_IDENTITY_REUSED_WITH_DIFFERENT_CONTENT => { - "CONFLICT_KIND_IDENTITY_REUSED_WITH_DIFFERENT_CONTENT" - } - Self::CONFLICT_KIND_INCARNATION_RETIRED => { - "CONFLICT_KIND_INCARNATION_RETIRED" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "CONFLICT_KIND_UNSPECIFIED" => { - ::core::option::Option::Some(Self::CONFLICT_KIND_UNSPECIFIED) - } - "CONFLICT_KIND_WRONG_EXPECTED_HEAD" => { - ::core::option::Option::Some(Self::CONFLICT_KIND_WRONG_EXPECTED_HEAD) - } - "CONFLICT_KIND_STREAM_ALREADY_EXISTS" => { - ::core::option::Option::Some(Self::CONFLICT_KIND_STREAM_ALREADY_EXISTS) - } - "CONFLICT_KIND_IDENTITY_REUSED_WITH_DIFFERENT_CONTENT" => { - ::core::option::Option::Some( - Self::CONFLICT_KIND_IDENTITY_REUSED_WITH_DIFFERENT_CONTENT, - ) - } - "CONFLICT_KIND_INCARNATION_RETIRED" => { - ::core::option::Option::Some(Self::CONFLICT_KIND_INCARNATION_RETIRED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::CONFLICT_KIND_UNSPECIFIED, - Self::CONFLICT_KIND_WRONG_EXPECTED_HEAD, - Self::CONFLICT_KIND_STREAM_ALREADY_EXISTS, - Self::CONFLICT_KIND_IDENTITY_REUSED_WITH_DIFFERENT_CONTENT, - Self::CONFLICT_KIND_INCARNATION_RETIRED, - ] - } -} -/// WriteOutcome is what a caller learned about its own append. -/// -/// Every command response carries one. It exists because the interesting -/// failures of an append are not "it failed": they are the states between -/// success and failure that a boolean cannot express, and that a caller must -/// distinguish before it can decide whether retrying is safe. -/// -/// The reference case is the one this contract is named for. The store accepts -/// an event and the acknowledgment is lost. The caller knows only that it -/// published. It must not report failure, because the event may be committed. -/// It must not blindly retry into a second copy either. It has to be told the -/// outcome is unknown, and then be able to resolve it. -/// -/// There is deliberately no second field naming what the caller should do. -/// Disposition is derived from `state`, because two fields for one fact can -/// disagree, and the one that disagrees is the one a caller trusted. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct WriteOutcome { - /// Field 1: `state` - #[serde(rename = "state", with = "::buffa::json_helpers::proto_enum")] - pub state: ::buffa::EnumValue, - /// Where the write landed. Present for COMMITTED and DEDUPLICATED, and absent - /// for every other state, including UNKNOWN: a position reported for a write - /// nobody confirmed is the exact fiction this message exists to prevent. - /// - /// Field 2: `ordinal` - #[serde( - rename = "ordinal", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub ordinal: ::buffa::MessageField>, - /// Present when and only when state is UNKNOWN. - /// - /// Field 3: `indeterminate` - #[serde( - rename = "indeterminate", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub indeterminate: ::buffa::MessageField< - IndeterminateWrite, - ::buffa::Inline, - >, - /// Present when and only when state is CONFLICT. - /// - /// Field 4: `conflict` - #[serde( - rename = "conflict", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub conflict: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for WriteOutcome { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("WriteOutcome") - .field("state", &self.state) - .field("ordinal", &self.ordinal) - .field("indeterminate", &self.indeterminate) - .field("conflict", &self.conflict) - .finish() - } -} -impl WriteOutcome { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.WriteOutcome"; -} -::buffa::impl_default_instance!(WriteOutcome); -impl ::buffa::MessageName for WriteOutcome { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "WriteOutcome"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.WriteOutcome"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.WriteOutcome"; -} -impl ::buffa::Message for WriteOutcome { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.state.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.ordinal.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.ordinal.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.indeterminate.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.indeterminate.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.conflict.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.conflict.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.state.to_i32(), buf); - if self.ordinal.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.ordinal.write_to(__cache, buf); - } - if self.indeterminate.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.indeterminate.write_to(__cache, buf); - } - if self.conflict.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.conflict.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.state = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.ordinal.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.indeterminate.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.conflict.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.state = ::buffa::EnumValue::from(0); - self.ordinal = ::buffa::MessageField::none(); - self.indeterminate = ::buffa::MessageField::none(); - self.conflict = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for WriteOutcome { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __WRITE_OUTCOME_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.WriteOutcome", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// IndeterminateWrite is why an outcome could not be determined. -/// -/// The reasons are separated because they are resolved differently, and merging -/// them would make a condition that resolves itself on retry indistinguishable -/// from one that never will. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct IndeterminateWrite { - /// Field 1: `reason` - #[serde(rename = "reason", with = "::buffa::json_helpers::proto_enum")] - pub reason: ::buffa::EnumValue, - /// Human-readable, non-contractual. Never parse it. - /// - /// Field 2: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for IndeterminateWrite { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("IndeterminateWrite") - .field("reason", &self.reason) - .field("detail", &self.detail) - .finish() - } -} -impl IndeterminateWrite { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.IndeterminateWrite"; -} -impl IndeterminateWrite { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(IndeterminateWrite); -impl ::buffa::MessageName for IndeterminateWrite { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "IndeterminateWrite"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.IndeterminateWrite"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.IndeterminateWrite"; -} -impl ::buffa::Message for IndeterminateWrite { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.reason.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.reason.to_i32(), buf); - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(2u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.reason = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.reason = ::buffa::EnumValue::from(0); - self.detail = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for IndeterminateWrite { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __INDETERMINATE_WRITE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.IndeterminateWrite", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// WriteConflict is what the writer believed that the stream did not. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct WriteConflict { - /// Field 1: `kind` - #[serde(rename = "kind", with = "::buffa::json_helpers::proto_enum")] - pub kind: ::buffa::EnumValue, - /// The head the writer guarded against. Absent when the writer guarded - /// against an empty stream. - /// - /// Field 2: `expected_head` - #[serde( - rename = "expectedHead", - alias = "expected_head", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub expected_head: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// The head the stream actually had. Absent when it could not be read, which - /// is itself informative: the conflict is real and its shape is not known. - /// - /// Field 3: `observed_head` - #[serde( - rename = "observedHead", - alias = "observed_head", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub observed_head: ::buffa::MessageField< - SessionOrdinal, - ::buffa::Inline, - >, - /// Human-readable, non-contractual. Never parse it. - /// - /// Field 4: `detail` - #[serde(rename = "detail", skip_serializing_if = "::core::option::Option::is_none")] - pub detail: ::core::option::Option<::buffa::alloc::string::String>, -} -impl ::core::fmt::Debug for WriteConflict { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("WriteConflict") - .field("kind", &self.kind) - .field("expected_head", &self.expected_head) - .field("observed_head", &self.observed_head) - .field("detail", &self.detail) - .finish() - } -} -impl WriteConflict { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.WriteConflict"; -} -impl WriteConflict { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::detail`] to `Some(value)`, consuming and returning `self`. - pub fn with_detail( - mut self, - value: impl Into<::buffa::alloc::string::String>, - ) -> Self { - self.detail = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(WriteConflict); -impl ::buffa::MessageName for WriteConflict { - const PACKAGE: &'static str = "trogonai.session.sessions.v1alpha1"; - const NAME: &'static str = "WriteConflict"; - const FULL_NAME: &'static str = "trogonai.session.sessions.v1alpha1.WriteConflict"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.session.sessions.v1alpha1.WriteConflict"; -} -impl ::buffa::Message for WriteConflict { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.expected_head.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.expected_head.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_head.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_head.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.detail { - size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.kind.to_i32(), buf); - if self.expected_head.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.expected_head.write_to(__cache, buf); - } - if self.observed_head.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_head.write_to(__cache, buf); - } - if let Some(ref v) = self.detail { - ::buffa::types::put_string_field(4u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.kind = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.expected_head.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_head.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string( - self.detail.get_or_insert_with(::buffa::alloc::string::String::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.kind = ::buffa::EnumValue::from(0); - self.expected_head = ::buffa::MessageField::none(); - self.observed_head = ::buffa::MessageField::none(); - self.detail = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for WriteConflict { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __WRITE_CONFLICT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.session.sessions.v1alpha1.WriteConflict", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.ledger.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.ledger.__view.rs deleted file mode 100644 index bd8551159..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.ledger.__view.rs +++ /dev/null @@ -1,2048 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/usage/settlement/v1alpha1/ledger.proto - -/// The settlement ledger a downstream billing consumer keeps for itself. -/// -/// This lives outside the Session domain on purpose. Session records what was -/// consumed; a billing consumer reads that and turns it into charges, and the -/// retry state of that second job is the consumer's problem, not the session's. -/// Publishing settlement progress back into a session stream would put a -/// downstream system's bookkeeping into a log that is never truncated -/// (ADR#0035 facet 7), so a transient provider outage would leave permanent -/// noise in the history of every session it touched. -/// -/// The one thing this ledger exists for is the case where a charge is published -/// and the acknowledgment is lost. At that moment the consumer knows less than -/// it did before it tried, and the only safe record is one that says so. Every -/// design choice here follows from refusing to let that state be written as -/// either success or failure. -/// -/// UsageRef identifies the usage a settlement is for. -/// -/// It points at the event that recorded consumption, not at a running total. -/// Totals are derived and can be recomputed differently; the fact that a -/// specific ordinal recorded a specific quantity cannot change, which is what -/// makes it usable as an idempotency basis. -#[derive(Clone, Debug, Default)] -pub struct UsageRefView<'a> { - /// Field 1: `session_id` - pub session_id: &'a str, - /// The SessionOrdinal that recorded the consumption. - /// - /// Field 2: `ordinal` - pub ordinal: u64, - /// Which meter this is: a model's input tokens, its output tokens, a tool's - /// invocations. Opaque to this contract. - /// - /// Field 3: `meter` - pub meter: &'a str, - /// Field 4: `quantity` - pub quantity: u64, - /// Who is charged. Carried on the record rather than resolved at settlement - /// time, because an account can be reassigned between consumption and billing - /// and the charge belongs to whoever owned the work when it ran. - /// - /// Field 5: `account_id` - pub account_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> UsageRefView<'a> { - /**Whether required field `session_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_session_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `ordinal` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_ordinal(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `meter` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_meter(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `quantity` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_quantity(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `account_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_account_id(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for UsageRefView<'a> { - type Owned = super::super::UsageRef; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.session_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.ordinal = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.meter = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.quantity = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.account_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::UsageRef { - session_id: self.session_id.to_string(), - ordinal: self.ordinal, - meter: self.meter.to_string(), - quantity: self.quantity, - account_id: self.account_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for UsageRefView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.ordinal) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.meter) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.quantity) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.account_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_uint64_field(2u32, self.ordinal, buf); - ::buffa::types::put_string_field(3u32, &self.meter, buf); - ::buffa::types::put_uint64_field(4u32, self.quantity, buf); - ::buffa::types::put_string_field(5u32, &self.account_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for UsageRefView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("sessionId", self.session_id)?; - } - { - __map - .serialize_entry( - "ordinal", - &::buffa::json_helpers::ProtoJson(&self.ordinal), - )?; - } - { - __map.serialize_entry("meter", self.meter)?; - } - { - __map - .serialize_entry( - "quantity", - &::buffa::json_helpers::ProtoJson(&self.quantity), - )?; - } - { - __map.serialize_entry("accountId", self.account_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for UsageRefView<'a> { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "UsageRef"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.UsageRef"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.UsageRef"; -} -::buffa::impl_default_view_instance!(UsageRefView); -::buffa::impl_view_reborrow!(UsageRefView); -/** Self-contained, `'static` owned view of a `UsageRef` message. - - Wraps [`::buffa::OwnedView`]`<`[`UsageRefView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`UsageRefView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct UsageRefOwnedView(::buffa::OwnedView>); -impl UsageRefOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok(UsageRefOwnedView(::buffa::OwnedView::decode(bytes)?)) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UsageRefOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::UsageRef, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - UsageRefOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`UsageRefView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &UsageRefView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::UsageRef { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `session_id` - #[must_use] - pub fn session_id(&self) -> &'_ str { - self.0.reborrow().session_id - } - /// The SessionOrdinal that recorded the consumption. - /// - /// Field 2: `ordinal` - #[must_use] - pub fn ordinal(&self) -> u64 { - self.0.reborrow().ordinal - } - /// Which meter this is: a model's input tokens, its output tokens, a tool's - /// invocations. Opaque to this contract. - /// - /// Field 3: `meter` - #[must_use] - pub fn meter(&self) -> &'_ str { - self.0.reborrow().meter - } - /// Field 4: `quantity` - #[must_use] - pub fn quantity(&self) -> u64 { - self.0.reborrow().quantity - } - /// Who is charged. Carried on the record rather than resolved at settlement - /// time, because an account can be reassigned between consumption and billing - /// and the charge belongs to whoever owned the work when it ran. - /// - /// Field 5: `account_id` - #[must_use] - pub fn account_id(&self) -> &'_ str { - self.0.reborrow().account_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for UsageRefOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - UsageRefOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: UsageRefOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for UsageRefOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::UsageRef { - type View<'a> = UsageRefView<'a>; - type ViewHandle = UsageRefOwnedView; -} -impl ::serde::Serialize for UsageRefOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// SettlementRecord is one usage fact and everything known about charging for it. -/// -/// The record is written before the charge is published, never after. A ledger -/// written after a successful publish cannot describe the failure it exists to -/// describe: if the process dies between publishing and recording, the only -/// evidence that a charge might exist is gone. -#[derive(Clone, Debug, Default)] -pub struct SettlementRecordView<'a> { - /// Idempotency key and primary identity, derived deterministically from - /// `usage`. - /// - /// Derived from the usage fact and never from the attempt. This is the single - /// property that makes double charging impossible rather than unlikely: a - /// retry recomputes the same key from the same session, ordinal, and meter, - /// so the provider sees the same request it may already have processed. A key - /// minted per attempt would make every retry a new charge, and the retry path - /// is exactly the path a lost acknowledgment forces a consumer down. - /// - /// Field 1: `settlement_id` - pub settlement_id: &'a str, - /// Field 2: `usage` - pub usage: ::buffa::MessageFieldView>, - /// Field 3: `state` - pub state: ::buffa::EnumValue, - /// Publish attempts made. Counts attempts, not charges: the whole point of a - /// stable idempotency key is that these two numbers are allowed to differ. - /// - /// Field 4: `attempt_count` - pub attempt_count: u32, - /// When the consumer durably recorded its intent to charge. - /// - /// Field 5: `intended_at` - pub intended_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// When the most recent publish was attempted. Unset before the first attempt. - /// - /// Field 6: `last_attempt_at` - pub last_attempt_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// When a terminal state was reached. Unset while unresolved. - /// - /// Field 7: `resolved_at` - pub resolved_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// What the provider returned, once it returned anything. Unset for every - /// state that never heard back, which is the same set of states that need - /// reconciling. - /// - /// Field 8: `receipt` - pub receipt: ::buffa::MessageFieldView< - super::super::__buffa::view::ProviderReceiptView<'a>, - >, - /// Set when this settlement needed a human. Its presence is what distinguishes - /// a resolution someone decided from one the protocol reached on its own. - /// - /// Field 9: `incident` - pub incident: ::buffa::MessageFieldView< - super::super::__buffa::view::SettlementIncidentView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SettlementRecordView<'a> { - /**Whether required field `settlement_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_settlement_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `usage` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_usage(&self) -> bool { - self.usage.is_set() - } - /**Whether required field `state` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_state(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `attempt_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_attempt_count(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `intended_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_intended_at(&self) -> bool { - self.intended_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for SettlementRecordView<'a> { - type Owned = super::super::SettlementRecord; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.settlement_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.usage.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.usage = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.state = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.attempt_count = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.intended_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.intended_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.last_attempt_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.last_attempt_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.resolved_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.resolved_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.receipt.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.receipt = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.incident.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.incident = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SettlementRecord { - settlement_id: self.settlement_id.to_string(), - usage: match self.usage.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::UsageRef, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - state: self.state, - attempt_count: self.attempt_count, - intended_at: match self.intended_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - last_attempt_at: match self.last_attempt_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - resolved_at: match self.resolved_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - receipt: match self.receipt.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ProviderReceipt, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - incident: match self.incident.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SettlementIncident, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SettlementRecordView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.settlement_id) as u64; - if self.usage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.usage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.state.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.attempt_count) as u64; - if self.intended_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.intended_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.last_attempt_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.last_attempt_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.resolved_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.resolved_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.receipt.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.receipt.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.incident.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.incident.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.settlement_id, buf); - if self.usage.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.usage.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.state.to_i32(), buf); - ::buffa::types::put_uint32_field(4u32, self.attempt_count, buf); - if self.intended_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.intended_at.write_to(__cache, buf); - } - if self.last_attempt_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.last_attempt_at.write_to(__cache, buf); - } - if self.resolved_at.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.resolved_at.write_to(__cache, buf); - } - if self.receipt.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.receipt.write_to(__cache, buf); - } - if self.incident.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.incident.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SettlementRecordView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("settlementId", self.settlement_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.usage.as_option() { - __map.serialize_entry("usage", __v)?; - } - } - { - __map.serialize_entry("state", &self.state)?; - } - { - __map - .serialize_entry( - "attemptCount", - &::buffa::json_helpers::ProtoJson(&self.attempt_count), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.intended_at.as_option() { - __map.serialize_entry("intendedAt", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.last_attempt_at.as_option() { - __map.serialize_entry("lastAttemptAt", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.resolved_at.as_option() { - __map.serialize_entry("resolvedAt", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.receipt.as_option() { - __map.serialize_entry("receipt", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.incident.as_option() { - __map.serialize_entry("incident", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SettlementRecordView<'a> { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "SettlementRecord"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.SettlementRecord"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.SettlementRecord"; -} -::buffa::impl_default_view_instance!(SettlementRecordView); -::buffa::impl_view_reborrow!(SettlementRecordView); -/** Self-contained, `'static` owned view of a `SettlementRecord` message. - - Wraps [`::buffa::OwnedView`]`<`[`SettlementRecordView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SettlementRecordView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SettlementRecordOwnedView(::buffa::OwnedView>); -impl SettlementRecordOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SettlementRecordOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SettlementRecordOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SettlementRecord, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SettlementRecordOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SettlementRecordView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SettlementRecordView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SettlementRecord { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Idempotency key and primary identity, derived deterministically from - /// `usage`. - /// - /// Derived from the usage fact and never from the attempt. This is the single - /// property that makes double charging impossible rather than unlikely: a - /// retry recomputes the same key from the same session, ordinal, and meter, - /// so the provider sees the same request it may already have processed. A key - /// minted per attempt would make every retry a new charge, and the retry path - /// is exactly the path a lost acknowledgment forces a consumer down. - /// - /// Field 1: `settlement_id` - #[must_use] - pub fn settlement_id(&self) -> &'_ str { - self.0.reborrow().settlement_id - } - /// Field 2: `usage` - #[must_use] - pub fn usage( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().usage - } - /// Field 3: `state` - #[must_use] - pub fn state(&self) -> ::buffa::EnumValue { - self.0.reborrow().state - } - /// Publish attempts made. Counts attempts, not charges: the whole point of a - /// stable idempotency key is that these two numbers are allowed to differ. - /// - /// Field 4: `attempt_count` - #[must_use] - pub fn attempt_count(&self) -> u32 { - self.0.reborrow().attempt_count - } - /// When the consumer durably recorded its intent to charge. - /// - /// Field 5: `intended_at` - #[must_use] - pub fn intended_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().intended_at - } - /// When the most recent publish was attempted. Unset before the first attempt. - /// - /// Field 6: `last_attempt_at` - #[must_use] - pub fn last_attempt_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().last_attempt_at - } - /// When a terminal state was reached. Unset while unresolved. - /// - /// Field 7: `resolved_at` - #[must_use] - pub fn resolved_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().resolved_at - } - /// What the provider returned, once it returned anything. Unset for every - /// state that never heard back, which is the same set of states that need - /// reconciling. - /// - /// Field 8: `receipt` - #[must_use] - pub fn receipt( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::ProviderReceiptView<'_>, - > { - &self.0.reborrow().receipt - } - /// Set when this settlement needed a human. Its presence is what distinguishes - /// a resolution someone decided from one the protocol reached on its own. - /// - /// Field 9: `incident` - #[must_use] - pub fn incident( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SettlementIncidentView<'_>, - > { - &self.0.reborrow().incident - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SettlementRecordOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SettlementRecordOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SettlementRecordOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SettlementRecordOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SettlementRecord { - type View<'a> = SettlementRecordView<'a>; - type ViewHandle = SettlementRecordOwnedView; -} -impl ::serde::Serialize for SettlementRecordOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ProviderReceipt is the provider's own record of a charge. -#[derive(Clone, Debug, Default)] -pub struct ProviderReceiptView<'a> { - /// The provider's identifier for the charge. Kept so a later reconciliation - /// can ask about this charge specifically rather than searching by amount and - /// time, which is how a reconciliation matches the wrong one. - /// - /// Field 1: `provider_charge_id` - pub provider_charge_id: &'a str, - /// Field 2: `acknowledged_at` - pub acknowledged_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// True when the provider reported this as a repeat of a charge it had already - /// processed under the same idempotency key. - /// - /// Worth recording rather than discarding as a duplicate-suppressed success: - /// it is direct evidence that an earlier attempt landed and its acknowledgment - /// was lost, which is the difference between a system that is retrying - /// correctly and one that is about to be found out at reconciliation. - /// - /// Field 3: `deduplicated` - pub deduplicated: bool, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ProviderReceiptView<'a> { - /**Whether required field `provider_charge_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_provider_charge_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `acknowledged_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_acknowledged_at(&self) -> bool { - self.acknowledged_at.is_set() - } - /**Whether required field `deduplicated` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_deduplicated(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ProviderReceiptView<'a> { - type Owned = super::super::ProviderReceipt; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.provider_charge_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.acknowledged_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.acknowledged_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.deduplicated = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ProviderReceipt { - provider_charge_id: self.provider_charge_id.to_string(), - acknowledged_at: match self.acknowledged_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - deduplicated: self.deduplicated, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ProviderReceiptView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.provider_charge_id) as u64; - if self.acknowledged_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.acknowledged_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.provider_charge_id, buf); - if self.acknowledged_at.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.acknowledged_at.write_to(__cache, buf); - } - ::buffa::types::put_bool_field(3u32, self.deduplicated, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ProviderReceiptView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("providerChargeId", self.provider_charge_id)?; - } - { - if let ::core::option::Option::Some(__v) = self.acknowledged_at.as_option() { - __map.serialize_entry("acknowledgedAt", __v)?; - } - } - { - __map.serialize_entry("deduplicated", &self.deduplicated)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ProviderReceiptView<'a> { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ProviderReceipt"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ProviderReceipt"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ProviderReceipt"; -} -::buffa::impl_default_view_instance!(ProviderReceiptView); -::buffa::impl_view_reborrow!(ProviderReceiptView); -/** Self-contained, `'static` owned view of a `ProviderReceipt` message. - - Wraps [`::buffa::OwnedView`]`<`[`ProviderReceiptView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ProviderReceiptView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ProviderReceiptOwnedView(::buffa::OwnedView>); -impl ProviderReceiptOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProviderReceiptOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProviderReceiptOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ProviderReceipt, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ProviderReceiptOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ProviderReceiptView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ProviderReceiptView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ProviderReceipt { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// The provider's identifier for the charge. Kept so a later reconciliation - /// can ask about this charge specifically rather than searching by amount and - /// time, which is how a reconciliation matches the wrong one. - /// - /// Field 1: `provider_charge_id` - #[must_use] - pub fn provider_charge_id(&self) -> &'_ str { - self.0.reborrow().provider_charge_id - } - /// Field 2: `acknowledged_at` - #[must_use] - pub fn acknowledged_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().acknowledged_at - } - /// True when the provider reported this as a repeat of a charge it had already - /// processed under the same idempotency key. - /// - /// Worth recording rather than discarding as a duplicate-suppressed success: - /// it is direct evidence that an earlier attempt landed and its acknowledgment - /// was lost, which is the difference between a system that is retrying - /// correctly and one that is about to be found out at reconciliation. - /// - /// Field 3: `deduplicated` - #[must_use] - pub fn deduplicated(&self) -> bool { - self.0.reborrow().deduplicated - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ProviderReceiptOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ProviderReceiptOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ProviderReceiptOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ProviderReceiptOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ProviderReceipt { - type View<'a> = ProviderReceiptView<'a>; - type ViewHandle = ProviderReceiptOwnedView; -} -impl ::serde::Serialize for ProviderReceiptOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// SettlementIncident is a settlement that needed a decision. -#[derive(Clone, Debug, Default)] -pub struct SettlementIncidentView<'a> { - /// Field 1: `incident_id` - pub incident_id: &'a str, - /// Field 2: `kind` - pub kind: ::buffa::EnumValue, - /// Field 3: `opened_at` - pub opened_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// Unset while open. - /// - /// Field 4: `resolved_at` - pub resolved_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// Field 5: `resolution` - pub resolution: ::buffa::EnumValue, - /// Free text for whoever has to read this later. Never parsed. - /// - /// Field 6: `note` - pub note: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> SettlementIncidentView<'a> { - /**Whether required field `incident_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_incident_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `kind` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_kind(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `opened_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_opened_at(&self) -> bool { - self.opened_at.is_set() - } - /**Whether required field `resolution` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_resolution(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `note` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_note(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for SettlementIncidentView<'a> { - type Owned = super::super::SettlementIncident; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.incident_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.kind = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.opened_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.opened_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.resolved_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.resolved_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.resolution = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 4u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.note = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::SettlementIncident { - incident_id: self.incident_id.to_string(), - kind: self.kind, - opened_at: match self.opened_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - resolved_at: match self.resolved_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - resolution: self.resolution, - note: self.note.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for SettlementIncidentView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.incident_id) as u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.opened_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.opened_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.resolved_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.resolved_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.resolution.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.note) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.incident_id, buf); - ::buffa::types::put_int32_field(2u32, self.kind.to_i32(), buf); - if self.opened_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.opened_at.write_to(__cache, buf); - } - if self.resolved_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.resolved_at.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(5u32, self.resolution.to_i32(), buf); - ::buffa::types::put_string_field(6u32, &self.note, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for SettlementIncidentView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("incidentId", self.incident_id)?; - } - { - __map.serialize_entry("kind", &self.kind)?; - } - { - if let ::core::option::Option::Some(__v) = self.opened_at.as_option() { - __map.serialize_entry("openedAt", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.resolved_at.as_option() { - __map.serialize_entry("resolvedAt", __v)?; - } - } - { - __map.serialize_entry("resolution", &self.resolution)?; - } - { - __map.serialize_entry("note", self.note)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for SettlementIncidentView<'a> { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "SettlementIncident"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.SettlementIncident"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.SettlementIncident"; -} -::buffa::impl_default_view_instance!(SettlementIncidentView); -::buffa::impl_view_reborrow!(SettlementIncidentView); -/** Self-contained, `'static` owned view of a `SettlementIncident` message. - - Wraps [`::buffa::OwnedView`]`<`[`SettlementIncidentView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`SettlementIncidentView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct SettlementIncidentOwnedView( - ::buffa::OwnedView>, -); -impl SettlementIncidentOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SettlementIncidentOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SettlementIncidentOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::SettlementIncident, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - SettlementIncidentOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`SettlementIncidentView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &SettlementIncidentView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::SettlementIncident { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `incident_id` - #[must_use] - pub fn incident_id(&self) -> &'_ str { - self.0.reborrow().incident_id - } - /// Field 2: `kind` - #[must_use] - pub fn kind(&self) -> ::buffa::EnumValue { - self.0.reborrow().kind - } - /// Field 3: `opened_at` - #[must_use] - pub fn opened_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().opened_at - } - /// Unset while open. - /// - /// Field 4: `resolved_at` - #[must_use] - pub fn resolved_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().resolved_at - } - /// Field 5: `resolution` - #[must_use] - pub fn resolution(&self) -> ::buffa::EnumValue { - self.0.reborrow().resolution - } - /// Free text for whoever has to read this later. Never parsed. - /// - /// Field 6: `note` - #[must_use] - pub fn note(&self) -> &'_ str { - self.0.reborrow().note - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for SettlementIncidentOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - SettlementIncidentOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: SettlementIncidentOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for SettlementIncidentOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::SettlementIncident { - type View<'a> = SettlementIncidentView<'a>; - type ViewHandle = SettlementIncidentOwnedView; -} -impl ::serde::Serialize for SettlementIncidentOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.ledger.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.ledger.rs deleted file mode 100644 index aa10ea6c3..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.ledger.rs +++ /dev/null @@ -1,1618 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/usage/settlement/v1alpha1/ledger.proto - -/// SettlementState is how far a settlement got, and what a retry is allowed to -/// assume. -/// -/// The zero value is the one that blocks a blind retry, because the failure mode -/// this ledger prevents is a retry that assumes nothing happened. A reader that -/// does not recognize a variant must reconcile before charging again. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum SettlementState { - /// Unknown state. Treat as UNKNOWN: reconcile before any further publish. - SETTLEMENT_STATE_UNSPECIFIED = 0i32, - /// Intent is durable and no publish has been attempted. - /// - /// The only state that lets a consumer conclude no charge exists. It holds - /// because the transition to IN_FLIGHT is itself durable and happens before - /// the publish call, so a crash cannot skip past it. - SETTLEMENT_STATE_INTENDED = 1i32, - /// A publish is in progress. - /// - /// Not durable across a restart in the sense a reader might expect: a consumer - /// recovering from a crash has no in-progress calls, so every record found in - /// this state on startup is moved to UNKNOWN. Its useful life is entirely - /// within one process lifetime. - SETTLEMENT_STATE_IN_FLIGHT = 2i32, - /// A publish was attempted and its outcome was never observed. - /// - /// This is the state the ledger is for. The charge may exist and may not, and - /// the consumer must not guess in either direction: republishing under the - /// same idempotency key is safe, and treating it as failed and re-deriving a - /// key is the double charge. - SETTLEMENT_STATE_UNKNOWN = 3i32, - /// The provider confirmed the charge. Terminal. - SETTLEMENT_STATE_SETTLED = 4i32, - /// The provider refused the charge and said so. Terminal, and not a retry: - /// a refusal that is republished unchanged is refused again. - SETTLEMENT_STATE_REJECTED = 5i32, - /// Closed without settling, by a decision recorded in `incident`. Terminal. - /// - /// Reachable only through an incident, so nothing in the automated path can - /// reach it. A consumer that could abandon a charge on its own would be one - /// that quietly stops billing under sustained provider failure. - SETTLEMENT_STATE_ABANDONED = 6i32, -} -impl SettlementState { - ///Idiomatic alias for [`Self::SETTLEMENT_STATE_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::SETTLEMENT_STATE_UNSPECIFIED; - ///Idiomatic alias for [`Self::SETTLEMENT_STATE_INTENDED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Intended: Self = Self::SETTLEMENT_STATE_INTENDED; - ///Idiomatic alias for [`Self::SETTLEMENT_STATE_IN_FLIGHT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const InFlight: Self = Self::SETTLEMENT_STATE_IN_FLIGHT; - ///Idiomatic alias for [`Self::SETTLEMENT_STATE_UNKNOWN`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unknown: Self = Self::SETTLEMENT_STATE_UNKNOWN; - ///Idiomatic alias for [`Self::SETTLEMENT_STATE_SETTLED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Settled: Self = Self::SETTLEMENT_STATE_SETTLED; - ///Idiomatic alias for [`Self::SETTLEMENT_STATE_REJECTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Rejected: Self = Self::SETTLEMENT_STATE_REJECTED; - ///Idiomatic alias for [`Self::SETTLEMENT_STATE_ABANDONED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Abandoned: Self = Self::SETTLEMENT_STATE_ABANDONED; -} -impl ::core::default::Default for SettlementState { - fn default() -> Self { - Self::SETTLEMENT_STATE_UNSPECIFIED - } -} -impl ::serde::Serialize for SettlementState { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for SettlementState { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = SettlementState; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(SettlementState) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for SettlementState { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for SettlementState { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::SETTLEMENT_STATE_UNSPECIFIED), - 1i32 => ::core::option::Option::Some(Self::SETTLEMENT_STATE_INTENDED), - 2i32 => ::core::option::Option::Some(Self::SETTLEMENT_STATE_IN_FLIGHT), - 3i32 => ::core::option::Option::Some(Self::SETTLEMENT_STATE_UNKNOWN), - 4i32 => ::core::option::Option::Some(Self::SETTLEMENT_STATE_SETTLED), - 5i32 => ::core::option::Option::Some(Self::SETTLEMENT_STATE_REJECTED), - 6i32 => ::core::option::Option::Some(Self::SETTLEMENT_STATE_ABANDONED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::SETTLEMENT_STATE_UNSPECIFIED => "SETTLEMENT_STATE_UNSPECIFIED", - Self::SETTLEMENT_STATE_INTENDED => "SETTLEMENT_STATE_INTENDED", - Self::SETTLEMENT_STATE_IN_FLIGHT => "SETTLEMENT_STATE_IN_FLIGHT", - Self::SETTLEMENT_STATE_UNKNOWN => "SETTLEMENT_STATE_UNKNOWN", - Self::SETTLEMENT_STATE_SETTLED => "SETTLEMENT_STATE_SETTLED", - Self::SETTLEMENT_STATE_REJECTED => "SETTLEMENT_STATE_REJECTED", - Self::SETTLEMENT_STATE_ABANDONED => "SETTLEMENT_STATE_ABANDONED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "SETTLEMENT_STATE_UNSPECIFIED" => { - ::core::option::Option::Some(Self::SETTLEMENT_STATE_UNSPECIFIED) - } - "SETTLEMENT_STATE_INTENDED" => { - ::core::option::Option::Some(Self::SETTLEMENT_STATE_INTENDED) - } - "SETTLEMENT_STATE_IN_FLIGHT" => { - ::core::option::Option::Some(Self::SETTLEMENT_STATE_IN_FLIGHT) - } - "SETTLEMENT_STATE_UNKNOWN" => { - ::core::option::Option::Some(Self::SETTLEMENT_STATE_UNKNOWN) - } - "SETTLEMENT_STATE_SETTLED" => { - ::core::option::Option::Some(Self::SETTLEMENT_STATE_SETTLED) - } - "SETTLEMENT_STATE_REJECTED" => { - ::core::option::Option::Some(Self::SETTLEMENT_STATE_REJECTED) - } - "SETTLEMENT_STATE_ABANDONED" => { - ::core::option::Option::Some(Self::SETTLEMENT_STATE_ABANDONED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::SETTLEMENT_STATE_UNSPECIFIED, - Self::SETTLEMENT_STATE_INTENDED, - Self::SETTLEMENT_STATE_IN_FLIGHT, - Self::SETTLEMENT_STATE_UNKNOWN, - Self::SETTLEMENT_STATE_SETTLED, - Self::SETTLEMENT_STATE_REJECTED, - Self::SETTLEMENT_STATE_ABANDONED, - ] - } -} -/// IncidentKind is why a settlement stopped being something the protocol could -/// finish by itself. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum IncidentKind { - INCIDENT_KIND_UNSPECIFIED = 0i32, - /// A settlement sat in UNKNOWN past the window in which the provider could - /// still be asked about it. Someone has to establish whether the money moved. - INCIDENT_KIND_UNKNOWN_OUTCOME_EXPIRED = 1i32, - /// Two settled records were found for the same usage. Either the idempotency - /// key was not derived deterministically, or the provider processed the same - /// key twice, and both call for a refund rather than a retry. - INCIDENT_KIND_DUPLICATE_CHARGE_DETECTED = 2i32, - /// The provider refused in a way that will not resolve by retrying: a closed - /// account, an unrecognized meter, a rejected currency. - INCIDENT_KIND_PROVIDER_REFUSED = 3i32, - /// The session this usage belongs to no longer shows it, because a rewind, - /// compaction, or redaction removed the ordinal from effective history. - /// - /// Opened as an incident rather than reversed automatically, because usage is - /// not part of effective history. Tokens that were spent were spent, and - /// rewinding a session does not un-consume them, so a ledger that followed - /// effective history would refund real compute every time a user backed up a - /// turn. What is genuinely ambiguous is whether the removal was a correction - /// or a privacy action, and that is a question for a person. - INCIDENT_KIND_USAGE_RETRACTED = 4i32, -} -impl IncidentKind { - ///Idiomatic alias for [`Self::INCIDENT_KIND_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::INCIDENT_KIND_UNSPECIFIED; - ///Idiomatic alias for [`Self::INCIDENT_KIND_UNKNOWN_OUTCOME_EXPIRED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const UnknownOutcomeExpired: Self = Self::INCIDENT_KIND_UNKNOWN_OUTCOME_EXPIRED; - ///Idiomatic alias for [`Self::INCIDENT_KIND_DUPLICATE_CHARGE_DETECTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const DuplicateChargeDetected: Self = Self::INCIDENT_KIND_DUPLICATE_CHARGE_DETECTED; - ///Idiomatic alias for [`Self::INCIDENT_KIND_PROVIDER_REFUSED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ProviderRefused: Self = Self::INCIDENT_KIND_PROVIDER_REFUSED; - ///Idiomatic alias for [`Self::INCIDENT_KIND_USAGE_RETRACTED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const UsageRetracted: Self = Self::INCIDENT_KIND_USAGE_RETRACTED; -} -impl ::core::default::Default for IncidentKind { - fn default() -> Self { - Self::INCIDENT_KIND_UNSPECIFIED - } -} -impl ::serde::Serialize for IncidentKind { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for IncidentKind { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = IncidentKind; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!("a string, integer, or null for ", stringify!(IncidentKind)), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for IncidentKind { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for IncidentKind { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::INCIDENT_KIND_UNSPECIFIED), - 1i32 => { - ::core::option::Option::Some(Self::INCIDENT_KIND_UNKNOWN_OUTCOME_EXPIRED) - } - 2i32 => { - ::core::option::Option::Some( - Self::INCIDENT_KIND_DUPLICATE_CHARGE_DETECTED, - ) - } - 3i32 => ::core::option::Option::Some(Self::INCIDENT_KIND_PROVIDER_REFUSED), - 4i32 => ::core::option::Option::Some(Self::INCIDENT_KIND_USAGE_RETRACTED), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::INCIDENT_KIND_UNSPECIFIED => "INCIDENT_KIND_UNSPECIFIED", - Self::INCIDENT_KIND_UNKNOWN_OUTCOME_EXPIRED => { - "INCIDENT_KIND_UNKNOWN_OUTCOME_EXPIRED" - } - Self::INCIDENT_KIND_DUPLICATE_CHARGE_DETECTED => { - "INCIDENT_KIND_DUPLICATE_CHARGE_DETECTED" - } - Self::INCIDENT_KIND_PROVIDER_REFUSED => "INCIDENT_KIND_PROVIDER_REFUSED", - Self::INCIDENT_KIND_USAGE_RETRACTED => "INCIDENT_KIND_USAGE_RETRACTED", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "INCIDENT_KIND_UNSPECIFIED" => { - ::core::option::Option::Some(Self::INCIDENT_KIND_UNSPECIFIED) - } - "INCIDENT_KIND_UNKNOWN_OUTCOME_EXPIRED" => { - ::core::option::Option::Some(Self::INCIDENT_KIND_UNKNOWN_OUTCOME_EXPIRED) - } - "INCIDENT_KIND_DUPLICATE_CHARGE_DETECTED" => { - ::core::option::Option::Some( - Self::INCIDENT_KIND_DUPLICATE_CHARGE_DETECTED, - ) - } - "INCIDENT_KIND_PROVIDER_REFUSED" => { - ::core::option::Option::Some(Self::INCIDENT_KIND_PROVIDER_REFUSED) - } - "INCIDENT_KIND_USAGE_RETRACTED" => { - ::core::option::Option::Some(Self::INCIDENT_KIND_USAGE_RETRACTED) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::INCIDENT_KIND_UNSPECIFIED, - Self::INCIDENT_KIND_UNKNOWN_OUTCOME_EXPIRED, - Self::INCIDENT_KIND_DUPLICATE_CHARGE_DETECTED, - Self::INCIDENT_KIND_PROVIDER_REFUSED, - Self::INCIDENT_KIND_USAGE_RETRACTED, - ] - } -} -/// IncidentResolution is what was decided, once someone decided. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum IncidentResolution { - /// Still open. The zero value, so an incident record that was never resolved - /// cannot read as one that was. - INCIDENT_RESOLUTION_UNSPECIFIED = 0i32, - /// Established that the charge exists. The record moves to SETTLED. - INCIDENT_RESOLUTION_CONFIRMED_CHARGED = 1i32, - /// Established that no charge exists. The record returns to INTENDED and may - /// be published again. - INCIDENT_RESOLUTION_CONFIRMED_NOT_CHARGED = 2i32, - /// A charge existed and was reversed. - INCIDENT_RESOLUTION_REFUNDED = 3i32, - /// Closed without charging and without further attempts. The record moves to - /// ABANDONED. - INCIDENT_RESOLUTION_WRITTEN_OFF = 4i32, -} -impl IncidentResolution { - ///Idiomatic alias for [`Self::INCIDENT_RESOLUTION_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::INCIDENT_RESOLUTION_UNSPECIFIED; - ///Idiomatic alias for [`Self::INCIDENT_RESOLUTION_CONFIRMED_CHARGED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ConfirmedCharged: Self = Self::INCIDENT_RESOLUTION_CONFIRMED_CHARGED; - ///Idiomatic alias for [`Self::INCIDENT_RESOLUTION_CONFIRMED_NOT_CHARGED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ConfirmedNotCharged: Self = Self::INCIDENT_RESOLUTION_CONFIRMED_NOT_CHARGED; - ///Idiomatic alias for [`Self::INCIDENT_RESOLUTION_REFUNDED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Refunded: Self = Self::INCIDENT_RESOLUTION_REFUNDED; - ///Idiomatic alias for [`Self::INCIDENT_RESOLUTION_WRITTEN_OFF`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const WrittenOff: Self = Self::INCIDENT_RESOLUTION_WRITTEN_OFF; -} -impl ::core::default::Default for IncidentResolution { - fn default() -> Self { - Self::INCIDENT_RESOLUTION_UNSPECIFIED - } -} -impl ::serde::Serialize for IncidentResolution { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for IncidentResolution { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = IncidentResolution; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", stringify!(IncidentResolution) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for IncidentResolution { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for IncidentResolution { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => ::core::option::Option::Some(Self::INCIDENT_RESOLUTION_UNSPECIFIED), - 1i32 => { - ::core::option::Option::Some(Self::INCIDENT_RESOLUTION_CONFIRMED_CHARGED) - } - 2i32 => { - ::core::option::Option::Some( - Self::INCIDENT_RESOLUTION_CONFIRMED_NOT_CHARGED, - ) - } - 3i32 => ::core::option::Option::Some(Self::INCIDENT_RESOLUTION_REFUNDED), - 4i32 => ::core::option::Option::Some(Self::INCIDENT_RESOLUTION_WRITTEN_OFF), - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::INCIDENT_RESOLUTION_UNSPECIFIED => "INCIDENT_RESOLUTION_UNSPECIFIED", - Self::INCIDENT_RESOLUTION_CONFIRMED_CHARGED => { - "INCIDENT_RESOLUTION_CONFIRMED_CHARGED" - } - Self::INCIDENT_RESOLUTION_CONFIRMED_NOT_CHARGED => { - "INCIDENT_RESOLUTION_CONFIRMED_NOT_CHARGED" - } - Self::INCIDENT_RESOLUTION_REFUNDED => "INCIDENT_RESOLUTION_REFUNDED", - Self::INCIDENT_RESOLUTION_WRITTEN_OFF => "INCIDENT_RESOLUTION_WRITTEN_OFF", - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "INCIDENT_RESOLUTION_UNSPECIFIED" => { - ::core::option::Option::Some(Self::INCIDENT_RESOLUTION_UNSPECIFIED) - } - "INCIDENT_RESOLUTION_CONFIRMED_CHARGED" => { - ::core::option::Option::Some(Self::INCIDENT_RESOLUTION_CONFIRMED_CHARGED) - } - "INCIDENT_RESOLUTION_CONFIRMED_NOT_CHARGED" => { - ::core::option::Option::Some( - Self::INCIDENT_RESOLUTION_CONFIRMED_NOT_CHARGED, - ) - } - "INCIDENT_RESOLUTION_REFUNDED" => { - ::core::option::Option::Some(Self::INCIDENT_RESOLUTION_REFUNDED) - } - "INCIDENT_RESOLUTION_WRITTEN_OFF" => { - ::core::option::Option::Some(Self::INCIDENT_RESOLUTION_WRITTEN_OFF) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::INCIDENT_RESOLUTION_UNSPECIFIED, - Self::INCIDENT_RESOLUTION_CONFIRMED_CHARGED, - Self::INCIDENT_RESOLUTION_CONFIRMED_NOT_CHARGED, - Self::INCIDENT_RESOLUTION_REFUNDED, - Self::INCIDENT_RESOLUTION_WRITTEN_OFF, - ] - } -} -/// The settlement ledger a downstream billing consumer keeps for itself. -/// -/// This lives outside the Session domain on purpose. Session records what was -/// consumed; a billing consumer reads that and turns it into charges, and the -/// retry state of that second job is the consumer's problem, not the session's. -/// Publishing settlement progress back into a session stream would put a -/// downstream system's bookkeeping into a log that is never truncated -/// (ADR#0035 facet 7), so a transient provider outage would leave permanent -/// noise in the history of every session it touched. -/// -/// The one thing this ledger exists for is the case where a charge is published -/// and the acknowledgment is lost. At that moment the consumer knows less than -/// it did before it tried, and the only safe record is one that says so. Every -/// design choice here follows from refusing to let that state be written as -/// either success or failure. -/// -/// UsageRef identifies the usage a settlement is for. -/// -/// It points at the event that recorded consumption, not at a running total. -/// Totals are derived and can be recomputed differently; the fact that a -/// specific ordinal recorded a specific quantity cannot change, which is what -/// makes it usable as an idempotency basis. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct UsageRef { - /// Field 1: `session_id` - #[serde( - rename = "sessionId", - alias = "session_id", - with = "::buffa::json_helpers::proto_string" - )] - pub session_id: ::buffa::alloc::string::String, - /// The SessionOrdinal that recorded the consumption. - /// - /// Field 2: `ordinal` - #[serde(rename = "ordinal", with = "::buffa::json_helpers::uint64")] - pub ordinal: u64, - /// Which meter this is: a model's input tokens, its output tokens, a tool's - /// invocations. Opaque to this contract. - /// - /// Field 3: `meter` - #[serde(rename = "meter", with = "::buffa::json_helpers::proto_string")] - pub meter: ::buffa::alloc::string::String, - /// Field 4: `quantity` - #[serde(rename = "quantity", with = "::buffa::json_helpers::uint64")] - pub quantity: u64, - /// Who is charged. Carried on the record rather than resolved at settlement - /// time, because an account can be reassigned between consumption and billing - /// and the charge belongs to whoever owned the work when it ran. - /// - /// Field 5: `account_id` - #[serde( - rename = "accountId", - alias = "account_id", - with = "::buffa::json_helpers::proto_string" - )] - pub account_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for UsageRef { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("UsageRef") - .field("session_id", &self.session_id) - .field("ordinal", &self.ordinal) - .field("meter", &self.meter) - .field("quantity", &self.quantity) - .field("account_id", &self.account_id) - .finish() - } -} -impl UsageRef { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.UsageRef"; -} -::buffa::impl_default_instance!(UsageRef); -impl ::buffa::MessageName for UsageRef { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "UsageRef"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.UsageRef"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.UsageRef"; -} -impl ::buffa::Message for UsageRef { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.session_id) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.ordinal) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.meter) as u64; - size += 1u64 + ::buffa::types::uint64_encoded_len(self.quantity) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.account_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.session_id, buf); - ::buffa::types::put_uint64_field(2u32, self.ordinal, buf); - ::buffa::types::put_string_field(3u32, &self.meter, buf); - ::buffa::types::put_uint64_field(4u32, self.quantity, buf); - ::buffa::types::put_string_field(5u32, &self.account_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.session_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.ordinal = ::buffa::types::decode_uint64(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.meter, buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.quantity = ::buffa::types::decode_uint64(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.account_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.session_id.clear(); - self.ordinal = 0u64; - self.meter.clear(); - self.quantity = 0u64; - self.account_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for UsageRef { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __USAGE_REF_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.usage.settlement.v1alpha1.UsageRef", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// SettlementRecord is one usage fact and everything known about charging for it. -/// -/// The record is written before the charge is published, never after. A ledger -/// written after a successful publish cannot describe the failure it exists to -/// describe: if the process dies between publishing and recording, the only -/// evidence that a charge might exist is gone. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SettlementRecord { - /// Idempotency key and primary identity, derived deterministically from - /// `usage`. - /// - /// Derived from the usage fact and never from the attempt. This is the single - /// property that makes double charging impossible rather than unlikely: a - /// retry recomputes the same key from the same session, ordinal, and meter, - /// so the provider sees the same request it may already have processed. A key - /// minted per attempt would make every retry a new charge, and the retry path - /// is exactly the path a lost acknowledgment forces a consumer down. - /// - /// Field 1: `settlement_id` - #[serde( - rename = "settlementId", - alias = "settlement_id", - with = "::buffa::json_helpers::proto_string" - )] - pub settlement_id: ::buffa::alloc::string::String, - /// Field 2: `usage` - #[serde(rename = "usage")] - pub usage: ::buffa::MessageField>, - /// Field 3: `state` - #[serde(rename = "state", with = "::buffa::json_helpers::proto_enum")] - pub state: ::buffa::EnumValue, - /// Publish attempts made. Counts attempts, not charges: the whole point of a - /// stable idempotency key is that these two numbers are allowed to differ. - /// - /// Field 4: `attempt_count` - #[serde( - rename = "attemptCount", - alias = "attempt_count", - with = "::buffa::json_helpers::uint32" - )] - pub attempt_count: u32, - /// When the consumer durably recorded its intent to charge. - /// - /// Field 5: `intended_at` - #[serde(rename = "intendedAt", alias = "intended_at")] - pub intended_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// When the most recent publish was attempted. Unset before the first attempt. - /// - /// Field 6: `last_attempt_at` - #[serde( - rename = "lastAttemptAt", - alias = "last_attempt_at", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub last_attempt_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// When a terminal state was reached. Unset while unresolved. - /// - /// Field 7: `resolved_at` - #[serde( - rename = "resolvedAt", - alias = "resolved_at", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub resolved_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// What the provider returned, once it returned anything. Unset for every - /// state that never heard back, which is the same set of states that need - /// reconciling. - /// - /// Field 8: `receipt` - #[serde( - rename = "receipt", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub receipt: ::buffa::MessageField< - ProviderReceipt, - ::buffa::Inline, - >, - /// Set when this settlement needed a human. Its presence is what distinguishes - /// a resolution someone decided from one the protocol reached on its own. - /// - /// Field 9: `incident` - #[serde( - rename = "incident", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub incident: ::buffa::MessageField< - SettlementIncident, - ::buffa::Inline, - >, -} -impl ::core::fmt::Debug for SettlementRecord { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SettlementRecord") - .field("settlement_id", &self.settlement_id) - .field("usage", &self.usage) - .field("state", &self.state) - .field("attempt_count", &self.attempt_count) - .field("intended_at", &self.intended_at) - .field("last_attempt_at", &self.last_attempt_at) - .field("resolved_at", &self.resolved_at) - .field("receipt", &self.receipt) - .field("incident", &self.incident) - .finish() - } -} -impl SettlementRecord { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.SettlementRecord"; -} -::buffa::impl_default_instance!(SettlementRecord); -impl ::buffa::MessageName for SettlementRecord { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "SettlementRecord"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.SettlementRecord"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.SettlementRecord"; -} -impl ::buffa::Message for SettlementRecord { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.settlement_id) as u64; - if self.usage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.usage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.state.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.attempt_count) as u64; - if self.intended_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.intended_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.last_attempt_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.last_attempt_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.resolved_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.resolved_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.receipt.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.receipt.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.incident.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.incident.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.settlement_id, buf); - if self.usage.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.usage.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(3u32, self.state.to_i32(), buf); - ::buffa::types::put_uint32_field(4u32, self.attempt_count, buf); - if self.intended_at.is_set() { - ::buffa::types::put_len_delimited_header( - 5u32, - u64::from(__cache.consume_next()), - buf, - ); - self.intended_at.write_to(__cache, buf); - } - if self.last_attempt_at.is_set() { - ::buffa::types::put_len_delimited_header( - 6u32, - u64::from(__cache.consume_next()), - buf, - ); - self.last_attempt_at.write_to(__cache, buf); - } - if self.resolved_at.is_set() { - ::buffa::types::put_len_delimited_header( - 7u32, - u64::from(__cache.consume_next()), - buf, - ); - self.resolved_at.write_to(__cache, buf); - } - if self.receipt.is_set() { - ::buffa::types::put_len_delimited_header( - 8u32, - u64::from(__cache.consume_next()), - buf, - ); - self.receipt.write_to(__cache, buf); - } - if self.incident.is_set() { - ::buffa::types::put_len_delimited_header( - 9u32, - u64::from(__cache.consume_next()), - buf, - ); - self.incident.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.settlement_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.usage.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.state = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.attempt_count = ::buffa::types::decode_uint32(buf)?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.intended_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.last_attempt_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.resolved_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 8u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.receipt.get_or_insert_default(), - buf, - ctx, - )?; - } - 9u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.incident.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.settlement_id.clear(); - self.usage = ::buffa::MessageField::none(); - self.state = ::buffa::EnumValue::from(0); - self.attempt_count = 0u32; - self.intended_at = ::buffa::MessageField::none(); - self.last_attempt_at = ::buffa::MessageField::none(); - self.resolved_at = ::buffa::MessageField::none(); - self.receipt = ::buffa::MessageField::none(); - self.incident = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SettlementRecord { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SETTLEMENT_RECORD_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.usage.settlement.v1alpha1.SettlementRecord", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ProviderReceipt is the provider's own record of a charge. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ProviderReceipt { - /// The provider's identifier for the charge. Kept so a later reconciliation - /// can ask about this charge specifically rather than searching by amount and - /// time, which is how a reconciliation matches the wrong one. - /// - /// Field 1: `provider_charge_id` - #[serde( - rename = "providerChargeId", - alias = "provider_charge_id", - with = "::buffa::json_helpers::proto_string" - )] - pub provider_charge_id: ::buffa::alloc::string::String, - /// Field 2: `acknowledged_at` - #[serde(rename = "acknowledgedAt", alias = "acknowledged_at")] - pub acknowledged_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// True when the provider reported this as a repeat of a charge it had already - /// processed under the same idempotency key. - /// - /// Worth recording rather than discarding as a duplicate-suppressed success: - /// it is direct evidence that an earlier attempt landed and its acknowledgment - /// was lost, which is the difference between a system that is retrying - /// correctly and one that is about to be found out at reconciliation. - /// - /// Field 3: `deduplicated` - #[serde(rename = "deduplicated", with = "::buffa::json_helpers::proto_bool")] - pub deduplicated: bool, -} -impl ::core::fmt::Debug for ProviderReceipt { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ProviderReceipt") - .field("provider_charge_id", &self.provider_charge_id) - .field("acknowledged_at", &self.acknowledged_at) - .field("deduplicated", &self.deduplicated) - .finish() - } -} -impl ProviderReceipt { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ProviderReceipt"; -} -::buffa::impl_default_instance!(ProviderReceipt); -impl ::buffa::MessageName for ProviderReceipt { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ProviderReceipt"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ProviderReceipt"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ProviderReceipt"; -} -impl ::buffa::Message for ProviderReceipt { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size - += 1u64 - + ::buffa::types::string_encoded_len(&self.provider_charge_id) as u64; - if self.acknowledged_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.acknowledged_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.provider_charge_id, buf); - if self.acknowledged_at.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.acknowledged_at.write_to(__cache, buf); - } - ::buffa::types::put_bool_field(3u32, self.deduplicated, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.provider_charge_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.acknowledged_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.deduplicated = ::buffa::types::decode_bool(buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.provider_charge_id.clear(); - self.acknowledged_at = ::buffa::MessageField::none(); - self.deduplicated = false; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ProviderReceipt { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __PROVIDER_RECEIPT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ProviderReceipt", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// SettlementIncident is a settlement that needed a decision. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct SettlementIncident { - /// Field 1: `incident_id` - #[serde( - rename = "incidentId", - alias = "incident_id", - with = "::buffa::json_helpers::proto_string" - )] - pub incident_id: ::buffa::alloc::string::String, - /// Field 2: `kind` - #[serde(rename = "kind", with = "::buffa::json_helpers::proto_enum")] - pub kind: ::buffa::EnumValue, - /// Field 3: `opened_at` - #[serde(rename = "openedAt", alias = "opened_at")] - pub opened_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// Unset while open. - /// - /// Field 4: `resolved_at` - #[serde( - rename = "resolvedAt", - alias = "resolved_at", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub resolved_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// Field 5: `resolution` - #[serde(rename = "resolution", with = "::buffa::json_helpers::proto_enum")] - pub resolution: ::buffa::EnumValue, - /// Free text for whoever has to read this later. Never parsed. - /// - /// Field 6: `note` - #[serde(rename = "note", with = "::buffa::json_helpers::proto_string")] - pub note: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for SettlementIncident { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("SettlementIncident") - .field("incident_id", &self.incident_id) - .field("kind", &self.kind) - .field("opened_at", &self.opened_at) - .field("resolved_at", &self.resolved_at) - .field("resolution", &self.resolution) - .field("note", &self.note) - .finish() - } -} -impl SettlementIncident { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.SettlementIncident"; -} -::buffa::impl_default_instance!(SettlementIncident); -impl ::buffa::MessageName for SettlementIncident { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "SettlementIncident"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.SettlementIncident"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.SettlementIncident"; -} -impl ::buffa::Message for SettlementIncident { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.incident_id) as u64; - { - let val = self.kind.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.opened_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.opened_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.resolved_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.resolved_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - { - let val = self.resolution.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - size += 1u64 + ::buffa::types::string_encoded_len(&self.note) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.incident_id, buf); - ::buffa::types::put_int32_field(2u32, self.kind.to_i32(), buf); - if self.opened_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.opened_at.write_to(__cache, buf); - } - if self.resolved_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.resolved_at.write_to(__cache, buf); - } - ::buffa::types::put_int32_field(5u32, self.resolution.to_i32(), buf); - ::buffa::types::put_string_field(6u32, &self.note, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.incident_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.kind = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.opened_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.resolved_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.resolution = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.note, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.incident_id.clear(); - self.kind = ::buffa::EnumValue::from(0); - self.opened_at = ::buffa::MessageField::none(); - self.resolved_at = ::buffa::MessageField::none(); - self.resolution = ::buffa::EnumValue::from(0); - self.note.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for SettlementIncident { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SETTLEMENT_INCIDENT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.usage.settlement.v1alpha1.SettlementIncident", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.mod.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.mod.rs deleted file mode 100644 index a4c7f9c5d..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.mod.rs +++ /dev/null @@ -1,80 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. - -include!("trogonai.usage.settlement.v1alpha1.ledger.rs"); -include!("trogonai.usage.settlement.v1alpha1.recovery.rs"); -#[allow( - non_camel_case_types, - dead_code, - unused_imports, - unused_qualifications, - clippy::derivable_impls, - clippy::match_single_binding, - clippy::uninlined_format_args, - clippy::doc_lazy_continuation, - clippy::module_inception -)] -pub mod __buffa { - #[allow(unused_imports)] - use super::*; - pub mod view { - #[allow(unused_imports)] - use super::*; - include!("trogonai.usage.settlement.v1alpha1.ledger.__view.rs"); - include!("trogonai.usage.settlement.v1alpha1.recovery.__view.rs"); - } - /// Register this package's `Any` type entries and extension entries. - pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) { - reg.register_json_any(super::__USAGE_REF_JSON_ANY); - reg.register_json_any(super::__SETTLEMENT_RECORD_JSON_ANY); - reg.register_json_any(super::__PROVIDER_RECEIPT_JSON_ANY); - reg.register_json_any(super::__SETTLEMENT_INCIDENT_JSON_ANY); - reg.register_json_any(super::__CONSUMER_CHECKPOINT_JSON_ANY); - reg.register_json_any(super::__SCAN_OPEN_SETTLEMENTS_REQUEST_JSON_ANY); - reg.register_json_any(super::__SCAN_OPEN_SETTLEMENTS_RESPONSE_JSON_ANY); - reg.register_json_any(super::__SCAN_COVERAGE_JSON_ANY); - reg.register_json_any(super::__RECONCILE_SETTLEMENT_REQUEST_JSON_ANY); - reg.register_json_any(super::__RECONCILE_SETTLEMENT_RESPONSE_JSON_ANY); - } -} -#[doc(inline)] -pub use self::__buffa::view::UsageRefView; -#[doc(inline)] -pub use self::__buffa::view::UsageRefOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SettlementRecordView; -#[doc(inline)] -pub use self::__buffa::view::SettlementRecordOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ProviderReceiptView; -#[doc(inline)] -pub use self::__buffa::view::ProviderReceiptOwnedView; -#[doc(inline)] -pub use self::__buffa::view::SettlementIncidentView; -#[doc(inline)] -pub use self::__buffa::view::SettlementIncidentOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ConsumerCheckpointView; -#[doc(inline)] -pub use self::__buffa::view::ConsumerCheckpointOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ScanOpenSettlementsRequestView; -#[doc(inline)] -pub use self::__buffa::view::ScanOpenSettlementsRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ScanOpenSettlementsResponseView; -#[doc(inline)] -pub use self::__buffa::view::ScanOpenSettlementsResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ScanCoverageView; -#[doc(inline)] -pub use self::__buffa::view::ScanCoverageOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReconcileSettlementRequestView; -#[doc(inline)] -pub use self::__buffa::view::ReconcileSettlementRequestOwnedView; -#[doc(inline)] -pub use self::__buffa::view::ReconcileSettlementResponseView; -#[doc(inline)] -pub use self::__buffa::view::ReconcileSettlementResponseOwnedView; -#[doc(inline)] -pub use self::__buffa::register_types; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.recovery.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.recovery.__view.rs deleted file mode 100644 index 1904c351b..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.recovery.__view.rs +++ /dev/null @@ -1,2553 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/usage/settlement/v1alpha1/recovery.proto - -/// Recovery for a billing consumer: where it got to, and what it left open. -/// -/// ConsumerCheckpoint is how far a billing consumer has read its source. -/// -/// Consumption position and settlement state are tracked separately, and that -/// separation is deliberate. If the watermark could not advance past an -/// unresolved settlement, one charge stuck behind a provider outage would stop -/// billing for everything after it, and the outage would turn into a backlog -/// measured in whatever the busiest tenant produced meanwhile. The watermark -/// says what has been turned into ledger records; the ledger says what those -/// records came to. -#[derive(Clone, Debug, Default)] -pub struct ConsumerCheckpointView<'a> { - /// Field 1: `consumer_id` - pub consumer_id: &'a str, - /// The source this consumer reads. Opaque here; a stream name, a subject, a - /// partition. - /// - /// Field 2: `source` - pub source: &'a str, - /// Position every usage fact below has a durable ledger record for. Advancing - /// this before writing those records would lose usage on a crash, which is the - /// one failure this ledger cannot detect afterwards: an unrecorded charge - /// leaves nothing behind to reconcile against. - /// - /// Field 3: `processed_watermark` - pub processed_watermark: u64, - /// Field 4: `processed_at` - pub processed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - /// Records not in a terminal state. - /// - /// Field 5: `open_settlement_count` - pub open_settlement_count: u32, - /// Records specifically in UNKNOWN. Broken out because it is the number that - /// means money may have moved without anyone knowing, and burying it inside a - /// general open count is how it stops being looked at. - /// - /// Field 6: `unknown_settlement_count` - pub unknown_settlement_count: u32, - /// Source position of the oldest open settlement. Unset when nothing is open. - /// - /// Reported to bound a recovery scan, not to hold the watermark back. It is - /// the floor a scan can start from instead of re-reading everything the - /// consumer has ever processed. - /// - /// Field 7: `oldest_open_watermark` - pub oldest_open_watermark: ::core::option::Option, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ConsumerCheckpointView<'a> { - /**Whether required field `consumer_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_consumer_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `source` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_source(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `processed_watermark` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_processed_watermark(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `processed_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_processed_at(&self) -> bool { - self.processed_at.is_set() - } - /**Whether required field `open_settlement_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_open_settlement_count(&self) -> bool { - self.__buffa_required_seen_0 & 8u64 != 0 - } - /**Whether required field `unknown_settlement_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_unknown_settlement_count(&self) -> bool { - self.__buffa_required_seen_0 & 16u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ConsumerCheckpointView<'a> { - type Owned = super::super::ConsumerCheckpoint; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.consumer_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.source = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.processed_watermark = ::buffa::types::decode_uint64(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.processed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.processed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.open_settlement_count = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 8u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.unknown_settlement_count = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.oldest_open_watermark = Some( - ::buffa::types::decode_uint64(&mut cur)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ConsumerCheckpoint { - consumer_id: self.consumer_id.to_string(), - source: self.source.to_string(), - processed_watermark: self.processed_watermark, - processed_at: match self.processed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - open_settlement_count: self.open_settlement_count, - unknown_settlement_count: self.unknown_settlement_count, - oldest_open_watermark: self.oldest_open_watermark, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ConsumerCheckpointView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.consumer_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.source) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.processed_watermark) as u64; - if self.processed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.processed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.open_settlement_count) as u64; - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.unknown_settlement_count) - as u64; - if let Some(v) = self.oldest_open_watermark { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.consumer_id, buf); - ::buffa::types::put_string_field(2u32, &self.source, buf); - ::buffa::types::put_uint64_field(3u32, self.processed_watermark, buf); - if self.processed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.processed_at.write_to(__cache, buf); - } - ::buffa::types::put_uint32_field(5u32, self.open_settlement_count, buf); - ::buffa::types::put_uint32_field(6u32, self.unknown_settlement_count, buf); - if let Some(v) = self.oldest_open_watermark { - ::buffa::types::put_uint64_field(7u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ConsumerCheckpointView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("consumerId", self.consumer_id)?; - } - { - __map.serialize_entry("source", self.source)?; - } - { - __map - .serialize_entry( - "processedWatermark", - &::buffa::json_helpers::ProtoJson(&self.processed_watermark), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.processed_at.as_option() { - __map.serialize_entry("processedAt", __v)?; - } - } - { - __map - .serialize_entry( - "openSettlementCount", - &::buffa::json_helpers::ProtoJson(&self.open_settlement_count), - )?; - } - { - __map - .serialize_entry( - "unknownSettlementCount", - &::buffa::json_helpers::ProtoJson(&self.unknown_settlement_count), - )?; - } - if let ::core::option::Option::Some(__v) = self.oldest_open_watermark { - __map - .serialize_entry( - "oldestOpenWatermark", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ConsumerCheckpointView<'a> { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ConsumerCheckpoint"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ConsumerCheckpoint"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ConsumerCheckpoint"; -} -::buffa::impl_default_view_instance!(ConsumerCheckpointView); -::buffa::impl_view_reborrow!(ConsumerCheckpointView); -/** Self-contained, `'static` owned view of a `ConsumerCheckpoint` message. - - Wraps [`::buffa::OwnedView`]`<`[`ConsumerCheckpointView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ConsumerCheckpointView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ConsumerCheckpointOwnedView( - ::buffa::OwnedView>, -); -impl ConsumerCheckpointOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ConsumerCheckpointOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ConsumerCheckpointOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ConsumerCheckpoint, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ConsumerCheckpointOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ConsumerCheckpointView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ConsumerCheckpointView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ConsumerCheckpoint { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `consumer_id` - #[must_use] - pub fn consumer_id(&self) -> &'_ str { - self.0.reborrow().consumer_id - } - /// The source this consumer reads. Opaque here; a stream name, a subject, a - /// partition. - /// - /// Field 2: `source` - #[must_use] - pub fn source(&self) -> &'_ str { - self.0.reborrow().source - } - /// Position every usage fact below has a durable ledger record for. Advancing - /// this before writing those records would lose usage on a crash, which is the - /// one failure this ledger cannot detect afterwards: an unrecorded charge - /// leaves nothing behind to reconcile against. - /// - /// Field 3: `processed_watermark` - #[must_use] - pub fn processed_watermark(&self) -> u64 { - self.0.reborrow().processed_watermark - } - /// Field 4: `processed_at` - #[must_use] - pub fn processed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().processed_at - } - /// Records not in a terminal state. - /// - /// Field 5: `open_settlement_count` - #[must_use] - pub fn open_settlement_count(&self) -> u32 { - self.0.reborrow().open_settlement_count - } - /// Records specifically in UNKNOWN. Broken out because it is the number that - /// means money may have moved without anyone knowing, and burying it inside a - /// general open count is how it stops being looked at. - /// - /// Field 6: `unknown_settlement_count` - #[must_use] - pub fn unknown_settlement_count(&self) -> u32 { - self.0.reborrow().unknown_settlement_count - } - /// Source position of the oldest open settlement. Unset when nothing is open. - /// - /// Reported to bound a recovery scan, not to hold the watermark back. It is - /// the floor a scan can start from instead of re-reading everything the - /// consumer has ever processed. - /// - /// Field 7: `oldest_open_watermark` - #[must_use] - pub fn oldest_open_watermark(&self) -> ::core::option::Option { - self.0.reborrow().oldest_open_watermark - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ConsumerCheckpointOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ConsumerCheckpointOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ConsumerCheckpointOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ConsumerCheckpointOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ConsumerCheckpoint { - type View<'a> = ConsumerCheckpointView<'a>; - type ViewHandle = ConsumerCheckpointOwnedView; -} -impl ::serde::Serialize for ConsumerCheckpointOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ScanOpenSettlementsRequest enumerates settlements that still need attention. -/// -/// Bounded on purpose. A recovery pass that scans the whole ledger gets slower -/// exactly as the system gets busier, so the pass meant to run during an -/// incident is the one that stops finishing during an incident. -#[derive(Clone, Debug, Default)] -pub struct ScanOpenSettlementsRequestView<'a> { - /// Field 1: `consumer_id` - pub consumer_id: &'a str, - /// Which states to return. Empty means every non-terminal state, which is the - /// ordinary recovery sweep. - /// - /// Field 2: `states` - pub states: ::buffa::RepeatedView< - 'a, - ::buffa::EnumValue, - >, - /// Only records untouched for at least this long. - /// - /// A settlement published a second ago and not yet acknowledged is not stuck, - /// it is in flight, and a recovery pass that republishes it is competing with - /// the attempt already running. Unset means no age filter, which is correct - /// for a report and wrong for an automated retry loop. - /// - /// Field 3: `idle_for` - pub idle_for: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'a>, - >, - /// Only records at or above this source position. Set from - /// `ConsumerCheckpoint.oldest_open_watermark` to make a sweep proportional to - /// what is actually open rather than to the ledger's size. - /// - /// Field 4: `from_watermark` - pub from_watermark: ::core::option::Option, - /// Field 5: `page_size` - pub page_size: u32, - /// Opaque continuation. Unset starts a new scan. - /// - /// Field 6: `page_token` - pub page_token: ::core::option::Option<&'a [u8]>, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ScanOpenSettlementsRequestView<'a> { - /**Whether required field `consumer_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_consumer_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `page_size` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_page_size(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ScanOpenSettlementsRequestView<'a> { - type Owned = super::super::ScanOpenSettlementsRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.consumer_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.idle_for.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.idle_for = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::DurationView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.from_watermark = Some(::buffa::types::decode_uint64(&mut cur)?); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.page_size = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.page_token = Some(::buffa::types::borrow_bytes(&mut cur)?); - } - 2u32 => { - if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { - let payload = ::buffa::types::borrow_bytes(&mut cur)?; - view.states.reserve(::buffa::encoding::count_varints(payload)); - let mut pcur: &[u8] = payload; - while !pcur.is_empty() { - view.states - .push( - ::buffa::EnumValue::from( - ::buffa::types::decode_int32_packed(&mut pcur)?, - ), - ); - } - } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { - view.states - .push( - ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ), - ); - } else { - return Err( - ::buffa::encoding::wire_type_mismatch( - tag, - ::buffa::encoding::WireType::LengthDelimited, - ), - ); - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ScanOpenSettlementsRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ScanOpenSettlementsRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ScanOpenSettlementsRequest { - consumer_id: self.consumer_id.to_string(), - states: self.states.to_vec(), - idle_for: match self.idle_for.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - from_watermark: self.from_watermark, - page_size: self.page_size, - page_token: self.page_token.map(|b| (b).to_vec()), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ScanOpenSettlementsRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.consumer_id) as u64; - if !self.states.is_empty() { - let payload: u64 = self - .states - .iter() - .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u64) - .sum::(); - size += 1u64 + ::buffa::encoding::varint_len(payload) as u64 + payload; - } - if self.idle_for.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.idle_for.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(v) = self.from_watermark { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.page_size) as u64; - if let Some(ref v) = self.page_token { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.consumer_id, buf); - if !self.states.is_empty() { - let payload: u64 = self - .states - .iter() - .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u64) - .sum::(); - ::buffa::types::put_len_delimited_header(2u32, payload, buf); - for v in &self.states { - ::buffa::types::encode_int32(v.to_i32(), buf); - } - } - if self.idle_for.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.idle_for.write_to(__cache, buf); - } - if let Some(v) = self.from_watermark { - ::buffa::types::put_uint64_field(4u32, v, buf); - } - ::buffa::types::put_uint32_field(5u32, self.page_size, buf); - if let Some(ref v) = self.page_token { - ::buffa::types::put_shared_bytes_field(6u32, v, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ScanOpenSettlementsRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("consumerId", self.consumer_id)?; - } - if !self.states.is_empty() { - __map - .serialize_entry( - "states", - &::buffa::json_helpers::EnumSeqJson(&self.states), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.idle_for.as_option() { - __map.serialize_entry("idleFor", __v)?; - } - } - if let ::core::option::Option::Some(__v) = self.from_watermark { - __map - .serialize_entry( - "fromWatermark", - &::buffa::json_helpers::ProtoJson(&__v), - )?; - } - { - __map - .serialize_entry( - "pageSize", - &::buffa::json_helpers::ProtoJson(&self.page_size), - )?; - } - if let ::core::option::Option::Some(__v) = self.page_token { - __map.serialize_entry("pageToken", &::buffa::json_helpers::BytesJson(__v))?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ScanOpenSettlementsRequestView<'a> { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ScanOpenSettlementsRequest"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ScanOpenSettlementsRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ScanOpenSettlementsRequest"; -} -::buffa::impl_default_view_instance!(ScanOpenSettlementsRequestView); -::buffa::impl_view_reborrow!(ScanOpenSettlementsRequestView); -/** Self-contained, `'static` owned view of a `ScanOpenSettlementsRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`ScanOpenSettlementsRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ScanOpenSettlementsRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ScanOpenSettlementsRequestOwnedView( - ::buffa::OwnedView>, -); -impl ScanOpenSettlementsRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ScanOpenSettlementsRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ScanOpenSettlementsRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ScanOpenSettlementsRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ScanOpenSettlementsRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ScanOpenSettlementsRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ScanOpenSettlementsRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ScanOpenSettlementsRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `consumer_id` - #[must_use] - pub fn consumer_id(&self) -> &'_ str { - self.0.reborrow().consumer_id - } - /// Which states to return. Empty means every non-terminal state, which is the - /// ordinary recovery sweep. - /// - /// Field 2: `states` - #[must_use] - pub fn states( - &self, - ) -> &::buffa::RepeatedView<'_, ::buffa::EnumValue> { - &self.0.reborrow().states - } - /// Only records untouched for at least this long. - /// - /// A settlement published a second ago and not yet acknowledged is not stuck, - /// it is in flight, and a recovery pass that republishes it is competing with - /// the attempt already running. Unset means no age filter, which is correct - /// for a report and wrong for an automated retry loop. - /// - /// Field 3: `idle_for` - #[must_use] - pub fn idle_for( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::DurationView<'_>, - > { - &self.0.reborrow().idle_for - } - /// Only records at or above this source position. Set from - /// `ConsumerCheckpoint.oldest_open_watermark` to make a sweep proportional to - /// what is actually open rather than to the ledger's size. - /// - /// Field 4: `from_watermark` - #[must_use] - pub fn from_watermark(&self) -> ::core::option::Option { - self.0.reborrow().from_watermark - } - /// Field 5: `page_size` - #[must_use] - pub fn page_size(&self) -> u32 { - self.0.reborrow().page_size - } - /// Opaque continuation. Unset starts a new scan. - /// - /// Field 6: `page_token` - #[must_use] - pub fn page_token(&self) -> ::core::option::Option<&'_ [u8]> { - self.0.reborrow().page_token - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ScanOpenSettlementsRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ScanOpenSettlementsRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ScanOpenSettlementsRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ScanOpenSettlementsRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ScanOpenSettlementsRequest { - type View<'a> = ScanOpenSettlementsRequestView<'a>; - type ViewHandle = ScanOpenSettlementsRequestOwnedView; -} -impl ::serde::Serialize for ScanOpenSettlementsRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ScanOpenSettlementsResponse is one page of unresolved settlements. -#[derive(Clone, Debug, Default)] -pub struct ScanOpenSettlementsResponseView<'a> { - /// Field 1: `records` - pub records: ::buffa::RepeatedView< - 'a, - super::super::__buffa::view::SettlementRecordView<'a>, - >, - /// Unset when this is the last page. Presence, and not an empty `records` - /// list, is the end signal. - /// - /// Field 2: `next_page_token` - pub next_page_token: ::core::option::Option<&'a [u8]>, - /// Field 3: `coverage` - pub coverage: ::buffa::MessageFieldView< - super::super::__buffa::view::ScanCoverageView<'a>, - >, -} -impl<'a> ScanOpenSettlementsResponseView<'a> { - /**Whether required field `coverage` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_coverage(&self) -> bool { - self.coverage.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ScanOpenSettlementsResponseView<'a> { - type Owned = super::super::ScanOpenSettlementsResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.next_page_token = Some(::buffa::types::borrow_bytes(&mut cur)?); - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.coverage.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.coverage = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - ctx.register_element_memory( - ::core::mem::size_of::< - super::super::__buffa::view::SettlementRecordView, - >(), - )?; - view.records - .push( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ScanOpenSettlementsResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ScanOpenSettlementsResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ScanOpenSettlementsResponse { - records: self - .records - .iter() - .map(|v| v.to_owned_from_source(__buffa_src)) - .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?, - next_page_token: self.next_page_token.map(|b| (b).to_vec()), - coverage: match self.coverage.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::ScanCoverage, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ScanOpenSettlementsResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - for v in &self.records { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.next_page_token { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - if self.coverage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.coverage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - for v in &self.records { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if let Some(ref v) = self.next_page_token { - ::buffa::types::put_shared_bytes_field(2u32, v, buf); - } - if self.coverage.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.coverage.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ScanOpenSettlementsResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - if !self.records.is_empty() { - __map.serialize_entry("records", &*self.records)?; - } - if let ::core::option::Option::Some(__v) = self.next_page_token { - __map - .serialize_entry( - "nextPageToken", - &::buffa::json_helpers::BytesJson(__v), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.coverage.as_option() { - __map.serialize_entry("coverage", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ScanOpenSettlementsResponseView<'a> { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ScanOpenSettlementsResponse"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ScanOpenSettlementsResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ScanOpenSettlementsResponse"; -} -::buffa::impl_default_view_instance!(ScanOpenSettlementsResponseView); -::buffa::impl_view_reborrow!(ScanOpenSettlementsResponseView); -/** Self-contained, `'static` owned view of a `ScanOpenSettlementsResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`ScanOpenSettlementsResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ScanOpenSettlementsResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ScanOpenSettlementsResponseOwnedView( - ::buffa::OwnedView>, -); -impl ScanOpenSettlementsResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ScanOpenSettlementsResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ScanOpenSettlementsResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ScanOpenSettlementsResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ScanOpenSettlementsResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ScanOpenSettlementsResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ScanOpenSettlementsResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ScanOpenSettlementsResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `records` - #[must_use] - pub fn records( - &self, - ) -> &::buffa::RepeatedView< - '_, - super::super::__buffa::view::SettlementRecordView<'_>, - > { - &self.0.reborrow().records - } - /// Unset when this is the last page. Presence, and not an empty `records` - /// list, is the end signal. - /// - /// Field 2: `next_page_token` - #[must_use] - pub fn next_page_token(&self) -> ::core::option::Option<&'_ [u8]> { - self.0.reborrow().next_page_token - } - /// Field 3: `coverage` - #[must_use] - pub fn coverage( - &self, - ) -> &::buffa::MessageFieldView> { - &self.0.reborrow().coverage - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ScanOpenSettlementsResponseOwnedView { - fn from( - inner: ::buffa::OwnedView>, - ) -> Self { - ScanOpenSettlementsResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ScanOpenSettlementsResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ScanOpenSettlementsResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ScanOpenSettlementsResponse { - type View<'a> = ScanOpenSettlementsResponseView<'a>; - type ViewHandle = ScanOpenSettlementsResponseOwnedView; -} -impl ::serde::Serialize for ScanOpenSettlementsResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ScanCoverage is what the scan did not look at. -/// -/// Always present, including on a scan that covered everything. An operator -/// reading an empty page needs to know whether that means nothing is open or -/// the scan ran out of budget, and those two look identical without this. -#[derive(Clone, Debug, Default)] -pub struct ScanCoverageView<'a> { - /// Field 1: `exhaustive` - pub exhaustive: bool, - /// Source position the scan covered through. - /// - /// Field 2: `scanned_through_watermark` - pub scanned_through_watermark: u64, - /// Records matching the filter that a fault made unreadable. Non-zero means - /// unresolved settlements exist that this scan cannot name, so the sweep must - /// not be treated as having cleared anything. - /// - /// Field 3: `unreadable_count` - pub unreadable_count: u32, - /// Field 4: `observed_at` - pub observed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ScanCoverageView<'a> { - /**Whether required field `exhaustive` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_exhaustive(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `scanned_through_watermark` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_scanned_through_watermark(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } - /**Whether required field `unreadable_count` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_unreadable_count(&self) -> bool { - self.__buffa_required_seen_0 & 4u64 != 0 - } - /**Whether required field `observed_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_observed_at(&self) -> bool { - self.observed_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ScanCoverageView<'a> { - type Owned = super::super::ScanCoverage; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.exhaustive = ::buffa::types::decode_bool(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.scanned_through_watermark = ::buffa::types::decode_uint64( - &mut cur, - )?; - view.__buffa_required_seen_0 |= 2u64; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.unreadable_count = ::buffa::types::decode_uint32(&mut cur)?; - view.__buffa_required_seen_0 |= 4u64; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ScanCoverage { - exhaustive: self.exhaustive, - scanned_through_watermark: self.scanned_through_watermark, - unreadable_count: self.unreadable_count, - observed_at: match self.observed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ScanCoverageView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.scanned_through_watermark) - as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.unreadable_count) as u64; - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_bool_field(1u32, self.exhaustive, buf); - ::buffa::types::put_uint64_field(2u32, self.scanned_through_watermark, buf); - ::buffa::types::put_uint32_field(3u32, self.unreadable_count, buf); - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ScanCoverageView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("exhaustive", &self.exhaustive)?; - } - { - __map - .serialize_entry( - "scannedThroughWatermark", - &::buffa::json_helpers::ProtoJson(&self.scanned_through_watermark), - )?; - } - { - __map - .serialize_entry( - "unreadableCount", - &::buffa::json_helpers::ProtoJson(&self.unreadable_count), - )?; - } - { - if let ::core::option::Option::Some(__v) = self.observed_at.as_option() { - __map.serialize_entry("observedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ScanCoverageView<'a> { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ScanCoverage"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ScanCoverage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ScanCoverage"; -} -::buffa::impl_default_view_instance!(ScanCoverageView); -::buffa::impl_view_reborrow!(ScanCoverageView); -/** Self-contained, `'static` owned view of a `ScanCoverage` message. - - Wraps [`::buffa::OwnedView`]`<`[`ScanCoverageView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ScanCoverageView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ScanCoverageOwnedView(::buffa::OwnedView>); -impl ScanCoverageOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ScanCoverageOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ScanCoverageOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ScanCoverage, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ScanCoverageOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ScanCoverageView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ScanCoverageView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ScanCoverage { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `exhaustive` - #[must_use] - pub fn exhaustive(&self) -> bool { - self.0.reborrow().exhaustive - } - /// Source position the scan covered through. - /// - /// Field 2: `scanned_through_watermark` - #[must_use] - pub fn scanned_through_watermark(&self) -> u64 { - self.0.reborrow().scanned_through_watermark - } - /// Records matching the filter that a fault made unreadable. Non-zero means - /// unresolved settlements exist that this scan cannot name, so the sweep must - /// not be treated as having cleared anything. - /// - /// Field 3: `unreadable_count` - #[must_use] - pub fn unreadable_count(&self) -> u32 { - self.0.reborrow().unreadable_count - } - /// Field 4: `observed_at` - #[must_use] - pub fn observed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().observed_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ScanCoverageOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ScanCoverageOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ScanCoverageOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ScanCoverageOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ScanCoverage { - type View<'a> = ScanCoverageView<'a>; - type ViewHandle = ScanCoverageOwnedView; -} -impl ::serde::Serialize for ScanCoverageOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ReconcileSettlementRequest asks the provider what actually happened to a -/// settlement whose outcome was never observed. -/// -/// A query, not a retry. It exists so a consumer facing UNKNOWN has a move other -/// than publishing again and hoping the idempotency key holds, and there is no -/// field on it that could cause a charge. -#[derive(Clone, Debug, Default)] -pub struct ReconcileSettlementRequestView<'a> { - /// Field 1: `consumer_id` - pub consumer_id: &'a str, - /// Field 2: `settlement_id` - pub settlement_id: &'a str, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReconcileSettlementRequestView<'a> { - /**Whether required field `consumer_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_consumer_id(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `settlement_id` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_settlement_id(&self) -> bool { - self.__buffa_required_seen_0 & 2u64 != 0 - } -} -impl<'a> ::buffa::MessageView<'a> for ReconcileSettlementRequestView<'a> { - type Owned = super::super::ReconcileSettlementRequest; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.consumer_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - view.settlement_id = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 2u64; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ReconcileSettlementRequest, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ReconcileSettlementRequest, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReconcileSettlementRequest { - consumer_id: self.consumer_id.to_string(), - settlement_id: self.settlement_id.to_string(), - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReconcileSettlementRequestView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.consumer_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.settlement_id) as u64; - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.consumer_id, buf); - ::buffa::types::put_string_field(2u32, &self.settlement_id, buf); - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReconcileSettlementRequestView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("consumerId", self.consumer_id)?; - } - { - __map.serialize_entry("settlementId", self.settlement_id)?; - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReconcileSettlementRequestView<'a> { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ReconcileSettlementRequest"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ReconcileSettlementRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ReconcileSettlementRequest"; -} -::buffa::impl_default_view_instance!(ReconcileSettlementRequestView); -::buffa::impl_view_reborrow!(ReconcileSettlementRequestView); -/** Self-contained, `'static` owned view of a `ReconcileSettlementRequest` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReconcileSettlementRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReconcileSettlementRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReconcileSettlementRequestOwnedView( - ::buffa::OwnedView>, -); -impl ReconcileSettlementRequestOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileSettlementRequestOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileSettlementRequestOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReconcileSettlementRequest, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileSettlementRequestOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReconcileSettlementRequestView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReconcileSettlementRequestView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReconcileSettlementRequest { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `consumer_id` - #[must_use] - pub fn consumer_id(&self) -> &'_ str { - self.0.reborrow().consumer_id - } - /// Field 2: `settlement_id` - #[must_use] - pub fn settlement_id(&self) -> &'_ str { - self.0.reborrow().settlement_id - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReconcileSettlementRequestOwnedView { - fn from(inner: ::buffa::OwnedView>) -> Self { - ReconcileSettlementRequestOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReconcileSettlementRequestOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReconcileSettlementRequestOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReconcileSettlementRequest { - type View<'a> = ReconcileSettlementRequestView<'a>; - type ViewHandle = ReconcileSettlementRequestOwnedView; -} -impl ::serde::Serialize for ReconcileSettlementRequestOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} -/// ReconcileSettlementResponse is what the provider says it knows. -#[derive(Clone, Debug, Default)] -pub struct ReconcileSettlementResponseView<'a> { - /// Field 1: `outcome` - pub outcome: ::buffa::EnumValue, - /// The updated ledger record, so a caller never has to reconstruct the new - /// state from the outcome and hope its transition table matches the server's. - /// - /// Field 2: `record` - pub record: ::buffa::MessageFieldView< - super::super::__buffa::view::SettlementRecordView<'a>, - >, - /// Field 3: `observed_at` - pub observed_at: ::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>, - >, - #[doc(hidden)] - pub __buffa_required_seen_0: u64, -} -impl<'a> ReconcileSettlementResponseView<'a> { - /**Whether required field `outcome` was present on the wire. - -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_outcome(&self) -> bool { - self.__buffa_required_seen_0 & 1u64 != 0 - } - /**Whether required field `record` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_record(&self) -> bool { - self.record.is_set() - } - /**Whether required field `observed_at` is set. - -Mirrors `is_set()` on the field: `true` after decoding a message where the field was present on the wire, and `true` on a hand-built view whose field is populated. Encoding is unaffected — required fields are always written.*/ - #[must_use] - #[inline] - pub const fn has_observed_at(&self) -> bool { - self.observed_at.is_set() - } -} -impl<'a> ::buffa::MessageView<'a> for ReconcileSettlementResponseView<'a> { - type Owned = super::super::ReconcileSettlementResponse; - fn decode_view(buf: &'a [u8]) -> ::core::result::Result { - let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT); - ::decode_view_ctx( - buf, - ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit), - ) - } - fn decode_view_with_ctx( - buf: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result { - ::decode_view_ctx(buf, ctx) - } - #[inline] - fn merge_view_field( - &mut self, - tag: ::buffa::encoding::Tag, - cur: &'a [u8], - _before_tag: &'a [u8], - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> { - let _ = ctx; - #[allow(unused_variables)] - let view = self; - let mut cur = cur; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - view.outcome = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(&mut cur)?, - ); - view.__buffa_required_seen_0 |= 1u64; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.record.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.record = ::buffa::MessageFieldView::set( - ::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let __sub_ctx = ctx.descend()?; - let sub = ::buffa::types::borrow_bytes(&mut cur)?; - match view.observed_at.as_mut() { - Some(existing) => { - ::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)? - } - None => { - view.observed_at = ::buffa::MessageFieldView::set( - <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx( - sub, - __sub_ctx, - )?, - ); - } - } - } - _ => { - ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?; - } - } - ::core::result::Result::Ok(cur) - } - fn to_owned_message( - &self, - ) -> ::core::result::Result< - super::super::ReconcileSettlementResponse, - ::buffa::DecodeError, - > { - self.to_owned_from_source(None) - } - #[allow(clippy::useless_conversion, clippy::needless_update)] - fn to_owned_from_source( - &self, - __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>, - ) -> ::core::result::Result< - super::super::ReconcileSettlementResponse, - ::buffa::DecodeError, - > { - #[allow(unused_imports)] - use ::buffa::alloc::string::ToString as _; - let _ = __buffa_src; - ::core::result::Result::Ok(super::super::ReconcileSettlementResponse { - outcome: self.outcome, - record: match self.record.as_option() { - Some(v) => { - ::buffa::MessageField::< - super::super::SettlementRecord, - ::buffa::Inline, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - observed_at: match self.observed_at.as_option() { - Some(v) => { - ::buffa::MessageField::< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >::some(v.to_owned_from_source(__buffa_src)?) - } - None => ::buffa::MessageField::none(), - }, - ..::core::default::Default::default() - }) - } -} -impl<'a> ::buffa::ViewEncode<'a> for ReconcileSettlementResponseView<'a> { - #[allow(clippy::needless_borrow, clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.outcome.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.record.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.record.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - #[allow(clippy::needless_borrow)] - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.outcome.to_i32(), buf); - if self.record.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.record.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } -} -/// Serializes this view as protobuf JSON. -/// -/// Implicit-presence fields with default values are omitted, `required` -/// fields are always emitted, explicit-presence (`optional`) fields are -/// emitted only when set, bytes fields are base64-encoded, and enum -/// values are their proto name strings. -/// -/// This impl uses `serialize_map(None)` because the number of emitted -/// fields depends on default-omission rules; serializers that require -/// known map lengths (e.g. `bincode`) will return a runtime error. -/// Use the owned message type for those formats. -impl<'__a> ::serde::Serialize for ReconcileSettlementResponseView<'__a> { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - use ::serde::ser::SerializeMap as _; - let mut __map = __s.serialize_map(::core::option::Option::None)?; - { - __map.serialize_entry("outcome", &self.outcome)?; - } - { - if let ::core::option::Option::Some(__v) = self.record.as_option() { - __map.serialize_entry("record", __v)?; - } - } - { - if let ::core::option::Option::Some(__v) = self.observed_at.as_option() { - __map.serialize_entry("observedAt", __v)?; - } - } - __map.end() - } -} -impl<'a> ::buffa::MessageName for ReconcileSettlementResponseView<'a> { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ReconcileSettlementResponse"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ReconcileSettlementResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ReconcileSettlementResponse"; -} -::buffa::impl_default_view_instance!(ReconcileSettlementResponseView); -::buffa::impl_view_reborrow!(ReconcileSettlementResponseView); -/** Self-contained, `'static` owned view of a `ReconcileSettlementResponse` message. - - Wraps [`::buffa::OwnedView`]`<`[`ReconcileSettlementResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required. - - Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ReconcileSettlementResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/ -#[derive(Clone, Debug)] -pub struct ReconcileSettlementResponseOwnedView( - ::buffa::OwnedView>, -); -impl ReconcileSettlementResponseOwnedView { - /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer. - /// - /// The view borrows directly from the buffer's data; the buffer is - /// retained inside the returned handle. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer contains invalid - /// protobuf data. - pub fn decode( - bytes: ::buffa::bytes::Bytes, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileSettlementResponseOwnedView(::buffa::OwnedView::decode(bytes)?), - ) - } - /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit, - /// max message size). - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError`] if the buffer is invalid or - /// exceeds the configured limits. - pub fn decode_with_options( - bytes: ::buffa::bytes::Bytes, - opts: &::buffa::DecodeOptions, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileSettlementResponseOwnedView( - ::buffa::OwnedView::decode_with_options(bytes, opts)?, - ), - ) - } - /// Build from an owned message via an encode → decode round-trip. - /// - /// # Errors - /// - /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the - /// message's encoded size exceeds the 2 GiB protobuf limit, or - /// another [`::buffa::DecodeError`] if the re-encoded bytes are - /// somehow invalid (should not happen for well-formed messages). - pub fn from_owned( - msg: &super::super::ReconcileSettlementResponse, - ) -> ::core::result::Result { - ::core::result::Result::Ok( - ReconcileSettlementResponseOwnedView(::buffa::OwnedView::from_owned(msg)?), - ) - } - /// Borrow the full [`ReconcileSettlementResponseView`] with its lifetime tied to `&self`. - #[must_use] - pub fn view(&self) -> &ReconcileSettlementResponseView<'_> { - self.0.reborrow() - } - /// Convert to the owned message type. - /// - /// Infallible: this type's constructors wire-decode their - /// buffer, and a view produced by wire decoding always - /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`], - /// whose contract also governs handles converted from a raw - /// [`::buffa::OwnedView`]. - #[must_use] - pub fn to_owned_message(&self) -> super::super::ReconcileSettlementResponse { - self.0.to_owned_message() - } - /// The underlying bytes buffer. - #[must_use] - pub fn bytes(&self) -> &::buffa::bytes::Bytes { - self.0.bytes() - } - /// Consume the handle, returning the underlying bytes buffer. - #[must_use] - pub fn into_bytes(self) -> ::buffa::bytes::Bytes { - self.0.into_bytes() - } - /// Field 1: `outcome` - #[must_use] - pub fn outcome(&self) -> ::buffa::EnumValue { - self.0.reborrow().outcome - } - /// The updated ledger record, so a caller never has to reconstruct the new - /// state from the outcome and hope its transition table matches the server's. - /// - /// Field 2: `record` - #[must_use] - pub fn record( - &self, - ) -> &::buffa::MessageFieldView< - super::super::__buffa::view::SettlementRecordView<'_>, - > { - &self.0.reborrow().record - } - /// Field 3: `observed_at` - #[must_use] - pub fn observed_at( - &self, - ) -> &::buffa::MessageFieldView< - ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>, - > { - &self.0.reborrow().observed_at - } -} -impl ::core::convert::From<::buffa::OwnedView>> -for ReconcileSettlementResponseOwnedView { - fn from( - inner: ::buffa::OwnedView>, - ) -> Self { - ReconcileSettlementResponseOwnedView(inner) - } -} -impl ::core::convert::From -for ::buffa::OwnedView> { - fn from(wrapper: ReconcileSettlementResponseOwnedView) -> Self { - wrapper.0 - } -} -impl ::core::convert::AsRef<::buffa::OwnedView>> -for ReconcileSettlementResponseOwnedView { - fn as_ref(&self) -> &::buffa::OwnedView> { - &self.0 - } -} -impl ::buffa::HasMessageView for super::super::ReconcileSettlementResponse { - type View<'a> = ReconcileSettlementResponseView<'a>; - type ViewHandle = ReconcileSettlementResponseOwnedView; -} -impl ::serde::Serialize for ReconcileSettlementResponseOwnedView { - fn serialize<__S: ::serde::Serializer>( - &self, - __s: __S, - ) -> ::core::result::Result<__S::Ok, __S::Error> { - ::serde::Serialize::serialize(&self.0, __s) - } -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.recovery.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.recovery.rs deleted file mode 100644 index aed7ec263..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.usage.settlement.v1alpha1.recovery.rs +++ /dev/null @@ -1,1537 +0,0 @@ -// @generated by buffa-codegen. DO NOT EDIT. -// source: trogonai/usage/settlement/v1alpha1/recovery.proto - -/// ReconciliationOutcome is what asking the provider established. -/// -/// The zero value keeps the settlement unresolved, so a reconciliation that -/// returns a variant the caller does not understand leaves the record needing -/// attention instead of closing it. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -#[repr(i32)] -pub enum ReconciliationOutcome { - /// Unknown result. Nothing changes; the record stays unresolved. - RECONCILIATION_OUTCOME_UNSPECIFIED = 0i32, - /// The provider has the charge. The record becomes SETTLED. - RECONCILIATION_OUTCOME_CHARGE_FOUND = 1i32, - /// The provider has no charge under this idempotency key and confirms it - /// never processed one. The record becomes INTENDED and may be published. - RECONCILIATION_OUTCOME_CHARGE_ABSENT = 2i32, - /// The provider refused, and says so now. The record becomes REJECTED. - RECONCILIATION_OUTCOME_CHARGE_REFUSED = 3i32, - /// The provider cannot say, usually because the key is older than its - /// retention for idempotency records. - /// - /// Reported rather than folded into ABSENT, because they differ on the only - /// question that matters: absent means republishing is safe, and this means - /// the provider has forgotten the key that was making it safe. This is what - /// opens INCIDENT_KIND_UNKNOWN_OUTCOME_EXPIRED. - RECONCILIATION_OUTCOME_PROVIDER_CANNOT_SAY = 4i32, - /// The provider could not be reached. Says nothing about the charge; the - /// record stays UNKNOWN and the reconciliation can be tried again. - RECONCILIATION_OUTCOME_PROVIDER_UNREACHABLE = 5i32, -} -impl ReconciliationOutcome { - ///Idiomatic alias for [`Self::RECONCILIATION_OUTCOME_UNSPECIFIED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const Unspecified: Self = Self::RECONCILIATION_OUTCOME_UNSPECIFIED; - ///Idiomatic alias for [`Self::RECONCILIATION_OUTCOME_CHARGE_FOUND`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ChargeFound: Self = Self::RECONCILIATION_OUTCOME_CHARGE_FOUND; - ///Idiomatic alias for [`Self::RECONCILIATION_OUTCOME_CHARGE_ABSENT`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ChargeAbsent: Self = Self::RECONCILIATION_OUTCOME_CHARGE_ABSENT; - ///Idiomatic alias for [`Self::RECONCILIATION_OUTCOME_CHARGE_REFUSED`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ChargeRefused: Self = Self::RECONCILIATION_OUTCOME_CHARGE_REFUSED; - ///Idiomatic alias for [`Self::RECONCILIATION_OUTCOME_PROVIDER_CANNOT_SAY`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ProviderCannotSay: Self = Self::RECONCILIATION_OUTCOME_PROVIDER_CANNOT_SAY; - ///Idiomatic alias for [`Self::RECONCILIATION_OUTCOME_PROVIDER_UNREACHABLE`]; `Debug` prints the variant name. - #[allow(non_upper_case_globals)] - pub const ProviderUnreachable: Self = Self::RECONCILIATION_OUTCOME_PROVIDER_UNREACHABLE; -} -impl ::core::default::Default for ReconciliationOutcome { - fn default() -> Self { - Self::RECONCILIATION_OUTCOME_UNSPECIFIED - } -} -impl ::serde::Serialize for ReconciliationOutcome { - fn serialize( - &self, - s: S, - ) -> ::core::result::Result { - s.serialize_str(::buffa::Enumeration::proto_name(self)) - } -} -impl<'de> ::serde::Deserialize<'de> for ReconciliationOutcome { - fn deserialize>( - d: D, - ) -> ::core::result::Result { - struct _V; - impl ::serde::de::Visitor<'_> for _V { - type Value = ReconciliationOutcome; - fn expecting( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.write_str( - concat!( - "a string, integer, or null for ", - stringify!(ReconciliationOutcome) - ), - ) - } - fn visit_str( - self, - v: &str, - ) -> ::core::result::Result { - ::from_proto_name(v) - .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) }) - } - fn visit_i64( - self, - v: i64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_u64( - self, - v: u64, - ) -> ::core::result::Result { - let v32 = i32::try_from(v) - .map_err(|_| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("enum value {v} out of i32 range"), - ) - })?; - ::from_i32(v32) - .ok_or_else(|| { - ::serde::de::Error::custom( - ::buffa::alloc::format!("unknown enum value {v32}"), - ) - }) - } - fn visit_unit( - self, - ) -> ::core::result::Result { - ::core::result::Result::Ok(::core::default::Default::default()) - } - } - d.deserialize_any(_V) - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReconciliationOutcome { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -impl ::buffa::Enumeration for ReconciliationOutcome { - fn from_i32(value: i32) -> ::core::option::Option { - match value { - 0i32 => { - ::core::option::Option::Some(Self::RECONCILIATION_OUTCOME_UNSPECIFIED) - } - 1i32 => { - ::core::option::Option::Some(Self::RECONCILIATION_OUTCOME_CHARGE_FOUND) - } - 2i32 => { - ::core::option::Option::Some(Self::RECONCILIATION_OUTCOME_CHARGE_ABSENT) - } - 3i32 => { - ::core::option::Option::Some(Self::RECONCILIATION_OUTCOME_CHARGE_REFUSED) - } - 4i32 => { - ::core::option::Option::Some( - Self::RECONCILIATION_OUTCOME_PROVIDER_CANNOT_SAY, - ) - } - 5i32 => { - ::core::option::Option::Some( - Self::RECONCILIATION_OUTCOME_PROVIDER_UNREACHABLE, - ) - } - _ => ::core::option::Option::None, - } - } - fn to_i32(&self) -> i32 { - *self as i32 - } - fn proto_name(&self) -> &'static str { - match self { - Self::RECONCILIATION_OUTCOME_UNSPECIFIED => { - "RECONCILIATION_OUTCOME_UNSPECIFIED" - } - Self::RECONCILIATION_OUTCOME_CHARGE_FOUND => { - "RECONCILIATION_OUTCOME_CHARGE_FOUND" - } - Self::RECONCILIATION_OUTCOME_CHARGE_ABSENT => { - "RECONCILIATION_OUTCOME_CHARGE_ABSENT" - } - Self::RECONCILIATION_OUTCOME_CHARGE_REFUSED => { - "RECONCILIATION_OUTCOME_CHARGE_REFUSED" - } - Self::RECONCILIATION_OUTCOME_PROVIDER_CANNOT_SAY => { - "RECONCILIATION_OUTCOME_PROVIDER_CANNOT_SAY" - } - Self::RECONCILIATION_OUTCOME_PROVIDER_UNREACHABLE => { - "RECONCILIATION_OUTCOME_PROVIDER_UNREACHABLE" - } - } - } - fn from_proto_name(name: &str) -> ::core::option::Option { - match name { - "RECONCILIATION_OUTCOME_UNSPECIFIED" => { - ::core::option::Option::Some(Self::RECONCILIATION_OUTCOME_UNSPECIFIED) - } - "RECONCILIATION_OUTCOME_CHARGE_FOUND" => { - ::core::option::Option::Some(Self::RECONCILIATION_OUTCOME_CHARGE_FOUND) - } - "RECONCILIATION_OUTCOME_CHARGE_ABSENT" => { - ::core::option::Option::Some(Self::RECONCILIATION_OUTCOME_CHARGE_ABSENT) - } - "RECONCILIATION_OUTCOME_CHARGE_REFUSED" => { - ::core::option::Option::Some(Self::RECONCILIATION_OUTCOME_CHARGE_REFUSED) - } - "RECONCILIATION_OUTCOME_PROVIDER_CANNOT_SAY" => { - ::core::option::Option::Some( - Self::RECONCILIATION_OUTCOME_PROVIDER_CANNOT_SAY, - ) - } - "RECONCILIATION_OUTCOME_PROVIDER_UNREACHABLE" => { - ::core::option::Option::Some( - Self::RECONCILIATION_OUTCOME_PROVIDER_UNREACHABLE, - ) - } - _ => ::core::option::Option::None, - } - } - fn values() -> &'static [Self] { - &[ - Self::RECONCILIATION_OUTCOME_UNSPECIFIED, - Self::RECONCILIATION_OUTCOME_CHARGE_FOUND, - Self::RECONCILIATION_OUTCOME_CHARGE_ABSENT, - Self::RECONCILIATION_OUTCOME_CHARGE_REFUSED, - Self::RECONCILIATION_OUTCOME_PROVIDER_CANNOT_SAY, - Self::RECONCILIATION_OUTCOME_PROVIDER_UNREACHABLE, - ] - } -} -/// Recovery for a billing consumer: where it got to, and what it left open. -/// -/// ConsumerCheckpoint is how far a billing consumer has read its source. -/// -/// Consumption position and settlement state are tracked separately, and that -/// separation is deliberate. If the watermark could not advance past an -/// unresolved settlement, one charge stuck behind a provider outage would stop -/// billing for everything after it, and the outage would turn into a backlog -/// measured in whatever the busiest tenant produced meanwhile. The watermark -/// says what has been turned into ledger records; the ledger says what those -/// records came to. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ConsumerCheckpoint { - /// Field 1: `consumer_id` - #[serde( - rename = "consumerId", - alias = "consumer_id", - with = "::buffa::json_helpers::proto_string" - )] - pub consumer_id: ::buffa::alloc::string::String, - /// The source this consumer reads. Opaque here; a stream name, a subject, a - /// partition. - /// - /// Field 2: `source` - #[serde(rename = "source", with = "::buffa::json_helpers::proto_string")] - pub source: ::buffa::alloc::string::String, - /// Position every usage fact below has a durable ledger record for. Advancing - /// this before writing those records would lose usage on a crash, which is the - /// one failure this ledger cannot detect afterwards: an unrecorded charge - /// leaves nothing behind to reconcile against. - /// - /// Field 3: `processed_watermark` - #[serde( - rename = "processedWatermark", - alias = "processed_watermark", - with = "::buffa::json_helpers::uint64" - )] - pub processed_watermark: u64, - /// Field 4: `processed_at` - #[serde(rename = "processedAt", alias = "processed_at")] - pub processed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, - /// Records not in a terminal state. - /// - /// Field 5: `open_settlement_count` - #[serde( - rename = "openSettlementCount", - alias = "open_settlement_count", - with = "::buffa::json_helpers::uint32" - )] - pub open_settlement_count: u32, - /// Records specifically in UNKNOWN. Broken out because it is the number that - /// means money may have moved without anyone knowing, and burying it inside a - /// general open count is how it stops being looked at. - /// - /// Field 6: `unknown_settlement_count` - #[serde( - rename = "unknownSettlementCount", - alias = "unknown_settlement_count", - with = "::buffa::json_helpers::uint32" - )] - pub unknown_settlement_count: u32, - /// Source position of the oldest open settlement. Unset when nothing is open. - /// - /// Reported to bound a recovery scan, not to hold the watermark back. It is - /// the floor a scan can start from instead of re-reading everything the - /// consumer has ever processed. - /// - /// Field 7: `oldest_open_watermark` - #[serde( - rename = "oldestOpenWatermark", - alias = "oldest_open_watermark", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub oldest_open_watermark: ::core::option::Option, -} -impl ::core::fmt::Debug for ConsumerCheckpoint { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ConsumerCheckpoint") - .field("consumer_id", &self.consumer_id) - .field("source", &self.source) - .field("processed_watermark", &self.processed_watermark) - .field("processed_at", &self.processed_at) - .field("open_settlement_count", &self.open_settlement_count) - .field("unknown_settlement_count", &self.unknown_settlement_count) - .field("oldest_open_watermark", &self.oldest_open_watermark) - .finish() - } -} -impl ConsumerCheckpoint { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ConsumerCheckpoint"; -} -impl ConsumerCheckpoint { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::oldest_open_watermark`] to `Some(value)`, consuming and returning `self`. - pub fn with_oldest_open_watermark(mut self, value: u64) -> Self { - self.oldest_open_watermark = Some(value); - self - } -} -::buffa::impl_default_instance!(ConsumerCheckpoint); -impl ::buffa::MessageName for ConsumerCheckpoint { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ConsumerCheckpoint"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ConsumerCheckpoint"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ConsumerCheckpoint"; -} -impl ::buffa::Message for ConsumerCheckpoint { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.consumer_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.source) as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.processed_watermark) as u64; - if self.processed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.processed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.open_settlement_count) as u64; - size - += 1u64 - + ::buffa::types::uint32_encoded_len(self.unknown_settlement_count) - as u64; - if let Some(v) = self.oldest_open_watermark { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.consumer_id, buf); - ::buffa::types::put_string_field(2u32, &self.source, buf); - ::buffa::types::put_uint64_field(3u32, self.processed_watermark, buf); - if self.processed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.processed_at.write_to(__cache, buf); - } - ::buffa::types::put_uint32_field(5u32, self.open_settlement_count, buf); - ::buffa::types::put_uint32_field(6u32, self.unknown_settlement_count, buf); - if let Some(v) = self.oldest_open_watermark { - ::buffa::types::put_uint64_field(7u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.consumer_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.source, buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.processed_watermark = ::buffa::types::decode_uint64(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.processed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.open_settlement_count = ::buffa::types::decode_uint32(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.unknown_settlement_count = ::buffa::types::decode_uint32(buf)?; - } - 7u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.oldest_open_watermark = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.consumer_id.clear(); - self.source.clear(); - self.processed_watermark = 0u64; - self.processed_at = ::buffa::MessageField::none(); - self.open_settlement_count = 0u32; - self.unknown_settlement_count = 0u32; - self.oldest_open_watermark = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ConsumerCheckpoint { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __CONSUMER_CHECKPOINT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ConsumerCheckpoint", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ScanOpenSettlementsRequest enumerates settlements that still need attention. -/// -/// Bounded on purpose. A recovery pass that scans the whole ledger gets slower -/// exactly as the system gets busier, so the pass meant to run during an -/// incident is the one that stops finishing during an incident. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ScanOpenSettlementsRequest { - /// Field 1: `consumer_id` - #[serde( - rename = "consumerId", - alias = "consumer_id", - with = "::buffa::json_helpers::proto_string" - )] - pub consumer_id: ::buffa::alloc::string::String, - /// Which states to return. Empty means every non-terminal state, which is the - /// ordinary recovery sweep. - /// - /// Field 2: `states` - #[serde( - rename = "states", - with = "::buffa::json_helpers::repeated_enum", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec" - )] - pub states: ::buffa::alloc::vec::Vec<::buffa::EnumValue>, - /// Only records untouched for at least this long. - /// - /// A settlement published a second ago and not yet acknowledged is not stuck, - /// it is in flight, and a recovery pass that republishes it is competing with - /// the attempt already running. Unset means no age filter, which is correct - /// for a report and wrong for an automated retry loop. - /// - /// Field 3: `idle_for` - #[serde( - rename = "idleFor", - alias = "idle_for", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field" - )] - pub idle_for: ::buffa::MessageField< - ::buffa_types::google::protobuf::Duration, - ::buffa::Inline<::buffa_types::google::protobuf::Duration>, - >, - /// Only records at or above this source position. Set from - /// `ConsumerCheckpoint.oldest_open_watermark` to make a sweep proportional to - /// what is actually open rather than to the ledger's size. - /// - /// Field 4: `from_watermark` - #[serde( - rename = "fromWatermark", - alias = "from_watermark", - with = "::buffa::json_helpers::opt_uint64", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub from_watermark: ::core::option::Option, - /// Field 5: `page_size` - #[serde( - rename = "pageSize", - alias = "page_size", - with = "::buffa::json_helpers::uint32" - )] - pub page_size: u32, - /// Opaque continuation. Unset starts a new scan. - /// - /// Field 6: `page_token` - #[serde( - rename = "pageToken", - alias = "page_token", - with = "::buffa::json_helpers::opt_bytes", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub page_token: ::core::option::Option<::buffa::alloc::vec::Vec>, -} -impl ::core::fmt::Debug for ScanOpenSettlementsRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ScanOpenSettlementsRequest") - .field("consumer_id", &self.consumer_id) - .field("states", &self.states) - .field("idle_for", &self.idle_for) - .field("from_watermark", &self.from_watermark) - .field("page_size", &self.page_size) - .field("page_token", &self.page_token) - .finish() - } -} -impl ScanOpenSettlementsRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ScanOpenSettlementsRequest"; -} -impl ScanOpenSettlementsRequest { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::from_watermark`] to `Some(value)`, consuming and returning `self`. - pub fn with_from_watermark(mut self, value: u64) -> Self { - self.from_watermark = Some(value); - self - } - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::page_token`] to `Some(value)`, consuming and returning `self`. - pub fn with_page_token( - mut self, - value: impl Into<::buffa::alloc::vec::Vec>, - ) -> Self { - self.page_token = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ScanOpenSettlementsRequest); -impl ::buffa::MessageName for ScanOpenSettlementsRequest { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ScanOpenSettlementsRequest"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ScanOpenSettlementsRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ScanOpenSettlementsRequest"; -} -impl ::buffa::Message for ScanOpenSettlementsRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.consumer_id) as u64; - if !self.states.is_empty() { - let payload: u64 = self - .states - .iter() - .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u64) - .sum::(); - size += 1u64 + ::buffa::encoding::varint_len(payload) as u64 + payload; - } - if self.idle_for.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.idle_for.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(v) = self.from_watermark { - size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; - } - size += 1u64 + ::buffa::types::uint32_encoded_len(self.page_size) as u64; - if let Some(ref v) = self.page_token { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.consumer_id, buf); - if !self.states.is_empty() { - let payload: u64 = self - .states - .iter() - .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u64) - .sum::(); - ::buffa::types::put_len_delimited_header(2u32, payload, buf); - for v in &self.states { - ::buffa::types::encode_int32(v.to_i32(), buf); - } - } - if self.idle_for.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.idle_for.write_to(__cache, buf); - } - if let Some(v) = self.from_watermark { - ::buffa::types::put_uint64_field(4u32, v, buf); - } - ::buffa::types::put_uint32_field(5u32, self.page_size, buf); - if let Some(ref v) = self.page_token { - ::buffa::types::put_shared_bytes_field(6u32, v, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.consumer_id, buf)?; - } - 2u32 => { - if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { - let len = ::buffa::encoding::decode_varint(buf)?; - let len = usize::try_from(len) - .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; - if buf.remaining() < len { - return ::core::result::Result::Err( - ::buffa::DecodeError::UnexpectedEof, - ); - } - self.states.reserve(len); - let mut limited = buf.take(len); - while limited.has_remaining() { - self.states - .push( - ::buffa::EnumValue::from( - ::buffa::types::decode_int32_packed(&mut limited)?, - ), - ); - } - let leftover = limited.remaining(); - if leftover > 0 { - limited.advance(leftover); - } - } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { - self.states - .push( - ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?), - ); - } else { - return ::core::result::Result::Err( - ::buffa::encoding::wire_type_mismatch( - tag, - ::buffa::encoding::WireType::LengthDelimited, - ), - ); - } - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.idle_for.get_or_insert_default(), - buf, - ctx, - )?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.from_watermark = ::core::option::Option::Some( - ::buffa::types::decode_uint64(buf)?, - ); - } - 5u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.page_size = ::buffa::types::decode_uint32(buf)?; - } - 6u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes( - self.page_token.get_or_insert_with(::buffa::alloc::vec::Vec::new), - buf, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.consumer_id.clear(); - self.states.clear(); - self.idle_for = ::buffa::MessageField::none(); - self.from_watermark = ::core::option::Option::None; - self.page_size = 0u32; - self.page_token = ::core::option::Option::None; - } -} -impl ::buffa::json_helpers::ProtoElemJson for ScanOpenSettlementsRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SCAN_OPEN_SETTLEMENTS_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ScanOpenSettlementsRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ScanOpenSettlementsResponse is one page of unresolved settlements. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ScanOpenSettlementsResponse { - /// Field 1: `records` - #[serde( - rename = "records", - skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec", - deserialize_with = "::buffa::json_helpers::null_as_default" - )] - pub records: ::buffa::alloc::vec::Vec, - /// Unset when this is the last page. Presence, and not an empty `records` - /// list, is the end signal. - /// - /// Field 2: `next_page_token` - #[serde( - rename = "nextPageToken", - alias = "next_page_token", - with = "::buffa::json_helpers::opt_bytes", - skip_serializing_if = "::core::option::Option::is_none" - )] - pub next_page_token: ::core::option::Option<::buffa::alloc::vec::Vec>, - /// Field 3: `coverage` - #[serde(rename = "coverage")] - pub coverage: ::buffa::MessageField>, -} -impl ::core::fmt::Debug for ScanOpenSettlementsResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ScanOpenSettlementsResponse") - .field("records", &self.records) - .field("next_page_token", &self.next_page_token) - .field("coverage", &self.coverage) - .finish() - } -} -impl ScanOpenSettlementsResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ScanOpenSettlementsResponse"; -} -impl ScanOpenSettlementsResponse { - #[must_use = "with_* setters return `self` by value; assign or chain the result"] - #[inline] - ///Sets [`Self::next_page_token`] to `Some(value)`, consuming and returning `self`. - pub fn with_next_page_token( - mut self, - value: impl Into<::buffa::alloc::vec::Vec>, - ) -> Self { - self.next_page_token = Some(value.into()); - self - } -} -::buffa::impl_default_instance!(ScanOpenSettlementsResponse); -impl ::buffa::MessageName for ScanOpenSettlementsResponse { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ScanOpenSettlementsResponse"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ScanOpenSettlementsResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ScanOpenSettlementsResponse"; -} -impl ::buffa::Message for ScanOpenSettlementsResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - for v in &self.records { - let __slot = __cache.reserve(); - let inner_size = v.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if let Some(ref v) = self.next_page_token { - size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; - } - if self.coverage.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.coverage.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - for v in &self.records { - ::buffa::types::put_len_delimited_header( - 1u32, - u64::from(__cache.consume_next()), - buf, - ); - v.write_to(__cache, buf); - } - if let Some(ref v) = self.next_page_token { - ::buffa::types::put_shared_bytes_field(2u32, v, buf); - } - if self.coverage.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.coverage.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - let mut elem = ::core::default::Default::default(); - ctx.register_element_memory( - ::buffa::__private::element_footprint(&elem), - )?; - ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; - self.records.push(elem); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_bytes( - self - .next_page_token - .get_or_insert_with(::buffa::alloc::vec::Vec::new), - buf, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.coverage.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.records.clear(); - self.next_page_token = ::core::option::Option::None; - self.coverage = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ScanOpenSettlementsResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SCAN_OPEN_SETTLEMENTS_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ScanOpenSettlementsResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ScanCoverage is what the scan did not look at. -/// -/// Always present, including on a scan that covered everything. An operator -/// reading an empty page needs to know whether that means nothing is open or -/// the scan ran out of budget, and those two look identical without this. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ScanCoverage { - /// Field 1: `exhaustive` - #[serde(rename = "exhaustive", with = "::buffa::json_helpers::proto_bool")] - pub exhaustive: bool, - /// Source position the scan covered through. - /// - /// Field 2: `scanned_through_watermark` - #[serde( - rename = "scannedThroughWatermark", - alias = "scanned_through_watermark", - with = "::buffa::json_helpers::uint64" - )] - pub scanned_through_watermark: u64, - /// Records matching the filter that a fault made unreadable. Non-zero means - /// unresolved settlements exist that this scan cannot name, so the sweep must - /// not be treated as having cleared anything. - /// - /// Field 3: `unreadable_count` - #[serde( - rename = "unreadableCount", - alias = "unreadable_count", - with = "::buffa::json_helpers::uint32" - )] - pub unreadable_count: u32, - /// Field 4: `observed_at` - #[serde(rename = "observedAt", alias = "observed_at")] - pub observed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for ScanCoverage { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ScanCoverage") - .field("exhaustive", &self.exhaustive) - .field("scanned_through_watermark", &self.scanned_through_watermark) - .field("unreadable_count", &self.unreadable_count) - .field("observed_at", &self.observed_at) - .finish() - } -} -impl ScanCoverage { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ScanCoverage"; -} -::buffa::impl_default_instance!(ScanCoverage); -impl ::buffa::MessageName for ScanCoverage { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ScanCoverage"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ScanCoverage"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ScanCoverage"; -} -impl ::buffa::Message for ScanCoverage { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; - size - += 1u64 - + ::buffa::types::uint64_encoded_len(self.scanned_through_watermark) - as u64; - size += 1u64 + ::buffa::types::uint32_encoded_len(self.unreadable_count) as u64; - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_bool_field(1u32, self.exhaustive, buf); - ::buffa::types::put_uint64_field(2u32, self.scanned_through_watermark, buf); - ::buffa::types::put_uint32_field(3u32, self.unreadable_count, buf); - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 4u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.exhaustive = ::buffa::types::decode_bool(buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.scanned_through_watermark = ::buffa::types::decode_uint64(buf)?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.unreadable_count = ::buffa::types::decode_uint32(buf)?; - } - 4u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.exhaustive = false; - self.scanned_through_watermark = 0u64; - self.unreadable_count = 0u32; - self.observed_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ScanCoverage { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __SCAN_COVERAGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ScanCoverage", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ReconcileSettlementRequest asks the provider what actually happened to a -/// settlement whose outcome was never observed. -/// -/// A query, not a retry. It exists so a consumer facing UNKNOWN has a move other -/// than publishing again and hoping the idempotency key holds, and there is no -/// field on it that could cause a charge. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReconcileSettlementRequest { - /// Field 1: `consumer_id` - #[serde( - rename = "consumerId", - alias = "consumer_id", - with = "::buffa::json_helpers::proto_string" - )] - pub consumer_id: ::buffa::alloc::string::String, - /// Field 2: `settlement_id` - #[serde( - rename = "settlementId", - alias = "settlement_id", - with = "::buffa::json_helpers::proto_string" - )] - pub settlement_id: ::buffa::alloc::string::String, -} -impl ::core::fmt::Debug for ReconcileSettlementRequest { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReconcileSettlementRequest") - .field("consumer_id", &self.consumer_id) - .field("settlement_id", &self.settlement_id) - .finish() - } -} -impl ReconcileSettlementRequest { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ReconcileSettlementRequest"; -} -::buffa::impl_default_instance!(ReconcileSettlementRequest); -impl ::buffa::MessageName for ReconcileSettlementRequest { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ReconcileSettlementRequest"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ReconcileSettlementRequest"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ReconcileSettlementRequest"; -} -impl ::buffa::Message for ReconcileSettlementRequest { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.consumer_id) as u64; - size += 1u64 + ::buffa::types::string_encoded_len(&self.settlement_id) as u64; - ::buffa::saturate_size(size) - } - fn write_to( - &self, - _cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_string_field(1u32, &self.consumer_id, buf); - ::buffa::types::put_string_field(2u32, &self.settlement_id, buf); - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.consumer_id, buf)?; - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::types::merge_string(&mut self.settlement_id, buf)?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.consumer_id.clear(); - self.settlement_id.clear(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReconcileSettlementRequest { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECONCILE_SETTLEMENT_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ReconcileSettlementRequest", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; -/// ReconcileSettlementResponse is what the provider says it knows. -#[derive(Clone, PartialEq, Default)] -#[derive(::serde::Serialize, ::serde::Deserialize)] -#[serde(default)] -pub struct ReconcileSettlementResponse { - /// Field 1: `outcome` - #[serde(rename = "outcome", with = "::buffa::json_helpers::proto_enum")] - pub outcome: ::buffa::EnumValue, - /// The updated ledger record, so a caller never has to reconstruct the new - /// state from the outcome and hope its transition table matches the server's. - /// - /// Field 2: `record` - #[serde(rename = "record")] - pub record: ::buffa::MessageField< - SettlementRecord, - ::buffa::Inline, - >, - /// Field 3: `observed_at` - #[serde(rename = "observedAt", alias = "observed_at")] - pub observed_at: ::buffa::MessageField< - ::buffa_types::google::protobuf::Timestamp, - ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, - >, -} -impl ::core::fmt::Debug for ReconcileSettlementResponse { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ReconcileSettlementResponse") - .field("outcome", &self.outcome) - .field("record", &self.record) - .field("observed_at", &self.observed_at) - .finish() - } -} -impl ReconcileSettlementResponse { - /// Protobuf type URL for this message, for use with `Any::pack` and - /// `Any::unpack_if`. - /// - /// Format: `type.googleapis.com/` - pub const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ReconcileSettlementResponse"; -} -::buffa::impl_default_instance!(ReconcileSettlementResponse); -impl ::buffa::MessageName for ReconcileSettlementResponse { - const PACKAGE: &'static str = "trogonai.usage.settlement.v1alpha1"; - const NAME: &'static str = "ReconcileSettlementResponse"; - const FULL_NAME: &'static str = "trogonai.usage.settlement.v1alpha1.ReconcileSettlementResponse"; - const TYPE_URL: &'static str = "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ReconcileSettlementResponse"; -} -impl ::buffa::Message for ReconcileSettlementResponse { - /// Returns the total encoded size in bytes. - /// - /// Accumulates in `u64` (which cannot overflow for in-memory - /// data) and saturates to `u32` at return, so a message whose - /// encoded size exceeds the 2 GiB protobuf limit yields a value - /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry - /// points reject, never a silently wrapped size. - #[allow(clippy::let_and_return)] - fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - let mut size = 0u64; - { - let val = self.outcome.to_i32(); - size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64; - } - if self.record.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.record.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - if self.observed_at.is_set() { - let __slot = __cache.reserve(); - let inner_size = self.observed_at.compute_size(__cache); - __cache.set(__slot, inner_size); - size - += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 - + inner_size as u64; - } - ::buffa::saturate_size(size) - } - fn write_to( - &self, - __cache: &mut ::buffa::SizeCache, - buf: &mut impl ::buffa::EncodeSink, - ) { - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - ::buffa::types::put_int32_field(1u32, self.outcome.to_i32(), buf); - if self.record.is_set() { - ::buffa::types::put_len_delimited_header( - 2u32, - u64::from(__cache.consume_next()), - buf, - ); - self.record.write_to(__cache, buf); - } - if self.observed_at.is_set() { - ::buffa::types::put_len_delimited_header( - 3u32, - u64::from(__cache.consume_next()), - buf, - ); - self.observed_at.write_to(__cache, buf); - } - } - fn merge_field( - &mut self, - tag: ::buffa::encoding::Tag, - buf: &mut impl ::buffa::bytes::Buf, - ctx: ::buffa::DecodeContext<'_>, - ) -> ::core::result::Result<(), ::buffa::DecodeError> { - #[allow(unused_imports)] - use ::buffa::bytes::Buf as _; - #[allow(unused_imports)] - use ::buffa::Enumeration as _; - match tag.field_number() { - 1u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::Varint, - )?; - self.outcome = ::buffa::EnumValue::from( - ::buffa::types::decode_int32(buf)?, - ); - } - 2u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.record.get_or_insert_default(), - buf, - ctx, - )?; - } - 3u32 => { - ::buffa::encoding::check_wire_type( - tag, - ::buffa::encoding::WireType::LengthDelimited, - )?; - ::buffa::Message::merge_length_delimited( - self.observed_at.get_or_insert_default(), - buf, - ctx, - )?; - } - _ => { - ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; - } - } - ::core::result::Result::Ok(()) - } - fn clear(&mut self) { - self.outcome = ::buffa::EnumValue::from(0); - self.record = ::buffa::MessageField::none(); - self.observed_at = ::buffa::MessageField::none(); - } -} -impl ::buffa::json_helpers::ProtoElemJson for ReconcileSettlementResponse { - fn serialize_proto_json( - v: &Self, - s: S, - ) -> ::core::result::Result { - ::serde::Serialize::serialize(v, s) - } - fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>( - d: D, - ) -> ::core::result::Result { - ::deserialize(d) - } -} -#[doc(hidden)] -pub const __RECONCILE_SETTLEMENT_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry { - type_url: "type.googleapis.com/trogonai.usage.settlement.v1alpha1.ReconcileSettlementResponse", - to_json: ::buffa::type_registry::any_to_json::, - from_json: ::buffa::type_registry::any_from_json::, - is_wkt: false, -}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/lib.rs b/rsworkspace/crates/platform/trogonai-proto/src/lib.rs index f16f14eac..a5e93e836 100644 --- a/rsworkspace/crates/platform/trogonai-proto/src/lib.rs +++ b/rsworkspace/crates/platform/trogonai-proto/src/lib.rs @@ -15,10 +15,10 @@ reason = "buffa-codegen emits each message's view module beside the message it views, so the generated tree is cyclic by construction and is not edited here" ) )] -#[cfg(any(feature = "schedules", feature = "agents", feature = "sessions", feature = "decider"))] +#[cfg(any(feature = "schedules", feature = "agents", feature = "decider"))] mod r#gen; -#[cfg(any(feature = "schedules", feature = "agents", feature = "sessions"))] +#[cfg(any(feature = "schedules", feature = "agents"))] mod codec; pub mod constants; @@ -35,9 +35,6 @@ pub mod agents; #[cfg(feature = "decider")] pub mod decider; -#[cfg(feature = "sessions")] -pub mod session; - // Thin wrappers that re-export the generated proto packages, emitted as inline // module trees that mirror the codegen layout. #[cfg(any(feature = "schedules", feature = "agents"))] @@ -48,14 +45,6 @@ pub mod content { } } -#[cfg(feature = "sessions")] -#[cfg_attr(dylint_lib = "trogon_lints", allow(inline_module_block))] -pub mod usage { - pub mod settlement_v1alpha1 { - pub use crate::r#gen::trogonai::usage::settlement::v1alpha1::*; - } -} - #[cfg(any(feature = "schedules", feature = "agents", feature = "decider"))] #[cfg_attr(dylint_lib = "trogon_lints", allow(inline_module_block))] pub mod google { @@ -71,7 +60,7 @@ pub mod google { } /// Failure decoding a registered event payload to canonical JSON. -#[cfg(any(feature = "schedules", feature = "agents", feature = "sessions"))] +#[cfg(any(feature = "schedules", feature = "agents"))] #[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)] pub enum EventDecodeError { #[error("failed to decode '{type_url}' payload as json: {message}")] @@ -89,7 +78,7 @@ pub enum EventDecodeError { /// Returns `Ok(None)` only for unregistered types; a registered type whose payload /// fails to decode returns `Err`, so malformed output of a known event is never /// mistaken for an unknown type. -#[cfg(any(feature = "schedules", feature = "agents", feature = "sessions"))] +#[cfg(any(feature = "schedules", feature = "agents"))] pub fn decode_event_to_json(type_url: &str, payload: &[u8]) -> Result, EventDecodeError> { static REGISTRY: std::sync::OnceLock = std::sync::OnceLock::new(); @@ -99,8 +88,6 @@ pub fn decode_event_to_json(type_url: &str, payload: &[u8]) -> Result Result; - -impl EventEncode for v1alpha1::SessionEvent { - type Error = SessionEventPayloadError; - - fn encode(&self) -> Result, Self::Error> { - self.event - .as_ref() - .map(encode_session_event_case) - .ok_or(SessionEventPayloadError::MissingEvent) - } -} - -impl EventDecode for v1alpha1::SessionEvent { - type Error = SessionEventPayloadError; - - fn decode(event: EventData<'_>) -> Result, Self::Error> { - match decode_session_event_case(event)? { - Some(event) => Ok(EventDecodeOutcome::Decoded(v1alpha1::SessionEvent { - event: Some(event), - })), - None => Ok(EventDecodeOutcome::Skipped), - } - } -} - -impl EventType for v1alpha1::SessionEvent { - type Error = SessionEventPayloadError; - - fn event_type(&self) -> Result<&'static str, Self::Error> { - self.event - .as_ref() - .map(session_event_case_type) - .ok_or(SessionEventPayloadError::MissingEvent) - } -} - -#[cfg(feature = "runtime-host")] -impl EventIdentity for v1alpha1::SessionEvent {} - -fn encode_session_event_case(event: &SessionEventCase) -> Vec { - match event { - SessionEventCase::SessionStarted(inner) => inner.encode_to_vec(), - SessionEventCase::SessionClosed(inner) => inner.encode_to_vec(), - SessionEventCase::SessionCancelled(inner) => inner.encode_to_vec(), - SessionEventCase::SessionFailed(inner) => inner.encode_to_vec(), - SessionEventCase::SessionHidden(inner) => inner.encode_to_vec(), - SessionEventCase::SessionForked(inner) => inner.encode_to_vec(), - SessionEventCase::SessionRecovered(inner) => inner.encode_to_vec(), - SessionEventCase::SessionRewound(inner) => inner.encode_to_vec(), - SessionEventCase::Compacted(inner) => inner.encode_to_vec(), - SessionEventCase::UserMessageRecorded(inner) => inner.encode_to_vec(), - SessionEventCase::AssistantMessageStarted(inner) => inner.encode_to_vec(), - SessionEventCase::AssistantMessageCompleted(inner) => inner.encode_to_vec(), - SessionEventCase::AssistantMessageFailed(inner) => inner.encode_to_vec(), - SessionEventCase::ProviderToolIntentRejected(inner) => inner.encode_to_vec(), - SessionEventCase::ToolCallRequested(inner) => inner.encode_to_vec(), - SessionEventCase::ToolCallApproved(inner) => inner.encode_to_vec(), - SessionEventCase::ToolCallDenied(inner) => inner.encode_to_vec(), - SessionEventCase::ToolCallStarted(inner) => inner.encode_to_vec(), - SessionEventCase::ToolCallCompleted(inner) => inner.encode_to_vec(), - SessionEventCase::ToolCallFailed(inner) => inner.encode_to_vec(), - SessionEventCase::ArtifactRecorded(inner) => inner.encode_to_vec(), - SessionEventCase::FileChanged(inner) => inner.encode_to_vec(), - SessionEventCase::ExecutionAttemptStarted(inner) => inner.encode_to_vec(), - SessionEventCase::ExecutionAttemptReady(inner) => inner.encode_to_vec(), - SessionEventCase::ExecutionAttemptEnded(inner) => inner.encode_to_vec(), - SessionEventCase::CheckpointProduced(inner) => inner.encode_to_vec(), - SessionEventCase::DelegationDispatched(inner) => inner.encode_to_vec(), - SessionEventCase::ParentLinked(inner) => inner.encode_to_vec(), - SessionEventCase::ParentTerminated(inner) => inner.encode_to_vec(), - SessionEventCase::DelegationDetached(inner) => inner.encode_to_vec(), - SessionEventCase::ParentHistoryInvalidated(inner) => inner.encode_to_vec(), - SessionEventCase::ParentDetached(inner) => inner.encode_to_vec(), - SessionEventCase::ExternalDelegationDispatched(inner) => inner.encode_to_vec(), - SessionEventCase::OperationReserved(inner) => inner.encode_to_vec(), - SessionEventCase::OperationOutcomeRecorded(inner) => inner.encode_to_vec(), - SessionEventCase::OperationCancellationRequested(inner) => inner.encode_to_vec(), - SessionEventCase::ArtifactErased(inner) => inner.encode_to_vec(), - SessionEventCase::RedactionApplied(inner) => inner.encode_to_vec(), - SessionEventCase::SystemNoticeRecorded(inner) => inner.encode_to_vec(), - SessionEventCase::TodoUpdated(inner) => inner.encode_to_vec(), - SessionEventCase::SessionRenamed(inner) => inner.encode_to_vec(), - SessionEventCase::SessionArchived(inner) => inner.encode_to_vec(), - SessionEventCase::SessionUnarchived(inner) => inner.encode_to_vec(), - } -} - -fn decode_session_event_case(event: EventData<'_>) -> Result, SessionEventPayloadError> { - let Some(event) = decode_event_case::(&event) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - .or_else(|| decode_event_case::(&event)) - else { - return Ok(None); - }; - - event.map(Some).map_err(SessionEventPayloadError::Decode) -} - -fn session_event_case_type(event: &SessionEventCase) -> &'static str { - match event { - SessionEventCase::SessionStarted(_) => event_type::(), - SessionEventCase::SessionClosed(_) => event_type::(), - SessionEventCase::SessionCancelled(_) => event_type::(), - SessionEventCase::SessionFailed(_) => event_type::(), - SessionEventCase::SessionHidden(_) => event_type::(), - SessionEventCase::SessionForked(_) => event_type::(), - SessionEventCase::SessionRecovered(_) => event_type::(), - SessionEventCase::SessionRewound(_) => event_type::(), - SessionEventCase::Compacted(_) => event_type::(), - SessionEventCase::UserMessageRecorded(_) => event_type::(), - SessionEventCase::AssistantMessageStarted(_) => event_type::(), - SessionEventCase::AssistantMessageCompleted(_) => event_type::(), - SessionEventCase::AssistantMessageFailed(_) => event_type::(), - SessionEventCase::ToolCallRequested(_) => event_type::(), - SessionEventCase::ToolCallApproved(_) => event_type::(), - SessionEventCase::ToolCallDenied(_) => event_type::(), - SessionEventCase::ToolCallStarted(_) => event_type::(), - SessionEventCase::ToolCallCompleted(_) => event_type::(), - SessionEventCase::ToolCallFailed(_) => event_type::(), - SessionEventCase::ArtifactRecorded(_) => event_type::(), - SessionEventCase::FileChanged(_) => event_type::(), - SessionEventCase::ExecutionAttemptStarted(_) => event_type::(), - SessionEventCase::ExecutionAttemptReady(_) => event_type::(), - SessionEventCase::ExecutionAttemptEnded(_) => event_type::(), - SessionEventCase::CheckpointProduced(_) => event_type::(), - SessionEventCase::DelegationDispatched(_) => event_type::(), - SessionEventCase::ParentLinked(_) => event_type::(), - SessionEventCase::ParentTerminated(_) => event_type::(), - SessionEventCase::DelegationDetached(_) => event_type::(), - SessionEventCase::ParentHistoryInvalidated(_) => event_type::(), - SessionEventCase::ParentDetached(_) => event_type::(), - SessionEventCase::ExternalDelegationDispatched(_) => event_type::(), - SessionEventCase::OperationReserved(_) => event_type::(), - SessionEventCase::OperationOutcomeRecorded(_) => event_type::(), - SessionEventCase::OperationCancellationRequested(_) => event_type::(), - SessionEventCase::ArtifactErased(_) => event_type::(), - SessionEventCase::RedactionApplied(_) => event_type::(), - SessionEventCase::SystemNoticeRecorded(_) => event_type::(), - SessionEventCase::TodoUpdated(_) => event_type::(), - SessionEventCase::SessionRenamed(_) => event_type::(), - SessionEventCase::SessionArchived(_) => event_type::(), - SessionEventCase::SessionUnarchived(_) => event_type::(), - SessionEventCase::ProviderToolIntentRejected(_) => event_type::(), - } -} - -#[cfg(test)] -mod tests; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/session/sessions/codec/tests.rs b/rsworkspace/crates/platform/trogonai-proto/src/session/sessions/codec/tests.rs deleted file mode 100644 index 76638f5fc..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/session/sessions/codec/tests.rs +++ /dev/null @@ -1,1208 +0,0 @@ -use buffa::{Message as _, MessageField}; -use trogon_decider::{EventData, EventDecode, EventDecodeOutcome, EventEncode, EventType}; - -use super::*; - -fn timestamp() -> buffa_types::google::protobuf::Timestamp { - buffa_types::google::protobuf::Timestamp::from_unix(1_451_600_400, 0) -} - -fn digest() -> v1alpha1::Digest { - v1alpha1::Digest { - algorithm: "sha256".to_string(), - value: vec![0u8; 32], - } -} - -fn session_ordinal(value: u64) -> v1alpha1::SessionOrdinal { - v1alpha1::SessionOrdinal { value } -} - -fn workspace_ref() -> v1alpha1::WorkspaceRef { - v1alpha1::WorkspaceRef { - workspace_id: "workspace-1".to_string(), - uri: "file:///workspace".to_string(), - revision: None, - } -} - -fn artifact_ref() -> v1alpha1::ArtifactRef { - v1alpha1::ArtifactRef { - artifact_id: "artifact-1".to_string(), - digest: MessageField::some(digest()), - size_bytes: 128, - mime: "text/plain".to_string(), - preview: None, - truncated: None, - untruncated_size_bytes: None, - } -} - -fn canonical_message(role: v1alpha1::MessageRole) -> v1alpha1::CanonicalMessage { - v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(role), - content: vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Text("hello".to_string())), - }], - model: None, - usage: MessageField::none(), - created_at: MessageField::some(timestamp()), - } -} - -fn checkpoint() -> v1alpha1::Checkpoint { - v1alpha1::Checkpoint { - reference: "checkpoint-ref".to_string(), - checkpoint_type: "full".to_string(), - digest: MessageField::some(digest()), - implementation_version: "v1".to_string(), - checkpoint_id: "checkpoint-1".to_string(), - producing_execution_attempt_id: "attempt-1".to_string(), - covers_through: MessageField::some(session_ordinal(1)), - session_execution_plan_digest: MessageField::some(digest()), - capture_attestation_ref: "attestation-ref".to_string(), - capture_attestation_digest: MessageField::some(digest()), - effective_history_digest: MessageField::some(digest()), - } -} - -fn session_started() -> v1alpha1::SessionStarted { - v1alpha1::SessionStarted { - session_id: "session-1".to_string(), - execution_plan: MessageField::some(v1alpha1::StoredSessionExecutionPlan { - plan_bytes: b"plan".to_vec(), - plan_digest: MessageField::some(digest()), - }), - workspace: MessageField::some(workspace_ref()), - } -} - -fn session_closed() -> v1alpha1::SessionClosed { - v1alpha1::SessionClosed { - session_id: "session-1".to_string(), - result_ref: MessageField::some(artifact_ref()), - } -} - -fn session_cancelled() -> v1alpha1::SessionCancelled { - v1alpha1::SessionCancelled { - session_id: "session-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::SessionCancellationReason::UserRequested), - detail: None, - } -} - -fn session_failed() -> v1alpha1::SessionFailed { - v1alpha1::SessionFailed { - session_id: "session-1".to_string(), - detail: Some("boom".to_string()), - reason: buffa::EnumValue::from(v1alpha1::SessionFailureReason::ExecutionError), - } -} - -fn session_hidden() -> v1alpha1::SessionHidden { - v1alpha1::SessionHidden { - session_id: "session-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::SessionHiddenReason::UserRequested), - } -} - -fn session_forked() -> v1alpha1::SessionForked { - v1alpha1::SessionForked { - session_id: "session-1".to_string(), - source_session_id: "session-0".to_string(), - context_prefix_boundary: MessageField::some(session_ordinal(3)), - reason: buffa::EnumValue::from(v1alpha1::ForkReason::ManualBranch), - } -} - -fn session_recovered() -> v1alpha1::SessionRecovered { - v1alpha1::SessionRecovered { - session_id: "session-1".to_string(), - source_session_id: "session-0".to_string(), - source_boundary: MessageField::some(session_ordinal(7)), - source_digest: MessageField::some(digest()), - salvage_key: "salvage-1".to_string(), - completeness: buffa::EnumValue::from(v1alpha1::RecoveryCompleteness::Partial), - omitted_count: 2, - } -} - -fn session_rewound() -> v1alpha1::SessionRewound { - v1alpha1::SessionRewound { - session_id: "session-1".to_string(), - keep_through: MessageField::some(session_ordinal(2)), - reason: buffa::EnumValue::from(v1alpha1::RewindReason::Manual), - } -} - -fn compaction_context_root() -> v1alpha1::CompactionContextRoot { - v1alpha1::CompactionContextRoot { - root: Some(v1alpha1::compaction_context_root::Root::SessionStart(Box::new( - v1alpha1::CompactionSessionStart {}, - ))), - } -} - -fn inherited_compaction_context_root() -> v1alpha1::CompactionContextRoot { - v1alpha1::CompactionContextRoot { - root: Some(v1alpha1::compaction_context_root::Root::InheritedPrefix(Box::new( - v1alpha1::CompactionInheritedPrefix { - source_session_id: "session-0".to_string(), - context_prefix_boundary: MessageField::some(session_ordinal(3)), - }, - ))), - } -} - -fn compaction_producer() -> v1alpha1::CompactionProducer { - v1alpha1::CompactionProducer { - producing_execution_attempt_id: "attempt-1".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - model_role: buffa::EnumValue::from(v1alpha1::CompactionModelRole::Primary), - } -} - -fn compacted() -> v1alpha1::Compacted { - v1alpha1::Compacted { - session_id: "session-1".to_string(), - summary_id: "summary-1".to_string(), - summary_content: "summary".to_string(), - covers_from: MessageField::some(session_ordinal(1)), - covers_through: MessageField::some(session_ordinal(5)), - trigger: buffa::EnumValue::from(v1alpha1::CompactionTrigger::Manual), - guidance: None, - tokens_before: Some(100), - tokens_after: Some(10), - model: Some("model".to_string()), - usage: MessageField::none(), - context_root: MessageField::some(compaction_context_root()), - producer: MessageField::some(compaction_producer()), - covered_input_digest: MessageField::some(digest()), - } -} - -fn user_message_recorded() -> v1alpha1::UserMessageRecorded { - v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(canonical_message(v1alpha1::MessageRole::User)), - turn_id: "turn-1".to_string(), - } -} - -fn assistant_message_started() -> v1alpha1::AssistantMessageStarted { - v1alpha1::AssistantMessageStarted { - session_id: "session-1".to_string(), - message_id: "message-1".to_string(), - model: "model".to_string(), - settings: MessageField::none(), - turn_id: "turn-1".to_string(), - } -} - -fn assistant_message_completed() -> v1alpha1::AssistantMessageCompleted { - v1alpha1::AssistantMessageCompleted { - session_id: "session-1".to_string(), - message: MessageField::some(canonical_message(v1alpha1::MessageRole::Assistant)), - finish_reason: buffa::EnumValue::from(v1alpha1::FinishReason::EndTurn), - matched_stop_sequence: None, - turn_id: "turn-1".to_string(), - } -} - -fn assistant_message_failed() -> v1alpha1::AssistantMessageFailed { - v1alpha1::AssistantMessageFailed { - session_id: "session-1".to_string(), - message_id: "message-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::AssistantMessageFailureReason::Error), - detail: None, - usage: MessageField::none(), - turn_id: "turn-1".to_string(), - } -} - -fn tool_call_requested() -> v1alpha1::ToolCallRequested { - v1alpha1::ToolCallRequested { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - tool_name: "search".to_string(), - input_json: "{}".to_string(), - parent_tool_use_id: None, - operation_id: None, - turn_id: "turn-1".to_string(), - } -} - -fn tool_call_approved() -> v1alpha1::ToolCallApproved { - v1alpha1::ToolCallApproved { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - approved_by: "user-1".to_string(), - turn_id: None, - } -} - -fn tool_call_denied() -> v1alpha1::ToolCallDenied { - v1alpha1::ToolCallDenied { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - denied_by: "user-1".to_string(), - reason: None, - turn_id: None, - } -} - -fn tool_call_started() -> v1alpha1::ToolCallStarted { - v1alpha1::ToolCallStarted { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - turn_id: "turn-1".to_string(), - } -} - -fn tool_call_completed() -> v1alpha1::ToolCallCompleted { - v1alpha1::ToolCallCompleted { - detached: MessageField::none(), - accessed: Vec::new(), - failed_targets: Vec::new(), - targets_attempted: None, - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - result: MessageField::some(v1alpha1::ToolCallResult { - status: buffa::EnumValue::from(v1alpha1::ToolCallResultStatus::Success), - kind: Some(v1alpha1::tool_call_result::Kind::Text(Box::new( - v1alpha1::TextToolResult { - content: "done".to_string(), - truncated: None, - }, - ))), - }), - duration: MessageField::none(), - observed: Vec::new(), - termination: MessageField::none(), - output_replay: MessageField::none(), - turn_id: "turn-1".to_string(), - } -} - -fn tool_call_failed() -> v1alpha1::ToolCallFailed { - v1alpha1::ToolCallFailed { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - error: "boom".to_string(), - reason: buffa::EnumValue::from(v1alpha1::ToolCallFailureReason::Error), - turn_id: "turn-1".to_string(), - } -} - -fn artifact_recorded() -> v1alpha1::ArtifactRecorded { - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(timestamp()), - source: Some(v1alpha1::artifact_metadata::Source::Stored(Box::new( - v1alpha1::StoredArtifact { - digest: MessageField::some(digest()), - size_bytes: 128, - storage_ref: "blob://artifact-1".to_string(), - mime: "text/plain".to_string(), - chunks: MessageField::none(), - }, - ))), - }), - } -} - -fn file_changed() -> v1alpha1::FileChanged { - v1alpha1::FileChanged { - copied_from: MessageField::none(), - session_id: "session-1".to_string(), - path: "src/main.rs".to_string(), - change_kind: buffa::EnumValue::from(v1alpha1::FileChangeKind::Modified), - previous_path: None, - before_ref: MessageField::some(artifact_ref()), - after_ref: MessageField::some(artifact_ref()), - diff: MessageField::none(), - tool_call_id: "tool-call-1".to_string(), - turn_id: "turn-1".to_string(), - } -} - -fn execution_attempt_started() -> v1alpha1::ExecutionAttemptStarted { - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 1, - previous_attempt_id: None, - restored_checkpoint: MessageField::none(), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::some(timestamp()), - } -} - -fn execution_attempt_ready() -> v1alpha1::ExecutionAttemptReady { - v1alpha1::ExecutionAttemptReady { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - ready_attestation_ref: "ready-ref".to_string(), - ready_attestation_digest: MessageField::some(digest()), - ready_at: MessageField::some(timestamp()), - } -} - -fn execution_attempt_ended() -> v1alpha1::ExecutionAttemptEnded { - v1alpha1::ExecutionAttemptEnded { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - outcome: buffa::EnumValue::from(v1alpha1::AttemptOutcome::Failed), - detail: None, - ended_at: MessageField::some(timestamp()), - } -} - -fn checkpoint_produced() -> v1alpha1::CheckpointProduced { - v1alpha1::CheckpointProduced { - session_id: "session-1".to_string(), - checkpoint: MessageField::some(checkpoint()), - } -} - -fn delegation_dispatched() -> v1alpha1::DelegationDispatched { - v1alpha1::DelegationDispatched { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - child_session_id: "session-2".to_string(), - cascade_policy: buffa::EnumValue::from(v1alpha1::CascadePolicy::CascadeOnParentTerminal), - } -} - -fn parent_linked() -> v1alpha1::ParentLinked { - v1alpha1::ParentLinked { - session_id: "session-1".to_string(), - parent_session_id: "session-0".to_string(), - parent_dispatched_at: MessageField::some(session_ordinal(1)), - cascade_policy: buffa::EnumValue::from(v1alpha1::CascadePolicy::CascadeOnParentTerminal), - operation_id: "operation-1".to_string(), - } -} - -fn parent_terminated() -> v1alpha1::ParentTerminated { - v1alpha1::ParentTerminated { - session_id: "session-1".to_string(), - parent_session_id: "session-0".to_string(), - cause: buffa::EnumValue::from(v1alpha1::ParentTerminalCause::Closed), - triggering_event_id: "event-1".to_string(), - } -} - -fn delegation_detached() -> v1alpha1::DelegationDetached { - v1alpha1::DelegationDetached { - session_id: "session-1".to_string(), - child_session_id: "session-2".to_string(), - reason: None, - detach_operation_id: "operation-1".to_string(), - } -} - -fn parent_history_invalidated() -> v1alpha1::ParentHistoryInvalidated { - v1alpha1::ParentHistoryInvalidated { - session_id: "session-1".to_string(), - parent_session_id: "session-0".to_string(), - parent_keep_through: MessageField::some(session_ordinal(4)), - triggering_event_id: "event-1".to_string(), - } -} - -fn parent_detached() -> v1alpha1::ParentDetached { - v1alpha1::ParentDetached { - session_id: "session-1".to_string(), - parent_session_id: "session-0".to_string(), - detach_operation_id: "operation-1".to_string(), - } -} - -fn external_delegation_dispatched() -> v1alpha1::ExternalDelegationDispatched { - v1alpha1::ExternalDelegationDispatched { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - delegate_reference: "delegate-ref".to_string(), - authenticated_remote_subject: "subject-1".to_string(), - authorization_reference: "authz-ref".to_string(), - request_digest: MessageField::some(digest()), - correlation_id: "correlation-1".to_string(), - } -} - -fn operation_reserved() -> v1alpha1::OperationReserved { - v1alpha1::OperationReserved { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - request_digest: MessageField::some(digest()), - operation_kind: buffa::EnumValue::from(v1alpha1::OperationKind::Tool), - } -} - -fn operation_outcome_recorded() -> v1alpha1::OperationOutcomeRecorded { - v1alpha1::OperationOutcomeRecorded { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - outcome: Some(v1alpha1::operation_outcome_recorded::Outcome::Succeeded(Box::new( - v1alpha1::OperationSucceeded { - response_digest: MessageField::some(digest()), - response_ref: MessageField::some(artifact_ref()), - }, - ))), - } -} - -fn operation_cancellation_requested() -> v1alpha1::OperationCancellationRequested { - v1alpha1::OperationCancellationRequested { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - reason: None, - } -} - -fn artifact_erased() -> v1alpha1::ArtifactErased { - v1alpha1::ArtifactErased { - session_id: "session-1".to_string(), - artifact_id: "artifact-1".to_string(), - reason: None, - } -} - -fn redaction_applied() -> v1alpha1::RedactionApplied { - v1alpha1::RedactionApplied { - session_id: "session-1".to_string(), - redacted_event_ids: vec!["event-1".to_string()], - reason: None, - } -} - -fn system_notice_recorded() -> v1alpha1::SystemNoticeRecorded { - v1alpha1::SystemNoticeRecorded { - session_id: "session-1".to_string(), - level: buffa::EnumValue::from(v1alpha1::NoticeLevel::Info), - text: "notice".to_string(), - tool_call_id: None, - } -} - -fn todo_updated() -> v1alpha1::TodoUpdated { - v1alpha1::TodoUpdated { - session_id: "session-1".to_string(), - items: vec![v1alpha1::TodoItem { - id: "todo-1".to_string(), - content: "write tests".to_string(), - status: buffa::EnumValue::from(v1alpha1::TodoStatus::Pending), - }], - revision: 1, - } -} - -fn session_renamed() -> v1alpha1::SessionRenamed { - v1alpha1::SessionRenamed { - session_id: "session-1".to_string(), - display_name: "New title".to_string(), - } -} - -fn session_archived() -> v1alpha1::SessionArchived { - v1alpha1::SessionArchived { - session_id: "session-1".to_string(), - } -} - -fn session_unarchived() -> v1alpha1::SessionUnarchived { - v1alpha1::SessionUnarchived { - session_id: "session-1".to_string(), - } -} - -fn provider_tool_intent_rejected() -> v1alpha1::ProviderToolIntentRejected { - v1alpha1::ProviderToolIntentRejected { - session_id: "session-1".to_string(), - rejection_id: "rejection-1".to_string(), - message_id: "message-1".to_string(), - turn_id: "turn-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::ProviderToolIntentRejectionReason::MalformedArguments), - claimed_tool_call_id: None, - claimed_tool_name: None, - raw_intent: MessageField::none(), - detail: None, - } -} - -fn all_session_events() -> Vec { - vec![ - v1alpha1::SessionEvent { - event: Some(session_started().into()), - }, - v1alpha1::SessionEvent { - event: Some(session_closed().into()), - }, - v1alpha1::SessionEvent { - event: Some(session_cancelled().into()), - }, - v1alpha1::SessionEvent { - event: Some(session_failed().into()), - }, - v1alpha1::SessionEvent { - event: Some(session_hidden().into()), - }, - v1alpha1::SessionEvent { - event: Some(session_forked().into()), - }, - v1alpha1::SessionEvent { - event: Some(session_rewound().into()), - }, - v1alpha1::SessionEvent { - event: Some(compacted().into()), - }, - v1alpha1::SessionEvent { - event: Some(user_message_recorded().into()), - }, - v1alpha1::SessionEvent { - event: Some(assistant_message_started().into()), - }, - v1alpha1::SessionEvent { - event: Some(assistant_message_completed().into()), - }, - v1alpha1::SessionEvent { - event: Some(assistant_message_failed().into()), - }, - v1alpha1::SessionEvent { - event: Some(tool_call_requested().into()), - }, - v1alpha1::SessionEvent { - event: Some(tool_call_approved().into()), - }, - v1alpha1::SessionEvent { - event: Some(tool_call_denied().into()), - }, - v1alpha1::SessionEvent { - event: Some(tool_call_started().into()), - }, - v1alpha1::SessionEvent { - event: Some(tool_call_completed().into()), - }, - v1alpha1::SessionEvent { - event: Some(tool_call_failed().into()), - }, - v1alpha1::SessionEvent { - event: Some(artifact_recorded().into()), - }, - v1alpha1::SessionEvent { - event: Some(file_changed().into()), - }, - v1alpha1::SessionEvent { - event: Some(execution_attempt_started().into()), - }, - v1alpha1::SessionEvent { - event: Some(execution_attempt_ready().into()), - }, - v1alpha1::SessionEvent { - event: Some(execution_attempt_ended().into()), - }, - v1alpha1::SessionEvent { - event: Some(checkpoint_produced().into()), - }, - v1alpha1::SessionEvent { - event: Some(delegation_dispatched().into()), - }, - v1alpha1::SessionEvent { - event: Some(parent_linked().into()), - }, - v1alpha1::SessionEvent { - event: Some(parent_terminated().into()), - }, - v1alpha1::SessionEvent { - event: Some(delegation_detached().into()), - }, - v1alpha1::SessionEvent { - event: Some(parent_history_invalidated().into()), - }, - v1alpha1::SessionEvent { - event: Some(parent_detached().into()), - }, - v1alpha1::SessionEvent { - event: Some(external_delegation_dispatched().into()), - }, - v1alpha1::SessionEvent { - event: Some(operation_reserved().into()), - }, - v1alpha1::SessionEvent { - event: Some(operation_outcome_recorded().into()), - }, - v1alpha1::SessionEvent { - event: Some(operation_cancellation_requested().into()), - }, - v1alpha1::SessionEvent { - event: Some(artifact_erased().into()), - }, - v1alpha1::SessionEvent { - event: Some(redaction_applied().into()), - }, - v1alpha1::SessionEvent { - event: Some(system_notice_recorded().into()), - }, - v1alpha1::SessionEvent { - event: Some(todo_updated().into()), - }, - v1alpha1::SessionEvent { - event: Some(session_renamed().into()), - }, - v1alpha1::SessionEvent { - event: Some(session_archived().into()), - }, - v1alpha1::SessionEvent { - event: Some(session_unarchived().into()), - }, - v1alpha1::SessionEvent { - event: Some(session_recovered().into()), - }, - v1alpha1::SessionEvent { - event: Some(provider_tool_intent_rejected().into()), - }, - ] -} - -/// Decodes `encoded` back through the concrete inner type named by `event`'s variant, -/// asserts it round-trips to the same value, and returns the variant's generated full name. -fn assert_variant_round_trips(event: &v1alpha1::SessionEvent, encoded: &[u8]) -> &'static str { - match event.event.as_ref().unwrap() { - SessionEventCase::SessionStarted(inner) => { - assert_eq!(v1alpha1::SessionStarted::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::SessionClosed(inner) => { - assert_eq!(v1alpha1::SessionClosed::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::SessionCancelled(inner) => { - assert_eq!(v1alpha1::SessionCancelled::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::SessionFailed(inner) => { - assert_eq!(v1alpha1::SessionFailed::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::SessionHidden(inner) => { - assert_eq!(v1alpha1::SessionHidden::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::SessionForked(inner) => { - assert_eq!(v1alpha1::SessionForked::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::SessionRecovered(inner) => { - assert_eq!(v1alpha1::SessionRecovered::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::SessionRewound(inner) => { - assert_eq!(v1alpha1::SessionRewound::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::Compacted(inner) => { - assert_eq!(v1alpha1::Compacted::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::UserMessageRecorded(inner) => { - assert_eq!( - v1alpha1::UserMessageRecorded::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::AssistantMessageStarted(inner) => { - assert_eq!( - v1alpha1::AssistantMessageStarted::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::AssistantMessageCompleted(inner) => { - assert_eq!( - v1alpha1::AssistantMessageCompleted::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::AssistantMessageFailed(inner) => { - assert_eq!( - v1alpha1::AssistantMessageFailed::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::ToolCallRequested(inner) => { - assert_eq!( - v1alpha1::ToolCallRequested::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::ToolCallApproved(inner) => { - assert_eq!(v1alpha1::ToolCallApproved::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::ToolCallDenied(inner) => { - assert_eq!(v1alpha1::ToolCallDenied::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::ToolCallStarted(inner) => { - assert_eq!(v1alpha1::ToolCallStarted::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::ToolCallCompleted(inner) => { - assert_eq!( - v1alpha1::ToolCallCompleted::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::ToolCallFailed(inner) => { - assert_eq!(v1alpha1::ToolCallFailed::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::ArtifactRecorded(inner) => { - assert_eq!(v1alpha1::ArtifactRecorded::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::FileChanged(inner) => { - assert_eq!(v1alpha1::FileChanged::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::ExecutionAttemptStarted(inner) => { - assert_eq!( - v1alpha1::ExecutionAttemptStarted::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::ExecutionAttemptReady(inner) => { - assert_eq!( - v1alpha1::ExecutionAttemptReady::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::ExecutionAttemptEnded(inner) => { - assert_eq!( - v1alpha1::ExecutionAttemptEnded::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::CheckpointProduced(inner) => { - assert_eq!( - v1alpha1::CheckpointProduced::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::DelegationDispatched(inner) => { - assert_eq!( - v1alpha1::DelegationDispatched::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::ParentLinked(inner) => { - assert_eq!(v1alpha1::ParentLinked::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::ParentTerminated(inner) => { - assert_eq!(v1alpha1::ParentTerminated::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::DelegationDetached(inner) => { - assert_eq!( - v1alpha1::DelegationDetached::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::ParentHistoryInvalidated(inner) => { - assert_eq!( - v1alpha1::ParentHistoryInvalidated::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::ParentDetached(inner) => { - assert_eq!(v1alpha1::ParentDetached::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::ExternalDelegationDispatched(inner) => { - assert_eq!( - v1alpha1::ExternalDelegationDispatched::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::OperationReserved(inner) => { - assert_eq!( - v1alpha1::OperationReserved::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::OperationOutcomeRecorded(inner) => { - assert_eq!( - v1alpha1::OperationOutcomeRecorded::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::OperationCancellationRequested(inner) => { - assert_eq!( - v1alpha1::OperationCancellationRequested::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::ArtifactErased(inner) => { - assert_eq!(v1alpha1::ArtifactErased::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::RedactionApplied(inner) => { - assert_eq!(v1alpha1::RedactionApplied::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::SystemNoticeRecorded(inner) => { - assert_eq!( - v1alpha1::SystemNoticeRecorded::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::TodoUpdated(inner) => { - assert_eq!(v1alpha1::TodoUpdated::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::SessionRenamed(inner) => { - assert_eq!(v1alpha1::SessionRenamed::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::SessionArchived(inner) => { - assert_eq!(v1alpha1::SessionArchived::decode_from_slice(encoded).unwrap(), **inner); - ::FULL_NAME - } - SessionEventCase::SessionUnarchived(inner) => { - assert_eq!( - v1alpha1::SessionUnarchived::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - SessionEventCase::ProviderToolIntentRejected(inner) => { - assert_eq!( - v1alpha1::ProviderToolIntentRejected::decode_from_slice(encoded).unwrap(), - **inner - ); - ::FULL_NAME - } - } -} - -#[test] -fn event_encode_writes_inner_event_payload() { - let inner = session_started(); - let event = v1alpha1::SessionEvent { - event: Some(inner.clone().into()), - }; - - let encoded = EventEncode::encode(&event).unwrap(); - - assert_eq!(v1alpha1::SessionStarted::decode_from_slice(&encoded).unwrap(), inner); -} - -#[test] -fn event_encode_rejects_missing_event_case() { - let event = v1alpha1::SessionEvent { event: None }; - - assert!(matches!( - EventEncode::encode(&event), - Err(SessionEventPayloadError::MissingEvent) - )); -} - -#[test] -fn event_encode_writes_all_lifecycle_event_payloads() { - for event in all_session_events() { - let encoded = EventEncode::encode(&event).unwrap(); - assert_variant_round_trips(&event, &encoded); - } -} - -#[test] -fn event_decode_dispatches_by_generated_full_name() { - let inner = session_started(); - let encoded = inner.encode_to_vec(); - - let decoded = ::decode(EventData::new( - ::FULL_NAME, - &encoded, - )) - .unwrap(); - - let decoded = decoded.into_decoded().unwrap(); - assert!(matches!(decoded.event, Some(SessionEventCase::SessionStarted(_)))); -} - -#[test] -fn event_decode_dispatches_all_lifecycle_event_types() { - for event in all_session_events() { - let encoded = EventEncode::encode(&event).unwrap(); - let full_name = assert_variant_round_trips(&event, &encoded); - - let decoded = ::decode(EventData::new(full_name, &encoded)) - .unwrap() - .into_decoded() - .unwrap(); - - assert_eq!( - std::mem::discriminant(decoded.event.as_ref().unwrap()), - std::mem::discriminant(event.event.as_ref().unwrap()) - ); - } -} - -#[test] -fn event_decode_skips_unknown_event_type() { - assert!(matches!( - ::decode(EventData::new( - "trogonai.session.sessions.v1alpha1.Unknown", - &[] - )), - Ok(EventDecodeOutcome::Skipped) - )); -} - -#[test] -fn event_decode_preserves_payload_decode_errors() { - assert!(matches!( - ::decode(EventData::new( - ::FULL_NAME, - b"\0" - )), - Err(SessionEventPayloadError::Decode(_)) - )); -} - -#[test] -fn event_type_returns_inner_event_full_name() { - let event = v1alpha1::SessionEvent { - event: Some(session_archived().into()), - }; - - assert_eq!( - event.event_type().unwrap(), - ::FULL_NAME - ); -} - -#[test] -fn event_type_returns_all_lifecycle_event_full_names() { - for event in all_session_events() { - let encoded = EventEncode::encode(&event).unwrap(); - let full_name = assert_variant_round_trips(&event, &encoded); - - assert_eq!(event.event_type().unwrap(), full_name); - } -} - -#[test] -fn event_type_rejects_missing_event_case() { - let event = v1alpha1::SessionEvent { event: None }; - - assert!(matches!( - event.event_type(), - Err(SessionEventPayloadError::MissingEvent) - )); -} - -fn assert_round_trips(event: v1alpha1::SessionEvent) { - let encoded = EventEncode::encode(&event).unwrap(); - let full_name = assert_variant_round_trips(&event, &encoded); - - let decoded = ::decode(EventData::new(full_name, &encoded)) - .unwrap() - .into_decoded() - .unwrap(); - - assert_eq!(decoded, event); -} - -#[test] -fn compacted_round_trips_inherited_context_and_auxiliary_model() { - let mut event = compacted(); - event.context_root = MessageField::some(inherited_compaction_context_root()); - event.producer = MessageField::some(v1alpha1::CompactionProducer { - model_role: buffa::EnumValue::from(v1alpha1::CompactionModelRole::AuxiliaryCompaction), - ..compaction_producer() - }); - - assert_round_trips(v1alpha1::SessionEvent { - event: Some(event.into()), - }); -} - -#[test] -fn tool_call_completed_round_trips_termination_duration_and_observations() { - assert_round_trips(v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallCompleted { - detached: MessageField::none(), - accessed: Vec::new(), - failed_targets: Vec::new(), - targets_attempted: None, - termination: MessageField::some(v1alpha1::CommandTermination { - outcome: Some(v1alpha1::command_termination::Outcome::ExitCode(2)), - }), - duration: MessageField::some(buffa_types::google::protobuf::Duration::from_secs_nanos(1, 500_000_000)), - observed: vec![ - v1alpha1::ResourceObservation { - uri: "file:///workspace/src/main.rs".to_string(), - outcome: Some(v1alpha1::resource_observation::Outcome::ContentDigest(Box::new( - digest(), - ))), - range: MessageField::none(), - complete: Some(true), - }, - v1alpha1::ResourceObservation { - uri: "file:///workspace/src/lib.rs".to_string(), - outcome: Some(v1alpha1::resource_observation::Outcome::ContentDigest(Box::new( - digest(), - ))), - range: MessageField::some(v1alpha1::ByteRange { offset: 64, length: 32 }), - complete: Some(false), - }, - ], - ..tool_call_completed() - } - .into(), - ), - }); -} - -#[test] -fn tool_call_completed_round_trips_signal_termination() { - assert_round_trips(v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallCompleted { - detached: MessageField::none(), - accessed: Vec::new(), - failed_targets: Vec::new(), - targets_attempted: None, - termination: MessageField::some(v1alpha1::CommandTermination { - outcome: Some(v1alpha1::command_termination::Outcome::Signal(9)), - }), - ..tool_call_completed() - } - .into(), - ), - }); -} - -#[test] -fn file_changed_round_trips_diff_summary() { - assert_round_trips(v1alpha1::SessionEvent { - event: Some( - v1alpha1::FileChanged { - copied_from: MessageField::none(), - diff: MessageField::some(v1alpha1::DiffSummary { - added_lines: Some(12), - removed_lines: Some(3), - truncated: Some(true), - rendered: MessageField::some(artifact_ref()), - }), - ..file_changed() - } - .into(), - ), - }); -} - -#[test] -fn assistant_message_started_round_trips_model_settings() { - assert_round_trips(v1alpha1::SessionEvent { - event: Some( - v1alpha1::AssistantMessageStarted { - settings: MessageField::some(v1alpha1::ModelSettings { - max_output_tokens: Some(4096), - temperature: Some(0.7), - top_p: Some(0.95), - thinking_budget_tokens: Some(1024), - stop_sequences: vec!["\n\n".to_string()], - raw_settings: MessageField::some(artifact_ref()), - }), - ..assistant_message_started() - } - .into(), - ), - }); -} - -#[test] -fn assistant_message_completed_round_trips_provider_block_and_usage_completeness() { - let message = v1alpha1::CanonicalMessage { - content: vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Provider(Box::new( - v1alpha1::ProviderBlock { - provider: "anthropic".to_string(), - block_type: "server_tool_use".to_string(), - payload: Some(v1alpha1::provider_block::Payload::Inline(b"{}".to_vec())), - }, - ))), - }], - usage: MessageField::some(v1alpha1::TokenUsage { - input_tokens: Some(10), - output_tokens: Some(20), - completeness: Some(buffa::EnumValue::from(v1alpha1::UsageCompleteness::Partial)), - ..Default::default() - }), - ..canonical_message(v1alpha1::MessageRole::Assistant) - }; - - assert_round_trips(v1alpha1::SessionEvent { - event: Some( - v1alpha1::AssistantMessageCompleted { - message: MessageField::some(message), - ..assistant_message_completed() - } - .into(), - ), - }); -} - -#[test] -fn artifact_ref_round_trips_untruncated_size() { - assert_round_trips(v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionClosed { - result_ref: MessageField::some(v1alpha1::ArtifactRef { - untruncated_size_bytes: Some(40 * 1024 * 1024), - ..artifact_ref() - }), - ..session_closed() - } - .into(), - ), - }); -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/session/sessions/mod.rs b/rsworkspace/crates/platform/trogonai-proto/src/session/sessions/mod.rs deleted file mode 100644 index 450309b08..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/session/sessions/mod.rs +++ /dev/null @@ -1,48 +0,0 @@ -mod codec; -mod validate; - -// Thin wrappers that re-export the generated proto packages, emitted as inline -// module trees that mirror the codegen layout. -#[cfg_attr(dylint_lib = "trogon_lints", allow(inline_module_block))] -pub mod artifacts_v1alpha1 { - pub use crate::r#gen::trogonai::session::sessions::artifacts::v1alpha1::*; -} - -#[cfg_attr(dylint_lib = "trogon_lints", allow(inline_module_block))] -pub mod diff_v1alpha1 { - pub use crate::r#gen::trogonai::session::sessions::diff::v1alpha1::*; -} - -#[cfg_attr(dylint_lib = "trogon_lints", allow(inline_module_block))] -pub mod doctor_v1alpha1 { - pub use crate::r#gen::trogonai::session::sessions::doctor::v1alpha1::*; -} - -#[cfg_attr(dylint_lib = "trogon_lints", allow(inline_module_block))] -pub mod maintenance_v1alpha1 { - pub use crate::r#gen::trogonai::session::sessions::maintenance::v1alpha1::*; -} - -#[cfg_attr(dylint_lib = "trogon_lints", allow(inline_module_block))] -pub mod queries_v1alpha1 { - pub use crate::r#gen::trogonai::session::sessions::queries::v1alpha1::*; -} - -#[cfg_attr(dylint_lib = "trogon_lints", allow(inline_module_block))] -pub mod replay_v1alpha1 { - pub use crate::r#gen::trogonai::session::sessions::replay::v1alpha1::*; -} - -#[cfg_attr(dylint_lib = "trogon_lints", allow(inline_module_block))] -pub mod state_v1alpha1 { - pub use crate::r#gen::trogonai::session::sessions::state::v1alpha1::*; -} - -#[cfg_attr(dylint_lib = "trogon_lints", allow(inline_module_block))] -pub mod v1alpha1 { - pub use crate::r#gen::trogonai::session::sessions::v1alpha1::*; -} - -pub use codec::SessionEventPayloadError; -pub use v1alpha1::__buffa::oneof::session_event::Event as SessionEventCase; -pub use validate::{SessionEventValidationError, validate_session_event}; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/session/sessions/validate.rs b/rsworkspace/crates/platform/trogonai-proto/src/session/sessions/validate.rs deleted file mode 100644 index 7424b6293..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/session/sessions/validate.rs +++ /dev/null @@ -1,1050 +0,0 @@ -use super::{SessionEventCase, v1alpha1}; - -/// Local, per-event semantic validation for a [`v1alpha1::SessionEvent`], applied at the -/// append boundary (ADR#0035 facet 3). -/// -/// This checks only what a single event can prove about itself: non-empty identifiers, -/// non-unspecified required enums, required oneofs being set, and internally consistent -/// field combinations (for example a rename requiring `previous_path`). -/// -/// Cross-event obligations are decide-time concerns for the aggregate, not this function, -/// and are intentionally out of scope here: -/// - id joins across a tool or execution-attempt lifecycle's phases -/// - attempt monotonicity and previous-attempt lineage -/// - the started/completed assistant message sharing an id and model -/// - a session's `StoredSessionExecutionPlan` digest matching the plan actually bound -/// - an identifier matching the addressed stream, which requires the stream's own identity -pub fn validate_session_event(event: &v1alpha1::SessionEvent) -> Result<(), SessionEventValidationError> { - let Some(event) = event.event.as_ref() else { - return Err(SessionEventValidationError::MissingOneof { - oneof: "session_event.event", - }); - }; - - match event { - SessionEventCase::SessionStarted(inner) => validate_session_started(inner), - SessionEventCase::SessionClosed(inner) => validate_session_closed(inner), - SessionEventCase::SessionCancelled(inner) => validate_session_cancelled(inner), - SessionEventCase::SessionFailed(inner) => validate_session_failed(inner), - SessionEventCase::SessionHidden(inner) => validate_session_hidden(inner), - SessionEventCase::SessionForked(inner) => validate_session_forked(inner), - SessionEventCase::SessionRecovered(inner) => validate_session_recovered(inner), - SessionEventCase::SessionRewound(inner) => validate_session_rewound(inner), - SessionEventCase::Compacted(inner) => validate_compacted(inner), - SessionEventCase::UserMessageRecorded(inner) => validate_user_message_recorded(inner), - SessionEventCase::AssistantMessageStarted(inner) => validate_assistant_message_started(inner), - SessionEventCase::AssistantMessageCompleted(inner) => validate_assistant_message_completed(inner), - SessionEventCase::AssistantMessageFailed(inner) => validate_assistant_message_failed(inner), - SessionEventCase::ToolCallRequested(inner) => validate_tool_call_requested(inner), - SessionEventCase::ToolCallApproved(inner) => validate_tool_call_approved(inner), - SessionEventCase::ProviderToolIntentRejected(inner) => validate_provider_tool_intent_rejected(inner), - SessionEventCase::ToolCallDenied(inner) => validate_tool_call_denied(inner), - SessionEventCase::ToolCallStarted(inner) => validate_tool_call_started(inner), - SessionEventCase::ToolCallCompleted(inner) => validate_tool_call_completed(inner), - SessionEventCase::ToolCallFailed(inner) => validate_tool_call_failed(inner), - SessionEventCase::ArtifactRecorded(inner) => validate_artifact_recorded(inner), - SessionEventCase::FileChanged(inner) => validate_file_changed(inner), - SessionEventCase::ExecutionAttemptStarted(inner) => validate_execution_attempt_started(inner), - SessionEventCase::ExecutionAttemptReady(inner) => validate_execution_attempt_ready(inner), - SessionEventCase::ExecutionAttemptEnded(inner) => validate_execution_attempt_ended(inner), - SessionEventCase::CheckpointProduced(inner) => validate_checkpoint_produced(inner), - SessionEventCase::DelegationDispatched(inner) => validate_delegation_dispatched(inner), - SessionEventCase::ParentLinked(inner) => validate_parent_linked(inner), - SessionEventCase::ParentTerminated(inner) => validate_parent_terminated(inner), - SessionEventCase::DelegationDetached(inner) => validate_delegation_detached(inner), - SessionEventCase::ParentHistoryInvalidated(inner) => validate_parent_history_invalidated(inner), - SessionEventCase::ParentDetached(inner) => validate_parent_detached(inner), - SessionEventCase::ExternalDelegationDispatched(inner) => validate_external_delegation_dispatched(inner), - SessionEventCase::OperationReserved(inner) => validate_operation_reserved(inner), - SessionEventCase::OperationOutcomeRecorded(inner) => validate_operation_outcome_recorded(inner), - SessionEventCase::OperationCancellationRequested(inner) => validate_operation_cancellation_requested(inner), - SessionEventCase::ArtifactErased(inner) => validate_artifact_erased(inner), - SessionEventCase::RedactionApplied(inner) => validate_redaction_applied(inner), - SessionEventCase::SystemNoticeRecorded(inner) => validate_system_notice_recorded(inner), - SessionEventCase::TodoUpdated(inner) => validate_todo_updated(inner), - SessionEventCase::SessionRenamed(inner) => validate_session_renamed(inner), - SessionEventCase::SessionArchived(inner) => validate_session_archived(inner), - SessionEventCase::SessionUnarchived(inner) => validate_session_unarchived(inner), - } -} - -/// Failure from [`validate_session_event`]. -#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)] -pub enum SessionEventValidationError { - #[error("{field} must not be empty")] - EmptyIdentifier { field: &'static str }, - - #[error("{field} must be a known, non-unspecified enum value")] - UnspecifiedEnum { field: &'static str }, - - #[error("{oneof} must be set")] - MissingOneof { oneof: &'static str }, - - #[error("{field} must be set")] - MissingRequiredField { field: &'static str }, - - #[error("{field} must be {expected}")] - UnexpectedMessageRole { - field: &'static str, - expected: &'static str, - }, - - #[error("previous_path must be set when change_kind is FILE_CHANGE_KIND_RENAMED")] - RenamedFileChangeMissingPreviousPath, - - #[error("previous_path must be unset unless change_kind is FILE_CHANGE_KIND_RENAMED")] - NonRenamedFileChangeHasPreviousPath, - - #[error("covers_through.value ({covers_through}) must be >= covers_from.value ({covers_from})")] - CompactionRangeOutOfOrder { covers_from: u64, covers_through: u64 }, - - #[error("covers_from.value ({covers_from}) must be 1; a compaction covers the whole own-stream prefix")] - CompactionCoversFromNotOwnStreamStart { covers_from: u64 }, - - #[error("{field}.value must be >= 1")] - OrdinalNotPositive { field: &'static str }, - - #[error("matched_stop_sequence must be set when finish_reason is FINISH_REASON_STOP_SEQUENCE")] - MissingMatchedStopSequence, - - #[error("matched_stop_sequence must be unset unless finish_reason is FINISH_REASON_STOP_SEQUENCE")] - UnexpectedMatchedStopSequence, - - #[error("attempt_number must be >= 1")] - AttemptNumberNotPositive, - - #[error("previous_attempt_id must be unset when attempt_number is 1")] - FirstAttemptHasPreviousAttemptId, - - #[error("previous_attempt_id must be set when attempt_number is greater than 1")] - RestartAttemptMissingPreviousAttemptId, - - #[error("todo item id must not be empty")] - EmptyTodoItemId, - - #[error("duplicate todo item id '{id}'")] - DuplicateTodoItemId { id: String }, - - #[error("revision must be >= 1")] - TodoRevisionNotPositive, - - #[error("redacted_event_ids must not be empty")] - EmptyRedactedEventIds, - - #[error("{field}.algorithm must not be empty")] - EmptyDigestAlgorithm { field: &'static str }, - - #[error("{field}.algorithm must be \"sha256\"; v1alpha1 supports no other digest algorithm (ADR#0035 facet 3)")] - UnsupportedDigestAlgorithm { field: &'static str }, - - #[error("{field}.value must be exactly 32 bytes for algorithm sha256, got {actual}")] - Sha256DigestWrongLength { field: &'static str, actual: usize }, - - #[error("restored_checkpoint.session_execution_plan_digest must match session_execution_plan_digest")] - RestoredCheckpointPlanDigestMismatch, - - #[error("omitted_count must be 0 when completeness is COMPLETE, got {actual}")] - CompleteRecoveryWithOmissions { actual: u32 }, - - #[error("omitted_count must be >= 1 when completeness is PARTIAL")] - PartialRecoveryWithoutOmissions, - - #[error("{field} must be well-formed JSON")] - InvalidJson { field: &'static str }, - - #[error("{field} must be set")] - MissingTimestamp { field: &'static str }, - - #[error("{field} must be a valid timestamp")] - InvalidTimestamp { field: &'static str }, - - #[error("{field} must be a valid ISO 4217 currency code")] - InvalidCurrencyCode { field: &'static str }, - - #[error("{field} must be a non-negative duration with nanos below one second")] - InvalidDuration { field: &'static str }, - - #[error("{field} must be a finite number")] - NonFiniteSetting { field: &'static str }, - - #[error("untruncated_size_bytes ({untruncated}) must be greater than size_bytes ({size})")] - UntruncatedSizeNotGreater { size: u64, untruncated: u64 }, - - #[error("diff.rendered must be set when diff.truncated is true")] - TruncatedDiffWithoutRender, - - #[error("{field}.length must be >= 1")] - EmptyByteRange { field: &'static str }, - - #[error("observed[].range must be unset when the resource was absent")] - RangeWithAbsentObservation, -} - -fn require_non_empty(value: &str, field: &'static str) -> Result<(), SessionEventValidationError> { - if value.is_empty() { - Err(SessionEventValidationError::EmptyIdentifier { field }) - } else { - Ok(()) - } -} - -fn require_non_empty_when_set(value: Option<&str>, field: &'static str) -> Result<(), SessionEventValidationError> { - match value { - Some(value) => require_non_empty(value, field), - None => Ok(()), - } -} - -fn require_known_nonzero(value: buffa::EnumValue, field: &'static str) -> Result<(), SessionEventValidationError> -where - E: buffa::Enumeration, -{ - match value.as_known() { - Some(known) if known.to_i32() != 0 => Ok(()), - _ => Err(SessionEventValidationError::UnspecifiedEnum { field }), - } -} - -fn require_positive_ordinal( - ordinal: &v1alpha1::SessionOrdinal, - field: &'static str, -) -> Result<(), SessionEventValidationError> { - if ordinal.value == 0 { - Err(SessionEventValidationError::OrdinalNotPositive { field }) - } else { - Ok(()) - } -} - -fn require_digest(digest: &v1alpha1::Digest, field: &'static str) -> Result<(), SessionEventValidationError> { - if digest.algorithm.is_empty() { - return Err(SessionEventValidationError::EmptyDigestAlgorithm { field }); - } - if digest.algorithm != "sha256" { - return Err(SessionEventValidationError::UnsupportedDigestAlgorithm { field }); - } - if digest.value.len() != 32 { - return Err(SessionEventValidationError::Sha256DigestWrongLength { - field, - actual: digest.value.len(), - }); - } - Ok(()) -} - -fn require_valid_json(value: &str, field: &'static str) -> Result<(), SessionEventValidationError> { - serde_json::from_str::(value) - .map(|_| ()) - .map_err(|_| SessionEventValidationError::InvalidJson { field }) -} - -fn require_valid_timestamp( - timestamp: &buffa_types::google::protobuf::Timestamp, - field: &'static str, -) -> Result<(), SessionEventValidationError> { - crate::convert::datetime_from_timestamp(timestamp) - .map(|_| ()) - .map_err(|_| SessionEventValidationError::InvalidTimestamp { field }) -} - -fn require_set_timestamp>( - timestamp: &buffa::MessageField, - field: &'static str, -) -> Result<(), SessionEventValidationError> { - match timestamp.as_option() { - Some(value) => require_valid_timestamp(value, field), - None => Err(SessionEventValidationError::MissingTimestamp { field }), - } -} - -fn require_valid_duration( - duration: &buffa_types::google::protobuf::Duration, - field: &'static str, -) -> Result<(), SessionEventValidationError> { - crate::convert::std_from_duration(duration) - .map(|_| ()) - .map_err(|_| SessionEventValidationError::InvalidDuration { field }) -} - -fn require_finite(value: f64, field: &'static str) -> Result<(), SessionEventValidationError> { - if value.is_finite() { - Ok(()) - } else { - Err(SessionEventValidationError::NonFiniteSetting { field }) - } -} - -fn require_iso4217_currency_code(code: &str, field: &'static str) -> Result<(), SessionEventValidationError> { - if code.len() == 3 && code.bytes().all(|b| b.is_ascii_uppercase()) { - Ok(()) - } else { - Err(SessionEventValidationError::InvalidCurrencyCode { field }) - } -} - -fn validate_token_usage( - usage: &v1alpha1::TokenUsage, - currency_code_field: &'static str, -) -> Result<(), SessionEventValidationError> { - if let Some(cost) = usage.cost.as_option() { - require_iso4217_currency_code(&cost.currency_code, currency_code_field)?; - } - if let Some(completeness) = usage.completeness { - require_known_nonzero(completeness, "usage.completeness")?; - } - Ok(()) -} - -fn validate_model_settings(settings: &v1alpha1::ModelSettings) -> Result<(), SessionEventValidationError> { - if let Some(temperature) = settings.temperature { - require_finite(temperature, "settings.temperature")?; - } - if let Some(top_p) = settings.top_p { - require_finite(top_p, "settings.top_p")?; - } - for stop_sequence in &settings.stop_sequences { - require_non_empty(stop_sequence, "settings.stop_sequences[]")?; - } - if let Some(raw_settings) = settings.raw_settings.as_option() { - validate_artifact_ref(raw_settings)?; - } - Ok(()) -} - -fn validate_workspace_ref(workspace: &v1alpha1::WorkspaceRef) -> Result<(), SessionEventValidationError> { - require_non_empty(&workspace.workspace_id, "workspace.workspace_id")?; - require_non_empty(&workspace.uri, "workspace.uri") -} - -fn validate_diff_summary(diff: &v1alpha1::DiffSummary) -> Result<(), SessionEventValidationError> { - let rendered = diff.rendered.as_option(); - if diff.truncated == Some(true) && rendered.is_none() { - return Err(SessionEventValidationError::TruncatedDiffWithoutRender); - } - if let Some(rendered) = rendered { - validate_artifact_ref(rendered)?; - } - Ok(()) -} - -fn validate_resource_observation( - observation: &v1alpha1::ResourceObservation, -) -> Result<(), SessionEventValidationError> { - require_non_empty(&observation.uri, "observed[].uri")?; - let range = observation.range.as_option(); - match observation.outcome.as_ref() { - Some(v1alpha1::resource_observation::Outcome::ContentDigest(content_digest)) => { - require_digest(content_digest, "observed[].content_digest")?; - } - Some(v1alpha1::resource_observation::Outcome::Absent(_)) => { - if range.is_some() { - return Err(SessionEventValidationError::RangeWithAbsentObservation); - } - } - None => { - return Err(SessionEventValidationError::MissingOneof { - oneof: "observed[].outcome", - }); - } - } - if let Some(range) = range - && range.length == 0 - { - return Err(SessionEventValidationError::EmptyByteRange { - field: "observed[].range", - }); - } - Ok(()) -} - -fn validate_tool_call_result(result: &v1alpha1::ToolCallResult) -> Result<(), SessionEventValidationError> { - require_known_nonzero(result.status, "result.status")?; - let Some(kind) = result.kind.as_ref() else { - return Err(SessionEventValidationError::MissingOneof { - oneof: "tool_call_result.kind", - }); - }; - match kind { - v1alpha1::tool_call_result::Kind::Text(text) => { - require_non_empty(&text.content, "tool_call_result.text.content") - } - v1alpha1::tool_call_result::Kind::ArtifactRef(artifact_ref) => validate_artifact_ref(artifact_ref), - } -} - -fn validate_canonical_message( - message: &v1alpha1::CanonicalMessage, - field: &'static str, -) -> Result<(), SessionEventValidationError> { - require_non_empty(&message.message_id, field)?; - for block in &message.content { - let Some(kind) = block.kind.as_ref() else { - return Err(SessionEventValidationError::MissingOneof { - oneof: "content_block.kind", - }); - }; - match kind { - v1alpha1::content_block::Kind::Text(_) => {} - v1alpha1::content_block::Kind::ArtifactRef(artifact_ref) => { - validate_artifact_ref(artifact_ref)?; - } - v1alpha1::content_block::Kind::Thinking(thinking) => { - require_non_empty(&thinking.text, "content_block.thinking.text")?; - } - v1alpha1::content_block::Kind::ToolUse(tool_use) => { - require_non_empty(&tool_use.id, "content_block.tool_use.id")?; - require_non_empty(&tool_use.name, "content_block.tool_use.name")?; - require_valid_json(&tool_use.input_json, "content_block.tool_use.input_json")?; - } - v1alpha1::content_block::Kind::ToolResult(tool_result) => { - require_non_empty(&tool_result.tool_use_id, "content_block.tool_result.tool_use_id")?; - validate_tool_call_result(&tool_result.result)?; - } - v1alpha1::content_block::Kind::RedactedThinking(_) => {} - v1alpha1::content_block::Kind::Provider(provider) => { - require_non_empty(&provider.provider, "content_block.provider.provider")?; - require_non_empty(&provider.block_type, "content_block.provider.block_type")?; - let Some(payload) = provider.payload.as_ref() else { - return Err(SessionEventValidationError::MissingOneof { - oneof: "provider_block.payload", - }); - }; - match payload { - v1alpha1::provider_block::Payload::Inline(inline) if inline.is_empty() => { - return Err(SessionEventValidationError::EmptyIdentifier { - field: "content_block.provider.inline", - }); - } - v1alpha1::provider_block::Payload::Inline(_) => {} - v1alpha1::provider_block::Payload::Ref(artifact_ref) => { - validate_artifact_ref(artifact_ref)?; - } - } - } - } - } - if let Some(usage) = message.usage.as_option() { - validate_token_usage(usage, "message.usage.cost.currency_code")?; - } - require_set_timestamp(&message.created_at, "message.created_at")?; - Ok(()) -} - -fn validate_checkpoint(checkpoint: &v1alpha1::Checkpoint) -> Result<(), SessionEventValidationError> { - require_non_empty(&checkpoint.checkpoint_id, "checkpoint.checkpoint_id")?; - require_non_empty(&checkpoint.reference, "checkpoint.reference")?; - require_non_empty(&checkpoint.checkpoint_type, "checkpoint.checkpoint_type")?; - require_non_empty(&checkpoint.implementation_version, "checkpoint.implementation_version")?; - require_non_empty( - &checkpoint.producing_execution_attempt_id, - "checkpoint.producing_execution_attempt_id", - )?; - require_positive_ordinal(&checkpoint.covers_through, "checkpoint.covers_through")?; - require_digest(&checkpoint.digest, "checkpoint.digest")?; - require_digest( - &checkpoint.session_execution_plan_digest, - "checkpoint.session_execution_plan_digest", - )?; - require_non_empty( - &checkpoint.capture_attestation_ref, - "checkpoint.capture_attestation_ref", - )?; - require_digest( - &checkpoint.capture_attestation_digest, - "checkpoint.capture_attestation_digest", - )?; - require_digest( - &checkpoint.effective_history_digest, - "checkpoint.effective_history_digest", - )?; - Ok(()) -} - -fn validate_artifact_ref(artifact_ref: &v1alpha1::ArtifactRef) -> Result<(), SessionEventValidationError> { - require_non_empty(&artifact_ref.artifact_id, "artifact_ref.artifact_id")?; - require_digest(&artifact_ref.digest, "artifact_ref.digest")?; - require_non_empty(&artifact_ref.mime, "artifact_ref.mime")?; - if let Some(untruncated) = artifact_ref.untruncated_size_bytes - && untruncated <= artifact_ref.size_bytes - { - return Err(SessionEventValidationError::UntruncatedSizeNotGreater { - size: artifact_ref.size_bytes, - untruncated, - }); - } - Ok(()) -} - -fn validate_artifact_metadata_source( - source: &v1alpha1::artifact_metadata::Source, -) -> Result<(), SessionEventValidationError> { - match source { - v1alpha1::artifact_metadata::Source::Stored(stored) => { - require_digest(&stored.digest, "artifact_metadata.stored.digest")?; - require_non_empty(&stored.storage_ref, "artifact_metadata.stored.storage_ref")?; - require_non_empty(&stored.mime, "artifact_metadata.stored.mime") - } - v1alpha1::artifact_metadata::Source::External(external) => { - require_non_empty(&external.source_url, "artifact_metadata.external.source_url")?; - if let Some(content_digest) = external.content_digest.as_option() { - require_digest(content_digest, "artifact_metadata.external.content_digest")?; - } - if let Some(fetched_at) = external.fetched_at.as_option() { - require_valid_timestamp(fetched_at, "artifact_metadata.external.fetched_at")?; - } - Ok(()) - } - } -} - -fn validate_operation_outcome( - outcome: &v1alpha1::operation_outcome_recorded::Outcome, -) -> Result<(), SessionEventValidationError> { - match outcome { - v1alpha1::operation_outcome_recorded::Outcome::Succeeded(succeeded) => { - require_digest( - &succeeded.response_digest, - "operation_outcome_recorded.succeeded.response_digest", - )?; - if let Some(response_ref) = succeeded.response_ref.as_option() { - validate_artifact_ref(response_ref)?; - } - Ok(()) - } - v1alpha1::operation_outcome_recorded::Outcome::Failed(failed) => { - require_non_empty(&failed.detail, "operation_outcome_recorded.failed.detail")?; - if let Some(failure_digest) = failed.failure_digest.as_option() { - require_digest(failure_digest, "operation_outcome_recorded.failed.failure_digest")?; - } - Ok(()) - } - v1alpha1::operation_outcome_recorded::Outcome::Cancelled(cancelled) => require_non_empty( - &cancelled.cancelled_by, - "operation_outcome_recorded.cancelled.cancelled_by", - ), - v1alpha1::operation_outcome_recorded::Outcome::Unknown(_) => Ok(()), - } -} - -fn validate_session_started(event: &v1alpha1::SessionStarted) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - if event.execution_plan.plan_bytes.is_empty() { - return Err(SessionEventValidationError::EmptyIdentifier { - field: "execution_plan.plan_bytes", - }); - } - require_digest(&event.execution_plan.plan_digest, "execution_plan.plan_digest")?; - validate_workspace_ref(&event.workspace) -} - -fn validate_session_closed(event: &v1alpha1::SessionClosed) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - if let Some(result_ref) = event.result_ref.as_option() { - validate_artifact_ref(result_ref)?; - } - Ok(()) -} - -fn validate_session_cancelled(event: &v1alpha1::SessionCancelled) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_known_nonzero(event.reason, "reason") -} - -fn validate_session_failed(event: &v1alpha1::SessionFailed) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_known_nonzero(event.reason, "reason") -} - -fn validate_session_hidden(event: &v1alpha1::SessionHidden) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_known_nonzero(event.reason, "reason") -} - -fn validate_session_forked(event: &v1alpha1::SessionForked) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.source_session_id, "source_session_id")?; - require_positive_ordinal(&event.context_prefix_boundary, "context_prefix_boundary")?; - require_known_nonzero(event.reason, "reason") -} - -fn validate_session_recovered(event: &v1alpha1::SessionRecovered) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.source_session_id, "source_session_id")?; - require_positive_ordinal(&event.source_boundary, "source_boundary")?; - let source_digest = event - .source_digest - .as_option() - .ok_or(SessionEventValidationError::MissingRequiredField { field: "source_digest" })?; - require_digest(source_digest, "source_digest")?; - require_non_empty(&event.salvage_key, "salvage_key")?; - require_known_nonzero(event.completeness, "completeness")?; - // A complete recovery that lost something, or a partial one that lost - // nothing, would let a reader draw the opposite conclusion from each field. - match event.completeness.as_known() { - Some(v1alpha1::RecoveryCompleteness::Complete) if event.omitted_count != 0 => { - Err(SessionEventValidationError::CompleteRecoveryWithOmissions { - actual: event.omitted_count, - }) - } - Some(v1alpha1::RecoveryCompleteness::Partial) if event.omitted_count == 0 => { - Err(SessionEventValidationError::PartialRecoveryWithoutOmissions) - } - _ => Ok(()), - } -} - -fn validate_session_rewound(event: &v1alpha1::SessionRewound) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_positive_ordinal(&event.keep_through, "keep_through")?; - require_known_nonzero(event.reason, "reason") -} - -fn validate_compacted(event: &v1alpha1::Compacted) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.summary_id, "summary_id")?; - require_non_empty(&event.summary_content, "summary_content")?; - require_positive_ordinal(&event.covers_from, "covers_from")?; - require_positive_ordinal(&event.covers_through, "covers_through")?; - if event.covers_through.value < event.covers_from.value { - return Err(SessionEventValidationError::CompactionRangeOutOfOrder { - covers_from: event.covers_from.value, - covers_through: event.covers_through.value, - }); - } - if event.covers_from.value != 1 { - return Err(SessionEventValidationError::CompactionCoversFromNotOwnStreamStart { - covers_from: event.covers_from.value, - }); - } - require_known_nonzero(event.trigger, "trigger")?; - require_non_empty_when_set(event.model.as_deref(), "model")?; - if let Some(usage) = event.usage.as_option() { - validate_token_usage(usage, "usage.cost.currency_code")?; - } - let context_root = event - .context_root - .as_option() - .ok_or(SessionEventValidationError::MissingRequiredField { field: "context_root" })?; - validate_compaction_context_root(context_root)?; - let producer = event - .producer - .as_option() - .ok_or(SessionEventValidationError::MissingRequiredField { field: "producer" })?; - validate_compaction_producer(producer)?; - let covered_input_digest = - event - .covered_input_digest - .as_option() - .ok_or(SessionEventValidationError::MissingRequiredField { - field: "covered_input_digest", - })?; - require_digest(covered_input_digest, "covered_input_digest")?; - Ok(()) -} - -fn validate_compaction_context_root( - context_root: &v1alpha1::CompactionContextRoot, -) -> Result<(), SessionEventValidationError> { - match context_root.root.as_ref() { - Some(v1alpha1::compaction_context_root::Root::SessionStart(_)) => Ok(()), - Some(v1alpha1::compaction_context_root::Root::InheritedPrefix(inherited_prefix)) => { - require_non_empty( - &inherited_prefix.source_session_id, - "context_root.inherited_prefix.source_session_id", - )?; - require_positive_ordinal( - &inherited_prefix.context_prefix_boundary, - "context_root.inherited_prefix.context_prefix_boundary", - ) - } - None => Err(SessionEventValidationError::MissingOneof { - oneof: "compaction_context_root.root", - }), - } -} - -fn validate_compaction_producer(producer: &v1alpha1::CompactionProducer) -> Result<(), SessionEventValidationError> { - require_non_empty( - &producer.producing_execution_attempt_id, - "producer.producing_execution_attempt_id", - )?; - let session_execution_plan_digest = producer.session_execution_plan_digest.as_option().ok_or( - SessionEventValidationError::MissingRequiredField { - field: "producer.session_execution_plan_digest", - }, - )?; - require_digest(session_execution_plan_digest, "producer.session_execution_plan_digest")?; - require_known_nonzero(producer.model_role, "producer.model_role") -} - -fn validate_user_message_recorded(event: &v1alpha1::UserMessageRecorded) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.turn_id, "turn_id")?; - validate_canonical_message(&event.message, "message.message_id")?; - if event.message.role != v1alpha1::MessageRole::User { - return Err(SessionEventValidationError::UnexpectedMessageRole { - field: "message.role", - expected: "MESSAGE_ROLE_USER", - }); - } - Ok(()) -} - -fn validate_assistant_message_started( - event: &v1alpha1::AssistantMessageStarted, -) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.message_id, "message_id")?; - require_non_empty(&event.model, "model")?; - require_non_empty(&event.turn_id, "turn_id")?; - if let Some(settings) = event.settings.as_option() { - validate_model_settings(settings)?; - } - Ok(()) -} - -fn validate_assistant_message_completed( - event: &v1alpha1::AssistantMessageCompleted, -) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.turn_id, "turn_id")?; - validate_canonical_message(&event.message, "message.message_id")?; - if event.message.role != v1alpha1::MessageRole::Assistant { - return Err(SessionEventValidationError::UnexpectedMessageRole { - field: "message.role", - expected: "MESSAGE_ROLE_ASSISTANT", - }); - } - require_known_nonzero(event.finish_reason, "finish_reason")?; - - let is_stop_sequence = event.finish_reason == v1alpha1::FinishReason::StopSequence; - let has_matched_stop_sequence = event.matched_stop_sequence.as_deref().is_some_and(|s| !s.is_empty()); - match (is_stop_sequence, has_matched_stop_sequence) { - (true, false) => Err(SessionEventValidationError::MissingMatchedStopSequence), - (false, true) => Err(SessionEventValidationError::UnexpectedMatchedStopSequence), - _ => Ok(()), - } -} - -fn validate_assistant_message_failed( - event: &v1alpha1::AssistantMessageFailed, -) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.message_id, "message_id")?; - require_non_empty(&event.turn_id, "turn_id")?; - require_known_nonzero(event.reason, "reason")?; - if let Some(usage) = event.usage.as_option() { - validate_token_usage(usage, "usage.cost.currency_code")?; - } - Ok(()) -} - -fn validate_tool_call_requested(event: &v1alpha1::ToolCallRequested) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.tool_call_id, "tool_call_id")?; - require_non_empty(&event.tool_execution_id, "tool_execution_id")?; - require_non_empty(&event.tool_name, "tool_name")?; - require_non_empty(&event.turn_id, "turn_id")?; - require_valid_json(&event.input_json, "input_json") -} - -fn validate_tool_call_approved(event: &v1alpha1::ToolCallApproved) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.tool_call_id, "tool_call_id")?; - require_non_empty(&event.tool_execution_id, "tool_execution_id")?; - require_non_empty(&event.approved_by, "approved_by")?; - require_non_empty_when_set(event.turn_id.as_deref(), "turn_id") -} - -fn validate_tool_call_denied(event: &v1alpha1::ToolCallDenied) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.tool_call_id, "tool_call_id")?; - require_non_empty(&event.tool_execution_id, "tool_execution_id")?; - require_non_empty(&event.denied_by, "denied_by")?; - require_non_empty_when_set(event.turn_id.as_deref(), "turn_id") -} - -fn validate_tool_call_started(event: &v1alpha1::ToolCallStarted) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.tool_call_id, "tool_call_id")?; - require_non_empty(&event.tool_execution_id, "tool_execution_id")?; - require_non_empty(&event.turn_id, "turn_id") -} - -fn validate_tool_call_completed(event: &v1alpha1::ToolCallCompleted) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.tool_call_id, "tool_call_id")?; - require_non_empty(&event.tool_execution_id, "tool_execution_id")?; - require_non_empty(&event.turn_id, "turn_id")?; - validate_tool_call_result(&event.result)?; - if let Some(termination) = event.termination.as_option() - && termination.outcome.is_none() - { - return Err(SessionEventValidationError::MissingOneof { - oneof: "command_termination.outcome", - }); - } - if let Some(duration) = event.duration.as_option() { - require_valid_duration(duration, "duration")?; - } - for observation in &event.observed { - validate_resource_observation(observation)?; - } - Ok(()) -} - -fn validate_tool_call_failed(event: &v1alpha1::ToolCallFailed) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.tool_call_id, "tool_call_id")?; - require_non_empty(&event.tool_execution_id, "tool_execution_id")?; - require_non_empty(&event.error, "error")?; - require_non_empty(&event.turn_id, "turn_id")?; - require_known_nonzero(event.reason, "reason") -} - -fn validate_artifact_recorded(event: &v1alpha1::ArtifactRecorded) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.artifact.artifact_id, "artifact.artifact_id")?; - require_set_timestamp(&event.artifact.created_at, "artifact.created_at")?; - let Some(source) = event.artifact.source.as_ref() else { - return Err(SessionEventValidationError::MissingOneof { - oneof: "artifact_metadata.source", - }); - }; - validate_artifact_metadata_source(source) -} - -fn validate_file_changed(event: &v1alpha1::FileChanged) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.path, "path")?; - require_non_empty(&event.tool_call_id, "tool_call_id")?; - require_non_empty(&event.turn_id, "turn_id")?; - require_known_nonzero(event.change_kind, "change_kind")?; - - let is_renamed = event.change_kind == v1alpha1::FileChangeKind::Renamed; - let has_previous_path = event.previous_path.as_deref().is_some_and(|s| !s.is_empty()); - match (is_renamed, has_previous_path) { - (true, false) => return Err(SessionEventValidationError::RenamedFileChangeMissingPreviousPath), - (false, true) => return Err(SessionEventValidationError::NonRenamedFileChangeHasPreviousPath), - _ => {} - } - - if let Some(before_ref) = event.before_ref.as_option() { - validate_artifact_ref(before_ref)?; - } - if let Some(after_ref) = event.after_ref.as_option() { - validate_artifact_ref(after_ref)?; - } - if let Some(diff) = event.diff.as_option() { - validate_diff_summary(diff)?; - } - Ok(()) -} - -fn validate_execution_attempt_started( - event: &v1alpha1::ExecutionAttemptStarted, -) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.execution_attempt_id, "execution_attempt_id")?; - require_non_empty(&event.host_artifact_ref, "host_artifact_ref")?; - require_digest(&event.session_execution_plan_digest, "session_execution_plan_digest")?; - require_digest(&event.host_artifact_digest, "host_artifact_digest")?; - if event.attempt_number < 1 { - return Err(SessionEventValidationError::AttemptNumberNotPositive); - } - let has_previous_attempt_id = event.previous_attempt_id.as_deref().is_some_and(|s| !s.is_empty()); - match (event.attempt_number == 1, has_previous_attempt_id) { - (true, true) => return Err(SessionEventValidationError::FirstAttemptHasPreviousAttemptId), - (false, false) => return Err(SessionEventValidationError::RestartAttemptMissingPreviousAttemptId), - _ => {} - } - if let Some(checkpoint) = event.restored_checkpoint.as_option() { - validate_checkpoint(checkpoint)?; - if checkpoint.session_execution_plan_digest.as_option() != event.session_execution_plan_digest.as_option() { - return Err(SessionEventValidationError::RestoredCheckpointPlanDigestMismatch); - } - } - require_set_timestamp(&event.started_at, "started_at") -} - -fn validate_execution_attempt_ready( - event: &v1alpha1::ExecutionAttemptReady, -) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.execution_attempt_id, "execution_attempt_id")?; - require_non_empty(&event.ready_attestation_ref, "ready_attestation_ref")?; - require_digest(&event.ready_attestation_digest, "ready_attestation_digest")?; - require_set_timestamp(&event.ready_at, "ready_at") -} - -fn validate_execution_attempt_ended( - event: &v1alpha1::ExecutionAttemptEnded, -) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.execution_attempt_id, "execution_attempt_id")?; - require_known_nonzero(event.outcome, "outcome")?; - require_set_timestamp(&event.ended_at, "ended_at") -} - -fn validate_checkpoint_produced(event: &v1alpha1::CheckpointProduced) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - validate_checkpoint(&event.checkpoint) -} - -fn validate_delegation_dispatched(event: &v1alpha1::DelegationDispatched) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.operation_id, "operation_id")?; - require_non_empty(&event.child_session_id, "child_session_id")?; - require_known_nonzero(event.cascade_policy, "cascade_policy") -} - -fn validate_parent_linked(event: &v1alpha1::ParentLinked) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.parent_session_id, "parent_session_id")?; - require_non_empty(&event.operation_id, "operation_id")?; - require_positive_ordinal(&event.parent_dispatched_at, "parent_dispatched_at")?; - require_known_nonzero(event.cascade_policy, "cascade_policy") -} - -fn validate_parent_terminated(event: &v1alpha1::ParentTerminated) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.parent_session_id, "parent_session_id")?; - require_non_empty(&event.triggering_event_id, "triggering_event_id")?; - require_known_nonzero(event.cause, "cause") -} - -fn validate_delegation_detached(event: &v1alpha1::DelegationDetached) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.child_session_id, "child_session_id")?; - require_non_empty(&event.detach_operation_id, "detach_operation_id") -} - -fn validate_parent_history_invalidated( - event: &v1alpha1::ParentHistoryInvalidated, -) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.parent_session_id, "parent_session_id")?; - require_non_empty(&event.triggering_event_id, "triggering_event_id")?; - require_positive_ordinal(&event.parent_keep_through, "parent_keep_through") -} - -fn validate_parent_detached(event: &v1alpha1::ParentDetached) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.parent_session_id, "parent_session_id")?; - require_non_empty(&event.detach_operation_id, "detach_operation_id") -} - -fn validate_external_delegation_dispatched( - event: &v1alpha1::ExternalDelegationDispatched, -) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.operation_id, "operation_id")?; - require_non_empty(&event.delegate_reference, "delegate_reference")?; - require_non_empty(&event.authenticated_remote_subject, "authenticated_remote_subject")?; - require_non_empty(&event.authorization_reference, "authorization_reference")?; - require_non_empty(&event.correlation_id, "correlation_id")?; - require_digest(&event.request_digest, "request_digest") -} - -fn validate_operation_reserved(event: &v1alpha1::OperationReserved) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.operation_id, "operation_id")?; - require_known_nonzero(event.operation_kind, "operation_kind")?; - require_digest(&event.request_digest, "request_digest") -} - -fn validate_operation_outcome_recorded( - event: &v1alpha1::OperationOutcomeRecorded, -) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.operation_id, "operation_id")?; - let Some(outcome) = event.outcome.as_ref() else { - return Err(SessionEventValidationError::MissingOneof { - oneof: "operation_outcome_recorded.outcome", - }); - }; - validate_operation_outcome(outcome) -} - -fn validate_operation_cancellation_requested( - event: &v1alpha1::OperationCancellationRequested, -) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.operation_id, "operation_id") -} - -fn validate_artifact_erased(event: &v1alpha1::ArtifactErased) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.artifact_id, "artifact_id") -} - -fn validate_redaction_applied(event: &v1alpha1::RedactionApplied) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - if event.redacted_event_ids.is_empty() { - return Err(SessionEventValidationError::EmptyRedactedEventIds); - } - for (index, id) in event.redacted_event_ids.iter().enumerate() { - if id.is_empty() { - return Err(SessionEventValidationError::EmptyIdentifier { - field: if index == 0 { - "redacted_event_ids[0]" - } else { - "redacted_event_ids[n]" - }, - }); - } - } - Ok(()) -} - -fn validate_system_notice_recorded(event: &v1alpha1::SystemNoticeRecorded) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.text, "text")?; - require_known_nonzero(event.level, "level") -} - -fn validate_todo_updated(event: &v1alpha1::TodoUpdated) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - if event.revision < 1 { - return Err(SessionEventValidationError::TodoRevisionNotPositive); - } - - let mut seen_ids = std::collections::HashSet::with_capacity(event.items.len()); - for item in &event.items { - if item.id.is_empty() { - return Err(SessionEventValidationError::EmptyTodoItemId); - } - if !seen_ids.insert(item.id.as_str()) { - return Err(SessionEventValidationError::DuplicateTodoItemId { id: item.id.clone() }); - } - require_non_empty(&item.content, "items[].content")?; - require_known_nonzero(item.status, "items[].status")?; - } - Ok(()) -} - -fn validate_provider_tool_intent_rejected( - event: &v1alpha1::ProviderToolIntentRejected, -) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.rejection_id, "rejection_id")?; - require_non_empty(&event.message_id, "message_id")?; - require_non_empty(&event.turn_id, "turn_id")?; - require_known_nonzero(event.reason, "reason") -} - -fn validate_session_renamed(event: &v1alpha1::SessionRenamed) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id")?; - require_non_empty(&event.display_name, "display_name") -} - -fn validate_session_archived(event: &v1alpha1::SessionArchived) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id") -} - -fn validate_session_unarchived(event: &v1alpha1::SessionUnarchived) -> Result<(), SessionEventValidationError> { - require_non_empty(&event.session_id, "session_id") -} - -#[cfg(test)] -mod tests; diff --git a/rsworkspace/crates/platform/trogonai-proto/src/session/sessions/validate/tests.rs b/rsworkspace/crates/platform/trogonai-proto/src/session/sessions/validate/tests.rs deleted file mode 100644 index 3abead881..000000000 --- a/rsworkspace/crates/platform/trogonai-proto/src/session/sessions/validate/tests.rs +++ /dev/null @@ -1,5505 +0,0 @@ -use buffa::MessageField; - -use super::*; - -fn digest() -> v1alpha1::Digest { - v1alpha1::Digest { - algorithm: "sha256".to_string(), - value: vec![0u8; 32], - } -} - -fn session_ordinal(value: u64) -> v1alpha1::SessionOrdinal { - v1alpha1::SessionOrdinal { value } -} - -fn compaction_session_start_root() -> v1alpha1::CompactionContextRoot { - v1alpha1::CompactionContextRoot { - root: Some(v1alpha1::compaction_context_root::Root::SessionStart(Box::new( - v1alpha1::CompactionSessionStart {}, - ))), - } -} - -fn compaction_inherited_prefix_root( - source_session_id: &str, - context_prefix_boundary: u64, -) -> v1alpha1::CompactionContextRoot { - v1alpha1::CompactionContextRoot { - root: Some(v1alpha1::compaction_context_root::Root::InheritedPrefix(Box::new( - v1alpha1::CompactionInheritedPrefix { - source_session_id: source_session_id.to_string(), - context_prefix_boundary: MessageField::some(session_ordinal(context_prefix_boundary)), - }, - ))), - } -} - -fn compaction_producer() -> v1alpha1::CompactionProducer { - v1alpha1::CompactionProducer { - producing_execution_attempt_id: "attempt-1".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - model_role: buffa::EnumValue::from(v1alpha1::CompactionModelRole::Primary), - } -} - -fn compacted() -> v1alpha1::Compacted { - v1alpha1::Compacted { - session_id: "session-1".to_string(), - summary_id: "summary-1".to_string(), - summary_content: "summary".to_string(), - covers_from: MessageField::some(session_ordinal(1)), - covers_through: MessageField::some(session_ordinal(5)), - trigger: buffa::EnumValue::from(v1alpha1::CompactionTrigger::Manual), - guidance: None, - tokens_before: None, - tokens_after: None, - model: Some("model".to_string()), - usage: MessageField::none(), - context_root: MessageField::some(compaction_session_start_root()), - producer: MessageField::some(compaction_producer()), - covered_input_digest: MessageField::some(digest()), - } -} - -fn workspace_ref() -> v1alpha1::WorkspaceRef { - v1alpha1::WorkspaceRef { - workspace_id: "workspace-1".to_string(), - uri: "file:///workspace".to_string(), - revision: None, - } -} - -fn session_started() -> v1alpha1::SessionStarted { - v1alpha1::SessionStarted { - session_id: "session-1".to_string(), - execution_plan: MessageField::some(v1alpha1::StoredSessionExecutionPlan { - plan_bytes: b"plan".to_vec(), - plan_digest: MessageField::some(digest()), - }), - workspace: MessageField::some(workspace_ref()), - } -} - -fn assistant_message_started() -> v1alpha1::AssistantMessageStarted { - v1alpha1::AssistantMessageStarted { - session_id: "session-1".to_string(), - message_id: "message-1".to_string(), - model: "model".to_string(), - settings: MessageField::none(), - turn_id: "turn-1".to_string(), - } -} - -fn tool_call_completed() -> v1alpha1::ToolCallCompleted { - v1alpha1::ToolCallCompleted { - detached: MessageField::none(), - accessed: Vec::new(), - failed_targets: Vec::new(), - targets_attempted: None, - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - result: MessageField::some(v1alpha1::ToolCallResult { - status: buffa::EnumValue::from(v1alpha1::ToolCallResultStatus::Success), - kind: Some(v1alpha1::tool_call_result::Kind::Text(Box::new( - v1alpha1::TextToolResult { - content: "done".to_string(), - truncated: None, - }, - ))), - }), - turn_id: "turn-1".to_string(), - termination: MessageField::none(), - output_replay: MessageField::none(), - duration: MessageField::none(), - observed: Vec::new(), - } -} - -fn file_changed() -> v1alpha1::FileChanged { - v1alpha1::FileChanged { - copied_from: MessageField::none(), - session_id: "session-1".to_string(), - path: "src/new.rs".to_string(), - change_kind: buffa::EnumValue::from(v1alpha1::FileChangeKind::Modified), - previous_path: None, - before_ref: MessageField::none(), - after_ref: MessageField::none(), - tool_call_id: "tool-call-1".to_string(), - turn_id: "turn-1".to_string(), - diff: MessageField::none(), - } -} - -fn resource_observation() -> v1alpha1::ResourceObservation { - v1alpha1::ResourceObservation { - uri: "file:///workspace/src/new.rs".to_string(), - outcome: Some(v1alpha1::resource_observation::Outcome::ContentDigest(Box::new( - digest(), - ))), - range: MessageField::none(), - complete: Some(true), - } -} - -fn event_of(event: impl Into) -> v1alpha1::SessionEvent { - v1alpha1::SessionEvent { - event: Some(event.into()), - } -} - -fn assistant_message() -> v1alpha1::CanonicalMessage { - v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(v1alpha1::MessageRole::Assistant), - content: vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Text("hi".to_string())), - }], - model: None, - usage: MessageField::none(), - created_at: MessageField::some(valid_timestamp()), - } -} - -fn artifact_ref() -> v1alpha1::ArtifactRef { - v1alpha1::ArtifactRef { - artifact_id: "artifact-1".to_string(), - digest: MessageField::some(digest()), - size_bytes: 128, - mime: "text/plain".to_string(), - preview: None, - truncated: None, - untruncated_size_bytes: None, - } -} - -fn checkpoint() -> v1alpha1::Checkpoint { - v1alpha1::Checkpoint { - reference: "checkpoint-ref".to_string(), - checkpoint_type: "full".to_string(), - digest: MessageField::some(digest()), - implementation_version: "v1".to_string(), - checkpoint_id: "checkpoint-1".to_string(), - producing_execution_attempt_id: "attempt-1".to_string(), - covers_through: MessageField::some(session_ordinal(1)), - session_execution_plan_digest: MessageField::some(digest()), - capture_attestation_ref: "attestation-ref".to_string(), - capture_attestation_digest: MessageField::some(digest()), - effective_history_digest: MessageField::some(digest()), - } -} - -fn valid_timestamp() -> buffa_types::google::protobuf::Timestamp { - buffa_types::google::protobuf::Timestamp::from_unix(1_700_000_000, 0) -} - -fn invalid_timestamp() -> buffa_types::google::protobuf::Timestamp { - let mut timestamp = buffa_types::google::protobuf::Timestamp::from_unix(0, 0); - timestamp.nanos = -1; - timestamp -} - -fn token_usage_with_currency(currency_code: &str) -> v1alpha1::TokenUsage { - v1alpha1::TokenUsage { - input_tokens: None, - output_tokens: None, - cache_creation_tokens: None, - cache_read_tokens: None, - cost: MessageField::some(v1alpha1::Cost { - amount_micros: 1_000_000, - currency_code: currency_code.to_string(), - rate_ref: None, - }), - completeness: None, - } -} - -fn user_message_event(content: Vec) -> v1alpha1::SessionEvent { - v1alpha1::SessionEvent { - event: Some( - v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(v1alpha1::MessageRole::User), - content, - model: None, - usage: MessageField::none(), - created_at: MessageField::some(valid_timestamp()), - }), - turn_id: "turn-1".to_string(), - } - .into(), - ), - } -} - -#[test] -fn validate_session_event_rejects_missing_event_case() { - let event = v1alpha1::SessionEvent { event: None }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingOneof { - oneof: "session_event.event" - }) - ); -} - -#[test] -fn validate_session_event_accepts_valid_session_started() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionStarted { - session_id: "session-1".to_string(), - execution_plan: MessageField::some(v1alpha1::StoredSessionExecutionPlan { - plan_bytes: b"plan".to_vec(), - plan_digest: MessageField::some(digest()), - }), - workspace: MessageField::some(workspace_ref()), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_session_closed_rejects_empty_session_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionClosed { - session_id: String::new(), - result_ref: MessageField::none(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { field: "session_id" }) - ); -} - -#[test] -fn validate_session_cancelled_rejects_unspecified_reason() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionCancelled { - session_id: "session-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::SessionCancellationReason::Unspecified), - detail: None, - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { field: "reason" }) - ); -} - -#[test] -fn validate_session_cancelled_accepts_known_reason() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionCancelled { - session_id: "session-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::SessionCancellationReason::UserRequested), - detail: None, - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_user_message_recorded_rejects_missing_content_block_kind() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(v1alpha1::MessageRole::User), - content: vec![v1alpha1::ContentBlock { kind: None }], - model: None, - usage: MessageField::none(), - created_at: MessageField::some(valid_timestamp()), - }), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingOneof { - oneof: "content_block.kind" - }) - ); -} - -#[test] -fn validate_tool_call_completed_rejects_missing_result_kind() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallCompleted { - detached: MessageField::none(), - accessed: Vec::new(), - failed_targets: Vec::new(), - targets_attempted: None, - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - result: MessageField::some(v1alpha1::ToolCallResult { - status: buffa::EnumValue::from(v1alpha1::ToolCallResultStatus::Success), - kind: None, - }), - duration: MessageField::none(), - observed: Vec::new(), - termination: MessageField::none(), - turn_id: "turn-1".to_string(), - output_replay: MessageField::none(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingOneof { - oneof: "tool_call_result.kind" - }) - ); -} - -#[test] -fn validate_artifact_recorded_rejects_missing_artifact_source() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(valid_timestamp()), - source: None, - }), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingOneof { - oneof: "artifact_metadata.source" - }) - ); -} - -#[test] -fn validate_operation_outcome_recorded_rejects_missing_outcome() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationOutcomeRecorded { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - outcome: None, - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingOneof { - oneof: "operation_outcome_recorded.outcome" - }) - ); -} - -#[test] -fn validate_user_message_recorded_rejects_assistant_role() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(assistant_message()), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnexpectedMessageRole { - field: "message.role", - expected: "MESSAGE_ROLE_USER", - }) - ); -} - -#[test] -fn validate_assistant_message_completed_rejects_user_role() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::AssistantMessageCompleted { - session_id: "session-1".to_string(), - message: MessageField::some(v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(v1alpha1::MessageRole::User), - content: vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Text("hi".to_string())), - }], - model: None, - usage: MessageField::none(), - created_at: MessageField::some(valid_timestamp()), - }), - finish_reason: buffa::EnumValue::from(v1alpha1::FinishReason::EndTurn), - matched_stop_sequence: None, - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnexpectedMessageRole { - field: "message.role", - expected: "MESSAGE_ROLE_ASSISTANT", - }) - ); -} - -#[test] -fn validate_file_changed_rejects_renamed_without_previous_path() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::FileChanged { - copied_from: MessageField::none(), - session_id: "session-1".to_string(), - path: "src/new.rs".to_string(), - change_kind: buffa::EnumValue::from(v1alpha1::FileChangeKind::Renamed), - previous_path: None, - before_ref: MessageField::none(), - after_ref: MessageField::none(), - diff: MessageField::none(), - tool_call_id: "tool-call-1".to_string(), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::RenamedFileChangeMissingPreviousPath) - ); -} - -#[test] -fn validate_file_changed_rejects_non_renamed_with_previous_path() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::FileChanged { - copied_from: MessageField::none(), - session_id: "session-1".to_string(), - path: "src/new.rs".to_string(), - change_kind: buffa::EnumValue::from(v1alpha1::FileChangeKind::Modified), - previous_path: Some("src/old.rs".to_string()), - before_ref: MessageField::none(), - after_ref: MessageField::none(), - diff: MessageField::none(), - tool_call_id: "tool-call-1".to_string(), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::NonRenamedFileChangeHasPreviousPath) - ); -} - -#[test] -fn validate_file_changed_accepts_renamed_with_previous_path() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::FileChanged { - copied_from: MessageField::none(), - session_id: "session-1".to_string(), - path: "src/new.rs".to_string(), - change_kind: buffa::EnumValue::from(v1alpha1::FileChangeKind::Renamed), - previous_path: Some("src/old.rs".to_string()), - before_ref: MessageField::none(), - after_ref: MessageField::none(), - diff: MessageField::none(), - tool_call_id: "tool-call-1".to_string(), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_compacted_rejects_empty_summary_content() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::Compacted { - summary_content: String::new(), - ..compacted() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "summary_content" - }) - ); -} - -#[test] -fn validate_compacted_rejects_range_out_of_order() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::Compacted { - covers_from: MessageField::some(session_ordinal(5)), - covers_through: MessageField::some(session_ordinal(1)), - ..compacted() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::CompactionRangeOutOfOrder { - covers_from: 5, - covers_through: 1 - }) - ); -} - -#[test] -fn validate_compacted_rejects_covers_from_past_own_stream_start() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::Compacted { - covers_from: MessageField::some(session_ordinal(2)), - ..compacted() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::CompactionCoversFromNotOwnStreamStart { covers_from: 2 }) - ); -} - -#[test] -fn validate_compacted_accepts_in_order_range() { - let event = v1alpha1::SessionEvent { - event: Some(compacted().into()), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_compacted_rejects_missing_context_root_arm() { - let mut event = compacted(); - event.context_root = MessageField::some(v1alpha1::CompactionContextRoot { root: None }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::MissingOneof { - oneof: "compaction_context_root.root" - }) - ); -} - -#[test] -fn validate_compacted_rejects_missing_context_root() { - let mut event = compacted(); - event.context_root = MessageField::none(); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::MissingRequiredField { field: "context_root" }) - ); -} - -#[test] -fn validate_compacted_rejects_empty_inherited_source_session_id() { - let mut event = compacted(); - event.context_root = MessageField::some(compaction_inherited_prefix_root("", 3)); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { - field: "context_root.inherited_prefix.source_session_id" - }) - ); -} - -#[test] -fn validate_compacted_rejects_zero_inherited_context_prefix_boundary() { - let mut event = compacted(); - event.context_root = MessageField::some(compaction_inherited_prefix_root("session-0", 0)); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::OrdinalNotPositive { - field: "context_root.inherited_prefix.context_prefix_boundary" - }) - ); -} - -#[test] -fn validate_compacted_accepts_inherited_context_and_auxiliary_model() { - let mut event = compacted(); - event.context_root = MessageField::some(compaction_inherited_prefix_root("session-0", 3)); - event.producer = MessageField::some(v1alpha1::CompactionProducer { - model_role: buffa::EnumValue::from(v1alpha1::CompactionModelRole::AuxiliaryCompaction), - ..compaction_producer() - }); - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_compacted_rejects_empty_producing_execution_attempt_id() { - let mut event = compacted(); - event.producer = MessageField::some(v1alpha1::CompactionProducer { - producing_execution_attempt_id: String::new(), - ..compaction_producer() - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { - field: "producer.producing_execution_attempt_id" - }) - ); -} - -#[test] -fn validate_compacted_rejects_missing_producer() { - let mut event = compacted(); - event.producer = MessageField::none(); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::MissingRequiredField { field: "producer" }) - ); -} - -#[test] -fn validate_compacted_rejects_missing_plan_digest() { - let mut event = compacted(); - event.producer = MessageField::some(v1alpha1::CompactionProducer { - session_execution_plan_digest: MessageField::none(), - ..compaction_producer() - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::MissingRequiredField { - field: "producer.session_execution_plan_digest" - }) - ); -} - -#[test] -fn validate_compacted_rejects_invalid_plan_digest() { - let mut event = compacted(); - event.producer = MessageField::some(v1alpha1::CompactionProducer { - session_execution_plan_digest: MessageField::some(v1alpha1::Digest { - algorithm: "sha256".to_string(), - value: vec![0; 31], - }), - ..compaction_producer() - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::Sha256DigestWrongLength { - field: "producer.session_execution_plan_digest", - actual: 31 - }) - ); -} - -#[test] -fn validate_compacted_rejects_unspecified_model_role() { - let mut event = compacted(); - event.producer = MessageField::some(v1alpha1::CompactionProducer { - model_role: buffa::EnumValue::from(v1alpha1::CompactionModelRole::Unspecified), - ..compaction_producer() - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::UnspecifiedEnum { - field: "producer.model_role" - }) - ); -} - -#[test] -fn validate_compacted_rejects_unknown_model_role() { - let mut event = compacted(); - event.producer = MessageField::some(v1alpha1::CompactionProducer { - model_role: buffa::EnumValue::from(99), - ..compaction_producer() - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::UnspecifiedEnum { - field: "producer.model_role" - }) - ); -} - -#[test] -fn validate_compacted_accepts_missing_model_attribution() { - let mut event = compacted(); - event.model = None; - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_compacted_rejects_empty_model_attribution() { - let mut event = compacted(); - event.model = Some(String::new()); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "model" }) - ); -} - -#[test] -fn validate_compacted_rejects_missing_covered_input_digest() { - let mut event = compacted(); - event.covered_input_digest = MessageField::none(); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::MissingRequiredField { - field: "covered_input_digest" - }) - ); -} - -#[test] -fn validate_compacted_rejects_invalid_covered_input_digest() { - let mut event = compacted(); - event.covered_input_digest = MessageField::some(v1alpha1::Digest { - algorithm: "sha256".to_string(), - value: vec![0; 31], - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::Sha256DigestWrongLength { - field: "covered_input_digest", - actual: 31 - }) - ); -} - -#[test] -fn validate_session_forked_rejects_zero_context_prefix_boundary() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionForked { - session_id: "session-1".to_string(), - source_session_id: "session-0".to_string(), - context_prefix_boundary: MessageField::some(session_ordinal(0)), - reason: buffa::EnumValue::from(v1alpha1::ForkReason::ManualBranch), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::OrdinalNotPositive { - field: "context_prefix_boundary" - }) - ); -} - -#[test] -fn validate_assistant_message_completed_rejects_missing_matched_stop_sequence() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::AssistantMessageCompleted { - session_id: "session-1".to_string(), - message: MessageField::some(assistant_message()), - finish_reason: buffa::EnumValue::from(v1alpha1::FinishReason::StopSequence), - matched_stop_sequence: None, - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingMatchedStopSequence) - ); -} - -#[test] -fn validate_assistant_message_completed_rejects_unexpected_matched_stop_sequence() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::AssistantMessageCompleted { - session_id: "session-1".to_string(), - message: MessageField::some(assistant_message()), - finish_reason: buffa::EnumValue::from(v1alpha1::FinishReason::EndTurn), - matched_stop_sequence: Some("STOP".to_string()), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnexpectedMatchedStopSequence) - ); -} - -#[test] -fn validate_assistant_message_completed_accepts_stop_sequence_with_match() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::AssistantMessageCompleted { - session_id: "session-1".to_string(), - message: MessageField::some(assistant_message()), - finish_reason: buffa::EnumValue::from(v1alpha1::FinishReason::StopSequence), - matched_stop_sequence: Some("STOP".to_string()), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_execution_attempt_started_rejects_zero_attempt_number() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 0, - previous_attempt_id: None, - restored_checkpoint: MessageField::none(), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::AttemptNumberNotPositive) - ); -} - -#[test] -fn validate_execution_attempt_started_accepts_positive_attempt_number() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 1, - previous_attempt_id: None, - restored_checkpoint: MessageField::none(), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_todo_updated_rejects_empty_item_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::TodoUpdated { - session_id: "session-1".to_string(), - items: vec![v1alpha1::TodoItem { - id: String::new(), - content: "write tests".to_string(), - status: buffa::EnumValue::from(v1alpha1::TodoStatus::Pending), - }], - revision: 1, - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyTodoItemId) - ); -} - -#[test] -fn validate_todo_updated_rejects_empty_item_content() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::TodoUpdated { - session_id: "session-1".to_string(), - items: vec![v1alpha1::TodoItem { - id: "todo-1".to_string(), - content: String::new(), - status: buffa::EnumValue::from(v1alpha1::TodoStatus::Pending), - }], - revision: 1, - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "items[].content" - }) - ); -} - -#[test] -fn validate_todo_updated_rejects_duplicate_item_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::TodoUpdated { - session_id: "session-1".to_string(), - items: vec![ - v1alpha1::TodoItem { - id: "todo-1".to_string(), - content: "first".to_string(), - status: buffa::EnumValue::from(v1alpha1::TodoStatus::Pending), - }, - v1alpha1::TodoItem { - id: "todo-1".to_string(), - content: "second".to_string(), - status: buffa::EnumValue::from(v1alpha1::TodoStatus::Completed), - }, - ], - revision: 1, - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::DuplicateTodoItemId { - id: "todo-1".to_string() - }) - ); -} - -#[test] -fn validate_todo_updated_rejects_zero_revision() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::TodoUpdated { - session_id: "session-1".to_string(), - items: Vec::new(), - revision: 0, - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::TodoRevisionNotPositive) - ); -} - -#[test] -fn validate_todo_updated_accepts_unique_ids_and_positive_revision() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::TodoUpdated { - session_id: "session-1".to_string(), - items: vec![ - v1alpha1::TodoItem { - id: "todo-1".to_string(), - content: "first".to_string(), - status: buffa::EnumValue::from(v1alpha1::TodoStatus::Pending), - }, - v1alpha1::TodoItem { - id: "todo-2".to_string(), - content: "second".to_string(), - status: buffa::EnumValue::from(v1alpha1::TodoStatus::InProgress), - }, - ], - revision: 1, - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_redaction_applied_rejects_empty_redacted_event_ids() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::RedactionApplied { - session_id: "session-1".to_string(), - redacted_event_ids: Vec::new(), - reason: None, - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyRedactedEventIds) - ); -} - -#[test] -fn validate_redaction_applied_accepts_non_empty_redacted_event_ids() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::RedactionApplied { - session_id: "session-1".to_string(), - redacted_event_ids: vec!["event-1".to_string()], - reason: None, - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_session_started_rejects_empty_plan_bytes() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionStarted { - session_id: "session-1".to_string(), - execution_plan: MessageField::some(v1alpha1::StoredSessionExecutionPlan { - plan_bytes: Vec::new(), - plan_digest: MessageField::some(v1alpha1::Digest { - algorithm: "sha256".to_string(), - value: vec![0u8; 32], - }), - }), - workspace: MessageField::some(workspace_ref()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "execution_plan.plan_bytes" - }) - ); -} - -#[test] -fn validate_session_started_rejects_unsupported_digest_algorithm() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionStarted { - session_id: "session-1".to_string(), - execution_plan: MessageField::some(v1alpha1::StoredSessionExecutionPlan { - plan_bytes: b"plan".to_vec(), - plan_digest: MessageField::some(v1alpha1::Digest { - algorithm: "sha512".to_string(), - value: Vec::new(), - }), - }), - workspace: MessageField::some(workspace_ref()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnsupportedDigestAlgorithm { - field: "execution_plan.plan_digest" - }) - ); -} - -#[test] -fn validate_session_started_rejects_empty_digest_algorithm() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionStarted { - session_id: "session-1".to_string(), - execution_plan: MessageField::some(v1alpha1::StoredSessionExecutionPlan { - plan_bytes: b"plan".to_vec(), - plan_digest: MessageField::some(v1alpha1::Digest { - algorithm: String::new(), - value: vec![0u8; 32], - }), - }), - workspace: MessageField::some(workspace_ref()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyDigestAlgorithm { - field: "execution_plan.plan_digest" - }) - ); -} - -#[test] -fn validate_session_started_rejects_wrong_length_sha256_digest() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionStarted { - session_id: "session-1".to_string(), - execution_plan: MessageField::some(v1alpha1::StoredSessionExecutionPlan { - plan_bytes: b"plan".to_vec(), - plan_digest: MessageField::some(v1alpha1::Digest { - algorithm: "sha256".to_string(), - value: vec![0u8; 4], - }), - }), - workspace: MessageField::some(workspace_ref()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::Sha256DigestWrongLength { - field: "execution_plan.plan_digest", - actual: 4 - }) - ); -} - -#[test] -fn validate_session_started_accepts_valid_digest() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionStarted { - session_id: "session-1".to_string(), - execution_plan: MessageField::some(v1alpha1::StoredSessionExecutionPlan { - plan_bytes: b"plan".to_vec(), - plan_digest: MessageField::some(digest()), - }), - workspace: MessageField::some(workspace_ref()), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_session_failed_rejects_unspecified_reason() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionFailed { - session_id: "session-1".to_string(), - detail: Some("boom".to_string()), - reason: buffa::EnumValue::from(v1alpha1::SessionFailureReason::Unspecified), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { field: "reason" }) - ); -} - -#[test] -fn validate_session_failed_accepts_known_reason() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionFailed { - session_id: "session-1".to_string(), - detail: Some("boom".to_string()), - reason: buffa::EnumValue::from(v1alpha1::SessionFailureReason::ExecutionError), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_session_failed_accepts_empty_detail() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionFailed { - session_id: "session-1".to_string(), - detail: None, - reason: buffa::EnumValue::from(v1alpha1::SessionFailureReason::Timeout), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_session_hidden_rejects_unspecified_reason() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionHidden { - session_id: "session-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::SessionHiddenReason::Unspecified), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { field: "reason" }) - ); -} - -#[test] -fn validate_session_hidden_accepts_known_reason() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionHidden { - session_id: "session-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::SessionHiddenReason::UserRequested), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_session_forked_rejects_unspecified_reason() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionForked { - session_id: "session-1".to_string(), - source_session_id: "session-0".to_string(), - context_prefix_boundary: MessageField::some(session_ordinal(3)), - reason: buffa::EnumValue::from(v1alpha1::ForkReason::Unspecified), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { field: "reason" }) - ); -} - -#[test] -fn validate_session_forked_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionForked { - session_id: "session-1".to_string(), - source_session_id: "session-0".to_string(), - context_prefix_boundary: MessageField::some(session_ordinal(3)), - reason: buffa::EnumValue::from(v1alpha1::ForkReason::ManualBranch), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_session_rewound_rejects_zero_keep_through() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRewound { - session_id: "session-1".to_string(), - keep_through: MessageField::some(session_ordinal(0)), - reason: buffa::EnumValue::from(v1alpha1::RewindReason::Manual), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::OrdinalNotPositive { field: "keep_through" }) - ); -} - -#[test] -fn validate_session_rewound_rejects_unspecified_reason() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRewound { - session_id: "session-1".to_string(), - keep_through: MessageField::some(session_ordinal(2)), - reason: buffa::EnumValue::from(v1alpha1::RewindReason::Unspecified), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { field: "reason" }) - ); -} - -#[test] -fn validate_session_rewound_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRewound { - session_id: "session-1".to_string(), - keep_through: MessageField::some(session_ordinal(2)), - reason: buffa::EnumValue::from(v1alpha1::RewindReason::Manual), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_assistant_message_failed_rejects_unspecified_reason() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::AssistantMessageFailed { - session_id: "session-1".to_string(), - message_id: "message-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::AssistantMessageFailureReason::Unspecified), - detail: None, - usage: MessageField::none(), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { field: "reason" }) - ); -} - -#[test] -fn validate_assistant_message_failed_accepts_known_reason() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::AssistantMessageFailed { - session_id: "session-1".to_string(), - message_id: "message-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::AssistantMessageFailureReason::Error), - detail: None, - usage: MessageField::none(), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_tool_call_failed_rejects_unspecified_reason() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallFailed { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - error: "boom".to_string(), - reason: buffa::EnumValue::from(v1alpha1::ToolCallFailureReason::Unspecified), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { field: "reason" }) - ); -} - -#[test] -fn validate_tool_call_failed_rejects_empty_error() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallFailed { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - error: String::new(), - reason: buffa::EnumValue::from(v1alpha1::ToolCallFailureReason::Error), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { field: "error" }) - ); -} - -#[test] -fn validate_tool_call_failed_accepts_known_reason() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallFailed { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - error: "boom".to_string(), - reason: buffa::EnumValue::from(v1alpha1::ToolCallFailureReason::Error), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_execution_attempt_ready_rejects_wrong_length_sha256_digest() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptReady { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - ready_attestation_ref: "ready-ref".to_string(), - ready_attestation_digest: MessageField::some(v1alpha1::Digest { - algorithm: "sha256".to_string(), - value: vec![0u8; 4], - }), - ready_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::Sha256DigestWrongLength { - field: "ready_attestation_digest", - actual: 4 - }) - ); -} - -#[test] -fn validate_execution_attempt_ready_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptReady { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - ready_attestation_ref: "ready-ref".to_string(), - ready_attestation_digest: MessageField::some(digest()), - ready_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_execution_attempt_ended_rejects_unspecified_outcome() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptEnded { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - outcome: buffa::EnumValue::from(v1alpha1::AttemptOutcome::Unspecified), - detail: None, - ended_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { field: "outcome" }) - ); -} - -#[test] -fn validate_execution_attempt_ended_accepts_known_outcome() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptEnded { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - outcome: buffa::EnumValue::from(v1alpha1::AttemptOutcome::Failed), - detail: None, - ended_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_delegation_dispatched_rejects_unspecified_cascade_policy() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::DelegationDispatched { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - child_session_id: "session-2".to_string(), - cascade_policy: buffa::EnumValue::from(v1alpha1::CascadePolicy::Unspecified), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { - field: "cascade_policy" - }) - ); -} - -#[test] -fn validate_delegation_dispatched_accepts_known_cascade_policy() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::DelegationDispatched { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - child_session_id: "session-2".to_string(), - cascade_policy: buffa::EnumValue::from(v1alpha1::CascadePolicy::CascadeOnParentTerminal), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_parent_linked_rejects_zero_parent_dispatched_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ParentLinked { - session_id: "session-1".to_string(), - parent_session_id: "session-0".to_string(), - parent_dispatched_at: MessageField::some(session_ordinal(0)), - cascade_policy: buffa::EnumValue::from(v1alpha1::CascadePolicy::CascadeOnParentTerminal), - operation_id: "operation-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::OrdinalNotPositive { - field: "parent_dispatched_at" - }) - ); -} - -#[test] -fn validate_parent_linked_rejects_unspecified_cascade_policy() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ParentLinked { - session_id: "session-1".to_string(), - parent_session_id: "session-0".to_string(), - parent_dispatched_at: MessageField::some(session_ordinal(1)), - cascade_policy: buffa::EnumValue::from(v1alpha1::CascadePolicy::Unspecified), - operation_id: "operation-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { - field: "cascade_policy" - }) - ); -} - -#[test] -fn validate_parent_linked_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ParentLinked { - session_id: "session-1".to_string(), - parent_session_id: "session-0".to_string(), - parent_dispatched_at: MessageField::some(session_ordinal(1)), - cascade_policy: buffa::EnumValue::from(v1alpha1::CascadePolicy::CascadeOnParentTerminal), - operation_id: "operation-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_parent_terminated_rejects_unspecified_cause() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ParentTerminated { - session_id: "session-1".to_string(), - parent_session_id: "session-0".to_string(), - cause: buffa::EnumValue::from(v1alpha1::ParentTerminalCause::Unspecified), - triggering_event_id: "event-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { field: "cause" }) - ); -} - -#[test] -fn validate_parent_terminated_accepts_known_cause() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ParentTerminated { - session_id: "session-1".to_string(), - parent_session_id: "session-0".to_string(), - cause: buffa::EnumValue::from(v1alpha1::ParentTerminalCause::Closed), - triggering_event_id: "event-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_parent_history_invalidated_rejects_zero_parent_keep_through() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ParentHistoryInvalidated { - session_id: "session-1".to_string(), - parent_session_id: "session-0".to_string(), - parent_keep_through: MessageField::some(session_ordinal(0)), - triggering_event_id: "event-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::OrdinalNotPositive { - field: "parent_keep_through" - }) - ); -} - -#[test] -fn validate_parent_history_invalidated_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ParentHistoryInvalidated { - session_id: "session-1".to_string(), - parent_session_id: "session-0".to_string(), - parent_keep_through: MessageField::some(session_ordinal(4)), - triggering_event_id: "event-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_external_delegation_dispatched_rejects_wrong_length_sha256_digest() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExternalDelegationDispatched { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - delegate_reference: "delegate-ref".to_string(), - authenticated_remote_subject: "subject-1".to_string(), - authorization_reference: "authz-ref".to_string(), - request_digest: MessageField::some(v1alpha1::Digest { - algorithm: "sha256".to_string(), - value: vec![0u8; 4], - }), - correlation_id: "correlation-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::Sha256DigestWrongLength { - field: "request_digest", - actual: 4 - }) - ); -} - -#[test] -fn validate_external_delegation_dispatched_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExternalDelegationDispatched { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - delegate_reference: "delegate-ref".to_string(), - authenticated_remote_subject: "subject-1".to_string(), - authorization_reference: "authz-ref".to_string(), - request_digest: MessageField::some(digest()), - correlation_id: "correlation-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_operation_reserved_rejects_unspecified_operation_kind() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationReserved { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - request_digest: MessageField::some(digest()), - operation_kind: buffa::EnumValue::from(v1alpha1::OperationKind::Unspecified), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { - field: "operation_kind" - }) - ); -} - -#[test] -fn validate_operation_reserved_rejects_wrong_length_sha256_digest() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationReserved { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - request_digest: MessageField::some(v1alpha1::Digest { - algorithm: "sha256".to_string(), - value: vec![0u8; 4], - }), - operation_kind: buffa::EnumValue::from(v1alpha1::OperationKind::Tool), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::Sha256DigestWrongLength { - field: "request_digest", - actual: 4 - }) - ); -} - -#[test] -fn validate_operation_reserved_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationReserved { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - request_digest: MessageField::some(digest()), - operation_kind: buffa::EnumValue::from(v1alpha1::OperationKind::Tool), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_system_notice_recorded_rejects_unspecified_level() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SystemNoticeRecorded { - session_id: "session-1".to_string(), - level: buffa::EnumValue::from(v1alpha1::NoticeLevel::Unspecified), - text: "notice".to_string(), - tool_call_id: None, - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { field: "level" }) - ); -} - -#[test] -fn validate_system_notice_recorded_accepts_known_level() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SystemNoticeRecorded { - session_id: "session-1".to_string(), - level: buffa::EnumValue::from(v1alpha1::NoticeLevel::Info), - text: "notice".to_string(), - tool_call_id: None, - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_system_notice_recorded_rejects_empty_text() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SystemNoticeRecorded { - session_id: "session-1".to_string(), - level: buffa::EnumValue::from(v1alpha1::NoticeLevel::Info), - text: String::new(), - tool_call_id: None, - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { field: "text" }) - ); -} - -#[test] -fn validate_assistant_message_started_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::AssistantMessageStarted { - session_id: "session-1".to_string(), - message_id: "message-1".to_string(), - model: "model".to_string(), - settings: MessageField::none(), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_assistant_message_started_rejects_empty_model() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::AssistantMessageStarted { - session_id: "session-1".to_string(), - message_id: "message-1".to_string(), - model: String::new(), - settings: MessageField::none(), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { field: "model" }) - ); -} - -#[test] -fn validate_tool_call_requested_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallRequested { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - tool_name: "search".to_string(), - input_json: "{}".to_string(), - parent_tool_use_id: None, - operation_id: None, - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_tool_call_approved_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallApproved { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - approved_by: "user-1".to_string(), - turn_id: None, - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_tool_call_denied_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallDenied { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - denied_by: "user-1".to_string(), - reason: None, - turn_id: None, - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_tool_call_started_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallStarted { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_delegation_detached_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::DelegationDetached { - session_id: "session-1".to_string(), - child_session_id: "session-2".to_string(), - reason: None, - detach_operation_id: "operation-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_parent_detached_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ParentDetached { - session_id: "session-1".to_string(), - parent_session_id: "session-0".to_string(), - detach_operation_id: "operation-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_operation_cancellation_requested_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationCancellationRequested { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - reason: None, - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_artifact_erased_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactErased { - session_id: "session-1".to_string(), - artifact_id: "artifact-1".to_string(), - reason: None, - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_provider_tool_intent_rejected_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some(provider_tool_intent_rejected().into()), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_provider_tool_intent_rejected_rejects_empty_rejection_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ProviderToolIntentRejected { - rejection_id: String::new(), - ..provider_tool_intent_rejected() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { field: "rejection_id" }) - ); -} - -#[test] -fn validate_provider_tool_intent_rejected_rejects_unspecified_reason() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ProviderToolIntentRejected { - reason: buffa::EnumValue::from(v1alpha1::ProviderToolIntentRejectionReason::Unspecified), - ..provider_tool_intent_rejected() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { field: "reason" }) - ); -} - -fn provider_tool_intent_rejected() -> v1alpha1::ProviderToolIntentRejected { - v1alpha1::ProviderToolIntentRejected { - session_id: "session-1".to_string(), - rejection_id: "rejection-1".to_string(), - message_id: "message-1".to_string(), - turn_id: "turn-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::ProviderToolIntentRejectionReason::DuplicateCallId), - claimed_tool_call_id: Some("dup-1".to_string()), - claimed_tool_name: Some("Read".to_string()), - raw_intent: MessageField::none(), - detail: None, - } -} - -#[test] -fn validate_session_renamed_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRenamed { - session_id: "session-1".to_string(), - display_name: "New title".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_session_renamed_rejects_empty_title() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRenamed { - session_id: "session-1".to_string(), - display_name: String::new(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { field: "display_name" }) - ); -} - -#[test] -fn validate_session_archived_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionArchived { - session_id: "session-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_session_unarchived_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionUnarchived { - session_id: "session-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_user_message_recorded_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(v1alpha1::MessageRole::User), - content: vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Text("hi".to_string())), - }], - model: None, - usage: MessageField::none(), - created_at: MessageField::some(valid_timestamp()), - }), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_tool_call_completed_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallCompleted { - detached: MessageField::none(), - accessed: Vec::new(), - failed_targets: Vec::new(), - targets_attempted: None, - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - result: MessageField::some(v1alpha1::ToolCallResult { - status: buffa::EnumValue::from(v1alpha1::ToolCallResultStatus::Success), - kind: Some(v1alpha1::tool_call_result::Kind::Text(Box::new( - v1alpha1::TextToolResult { - content: "done".to_string(), - truncated: None, - }, - ))), - }), - duration: MessageField::none(), - observed: Vec::new(), - termination: MessageField::none(), - turn_id: "turn-1".to_string(), - output_replay: MessageField::none(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_artifact_recorded_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(valid_timestamp()), - source: Some(v1alpha1::artifact_metadata::Source::Stored(Box::new( - v1alpha1::StoredArtifact { - digest: MessageField::some(digest()), - size_bytes: 128, - storage_ref: "blob://artifact-1".to_string(), - mime: "text/plain".to_string(), - chunks: MessageField::none(), - }, - ))), - }), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_operation_outcome_recorded_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationOutcomeRecorded { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - outcome: Some(v1alpha1::operation_outcome_recorded::Outcome::Succeeded(Box::new( - v1alpha1::OperationSucceeded { - response_digest: MessageField::some(digest()), - response_ref: MessageField::some(artifact_ref()), - }, - ))), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_operation_outcome_recorded_accepts_succeeded_without_response_ref() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationOutcomeRecorded { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - outcome: Some(v1alpha1::operation_outcome_recorded::Outcome::Succeeded(Box::new( - v1alpha1::OperationSucceeded { - response_digest: MessageField::some(digest()), - response_ref: MessageField::none(), - }, - ))), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_checkpoint_produced_accepts_valid_event() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::CheckpointProduced { - session_id: "session-1".to_string(), - checkpoint: MessageField::some(checkpoint()), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_execution_attempt_started_accepts_valid_restored_checkpoint() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 1, - previous_attempt_id: None, - restored_checkpoint: MessageField::some(checkpoint()), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_execution_attempt_started_rejects_first_attempt_with_previous_attempt_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 1, - previous_attempt_id: Some("attempt-0".to_string()), - restored_checkpoint: MessageField::none(), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::FirstAttemptHasPreviousAttemptId) - ); -} - -#[test] -fn validate_execution_attempt_started_rejects_restart_without_previous_attempt_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-2".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 2, - previous_attempt_id: None, - restored_checkpoint: MessageField::none(), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::RestartAttemptMissingPreviousAttemptId) - ); -} - -#[test] -fn validate_execution_attempt_started_accepts_restart_with_previous_attempt_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-2".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 2, - previous_attempt_id: Some("attempt-1".to_string()), - restored_checkpoint: MessageField::none(), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_execution_attempt_started_rejects_invalid_restored_checkpoint() { - let mut broken_checkpoint = checkpoint(); - broken_checkpoint.reference = String::new(); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 1, - previous_attempt_id: None, - restored_checkpoint: MessageField::some(broken_checkpoint), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "checkpoint.reference" - }) - ); -} - -#[test] -fn validate_redaction_applied_rejects_empty_first_event_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::RedactionApplied { - session_id: "session-1".to_string(), - redacted_event_ids: vec![String::new(), "event-2".to_string()], - reason: None, - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "redacted_event_ids[0]" - }) - ); -} - -#[test] -fn validate_redaction_applied_rejects_empty_non_first_event_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::RedactionApplied { - session_id: "session-1".to_string(), - redacted_event_ids: vec!["event-1".to_string(), String::new()], - reason: None, - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "redacted_event_ids[n]" - }) - ); -} - -#[test] -fn validate_execution_attempt_started_rejects_checkpoint_with_empty_producing_execution_attempt_id() { - let mut broken_checkpoint = checkpoint(); - broken_checkpoint.producing_execution_attempt_id = String::new(); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 1, - previous_attempt_id: None, - restored_checkpoint: MessageField::some(broken_checkpoint), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "checkpoint.producing_execution_attempt_id" - }) - ); -} - -#[test] -fn validate_execution_attempt_started_rejects_checkpoint_with_invalid_session_execution_plan_digest() { - let mut broken_checkpoint = checkpoint(); - broken_checkpoint.session_execution_plan_digest = MessageField::some(v1alpha1::Digest { - algorithm: String::new(), - value: vec![0u8; 32], - }); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 1, - previous_attempt_id: None, - restored_checkpoint: MessageField::some(broken_checkpoint), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyDigestAlgorithm { - field: "checkpoint.session_execution_plan_digest" - }) - ); -} - -#[test] -fn validate_execution_attempt_started_rejects_checkpoint_for_a_different_session_execution_plan() { - let mut restored_checkpoint = checkpoint(); - restored_checkpoint.session_execution_plan_digest = MessageField::some(v1alpha1::Digest { - algorithm: "sha256".to_string(), - value: vec![1u8; 32], - }); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-2".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 2, - previous_attempt_id: Some("attempt-1".to_string()), - restored_checkpoint: MessageField::some(restored_checkpoint), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::RestoredCheckpointPlanDigestMismatch) - ); -} - -#[test] -fn validate_user_message_recorded_accepts_artifact_ref_content_block() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(v1alpha1::MessageRole::User), - content: vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::ArtifactRef(Box::new(artifact_ref()))), - }], - model: None, - usage: MessageField::none(), - created_at: MessageField::some(valid_timestamp()), - }), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_user_message_recorded_rejects_invalid_artifact_ref_content_block() { - let mut broken_artifact_ref = artifact_ref(); - broken_artifact_ref.mime = String::new(); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(v1alpha1::MessageRole::User), - content: vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::ArtifactRef(Box::new( - broken_artifact_ref, - ))), - }], - model: None, - usage: MessageField::none(), - created_at: MessageField::some(valid_timestamp()), - }), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "artifact_ref.mime" - }) - ); -} - -#[test] -fn validate_tool_call_completed_accepts_artifact_ref_result() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallCompleted { - detached: MessageField::none(), - accessed: Vec::new(), - failed_targets: Vec::new(), - targets_attempted: None, - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - result: MessageField::some(v1alpha1::ToolCallResult { - status: buffa::EnumValue::from(v1alpha1::ToolCallResultStatus::Success), - kind: Some(v1alpha1::tool_call_result::Kind::ArtifactRef(Box::new(artifact_ref()))), - }), - duration: MessageField::none(), - observed: Vec::new(), - termination: MessageField::none(), - turn_id: "turn-1".to_string(), - output_replay: MessageField::none(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_tool_call_completed_rejects_invalid_artifact_ref_result() { - let mut broken_artifact_ref = artifact_ref(); - broken_artifact_ref.artifact_id = String::new(); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallCompleted { - detached: MessageField::none(), - accessed: Vec::new(), - failed_targets: Vec::new(), - targets_attempted: None, - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - result: MessageField::some(v1alpha1::ToolCallResult { - status: buffa::EnumValue::from(v1alpha1::ToolCallResultStatus::Success), - kind: Some(v1alpha1::tool_call_result::Kind::ArtifactRef(Box::new( - broken_artifact_ref, - ))), - }), - duration: MessageField::none(), - observed: Vec::new(), - termination: MessageField::none(), - turn_id: "turn-1".to_string(), - output_replay: MessageField::none(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "artifact_ref.artifact_id" - }) - ); -} - -#[test] -fn validate_file_changed_accepts_valid_before_and_after_ref() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::FileChanged { - copied_from: MessageField::none(), - session_id: "session-1".to_string(), - path: "src/new.rs".to_string(), - change_kind: buffa::EnumValue::from(v1alpha1::FileChangeKind::Modified), - previous_path: None, - before_ref: MessageField::some(artifact_ref()), - after_ref: MessageField::some(artifact_ref()), - diff: MessageField::none(), - tool_call_id: "tool-call-1".to_string(), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_file_changed_rejects_invalid_before_ref() { - let mut broken_artifact_ref = artifact_ref(); - broken_artifact_ref.mime = String::new(); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::FileChanged { - copied_from: MessageField::none(), - session_id: "session-1".to_string(), - path: "src/new.rs".to_string(), - change_kind: buffa::EnumValue::from(v1alpha1::FileChangeKind::Modified), - previous_path: None, - before_ref: MessageField::some(broken_artifact_ref), - after_ref: MessageField::none(), - diff: MessageField::none(), - tool_call_id: "tool-call-1".to_string(), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "artifact_ref.mime" - }) - ); -} - -#[test] -fn validate_file_changed_rejects_invalid_after_ref() { - let mut broken_artifact_ref = artifact_ref(); - broken_artifact_ref.mime = String::new(); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::FileChanged { - copied_from: MessageField::none(), - session_id: "session-1".to_string(), - path: "src/new.rs".to_string(), - change_kind: buffa::EnumValue::from(v1alpha1::FileChangeKind::Modified), - previous_path: None, - before_ref: MessageField::none(), - after_ref: MessageField::some(broken_artifact_ref), - diff: MessageField::none(), - tool_call_id: "tool-call-1".to_string(), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "artifact_ref.mime" - }) - ); -} - -#[test] -fn validate_session_closed_accepts_valid_result_ref() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionClosed { - session_id: "session-1".to_string(), - result_ref: MessageField::some(artifact_ref()), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_session_closed_accepts_valid_event_without_result_ref() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionClosed { - session_id: "session-1".to_string(), - result_ref: MessageField::none(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_session_closed_rejects_invalid_result_ref() { - let mut broken_artifact_ref = artifact_ref(); - broken_artifact_ref.artifact_id = String::new(); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionClosed { - session_id: "session-1".to_string(), - result_ref: MessageField::some(broken_artifact_ref), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "artifact_ref.artifact_id" - }) - ); -} - -#[test] -fn validate_artifact_recorded_accepts_external_source() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(valid_timestamp()), - source: Some(v1alpha1::artifact_metadata::Source::External(Box::new( - v1alpha1::ExternalArtifact { - source_url: "https://example.com/artifact-1".to_string(), - source_encoding: None, - declared_mime: None, - fetched_at: MessageField::none(), - content_digest: MessageField::some(digest()), - }, - ))), - }), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_artifact_recorded_accepts_external_source_without_content_digest() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(valid_timestamp()), - source: Some(v1alpha1::artifact_metadata::Source::External(Box::new( - v1alpha1::ExternalArtifact { - source_url: "https://example.com/artifact-1".to_string(), - source_encoding: None, - declared_mime: None, - fetched_at: MessageField::none(), - content_digest: MessageField::none(), - }, - ))), - }), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_artifact_recorded_rejects_external_source_empty_source_url() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(valid_timestamp()), - source: Some(v1alpha1::artifact_metadata::Source::External(Box::new( - v1alpha1::ExternalArtifact { - source_url: String::new(), - source_encoding: None, - declared_mime: None, - fetched_at: MessageField::none(), - content_digest: MessageField::none(), - }, - ))), - }), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "artifact_metadata.external.source_url" - }) - ); -} - -#[test] -fn validate_artifact_recorded_rejects_external_source_invalid_content_digest() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(valid_timestamp()), - source: Some(v1alpha1::artifact_metadata::Source::External(Box::new( - v1alpha1::ExternalArtifact { - source_url: "https://example.com/artifact-1".to_string(), - source_encoding: None, - declared_mime: None, - fetched_at: MessageField::none(), - content_digest: MessageField::some(v1alpha1::Digest { - algorithm: String::new(), - value: Vec::new(), - }), - }, - ))), - }), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyDigestAlgorithm { - field: "artifact_metadata.external.content_digest" - }) - ); -} - -#[test] -fn validate_artifact_recorded_rejects_stored_source_invalid_digest() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(valid_timestamp()), - source: Some(v1alpha1::artifact_metadata::Source::Stored(Box::new( - v1alpha1::StoredArtifact { - digest: MessageField::none(), - size_bytes: 128, - storage_ref: "blob://artifact-1".to_string(), - mime: "text/plain".to_string(), - chunks: MessageField::none(), - }, - ))), - }), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyDigestAlgorithm { - field: "artifact_metadata.stored.digest" - }) - ); -} - -#[test] -fn validate_artifact_recorded_rejects_stored_source_empty_storage_ref() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(valid_timestamp()), - source: Some(v1alpha1::artifact_metadata::Source::Stored(Box::new( - v1alpha1::StoredArtifact { - digest: MessageField::some(digest()), - size_bytes: 128, - storage_ref: String::new(), - mime: "text/plain".to_string(), - chunks: MessageField::none(), - }, - ))), - }), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "artifact_metadata.stored.storage_ref" - }) - ); -} - -#[test] -fn validate_artifact_recorded_rejects_stored_source_empty_mime() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(valid_timestamp()), - source: Some(v1alpha1::artifact_metadata::Source::Stored(Box::new( - v1alpha1::StoredArtifact { - digest: MessageField::some(digest()), - size_bytes: 128, - storage_ref: "blob://artifact-1".to_string(), - mime: String::new(), - chunks: MessageField::none(), - }, - ))), - }), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "artifact_metadata.stored.mime" - }) - ); -} - -#[test] -fn validate_operation_outcome_recorded_rejects_invalid_succeeded_response_digest() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationOutcomeRecorded { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - outcome: Some(v1alpha1::operation_outcome_recorded::Outcome::Succeeded(Box::new( - v1alpha1::OperationSucceeded { - response_digest: MessageField::some(v1alpha1::Digest { - algorithm: String::new(), - value: Vec::new(), - }), - response_ref: MessageField::none(), - }, - ))), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyDigestAlgorithm { - field: "operation_outcome_recorded.succeeded.response_digest" - }) - ); -} - -#[test] -fn validate_operation_outcome_recorded_rejects_invalid_succeeded_response_ref() { - let mut broken_artifact_ref = artifact_ref(); - broken_artifact_ref.mime = String::new(); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationOutcomeRecorded { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - outcome: Some(v1alpha1::operation_outcome_recorded::Outcome::Succeeded(Box::new( - v1alpha1::OperationSucceeded { - response_digest: MessageField::some(digest()), - response_ref: MessageField::some(broken_artifact_ref), - }, - ))), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "artifact_ref.mime" - }) - ); -} - -#[test] -fn validate_operation_outcome_recorded_accepts_failed_outcome() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationOutcomeRecorded { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - outcome: Some(v1alpha1::operation_outcome_recorded::Outcome::Failed(Box::new( - v1alpha1::OperationFailed { - detail: "operation failed".to_string(), - failure_digest: MessageField::some(digest()), - }, - ))), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_operation_outcome_recorded_accepts_failed_without_failure_digest() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationOutcomeRecorded { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - outcome: Some(v1alpha1::operation_outcome_recorded::Outcome::Failed(Box::new( - v1alpha1::OperationFailed { - detail: "operation failed".to_string(), - failure_digest: MessageField::none(), - }, - ))), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_operation_outcome_recorded_rejects_failed_empty_detail() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationOutcomeRecorded { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - outcome: Some(v1alpha1::operation_outcome_recorded::Outcome::Failed(Box::new( - v1alpha1::OperationFailed { - detail: String::new(), - failure_digest: MessageField::none(), - }, - ))), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "operation_outcome_recorded.failed.detail" - }) - ); -} - -#[test] -fn validate_operation_outcome_recorded_rejects_failed_invalid_failure_digest() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationOutcomeRecorded { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - outcome: Some(v1alpha1::operation_outcome_recorded::Outcome::Failed(Box::new( - v1alpha1::OperationFailed { - detail: "operation failed".to_string(), - failure_digest: MessageField::some(v1alpha1::Digest { - algorithm: "sha256".to_string(), - value: vec![0u8; 4], - }), - }, - ))), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::Sha256DigestWrongLength { - field: "operation_outcome_recorded.failed.failure_digest", - actual: 4, - }) - ); -} - -#[test] -fn validate_operation_outcome_recorded_accepts_cancelled_outcome() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationOutcomeRecorded { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - outcome: Some(v1alpha1::operation_outcome_recorded::Outcome::Cancelled(Box::new( - v1alpha1::OperationCancelled { - cancelled_by: "user-1".to_string(), - reason: None, - }, - ))), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_operation_outcome_recorded_rejects_cancelled_empty_cancelled_by() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationOutcomeRecorded { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - outcome: Some(v1alpha1::operation_outcome_recorded::Outcome::Cancelled(Box::new( - v1alpha1::OperationCancelled { - cancelled_by: String::new(), - reason: None, - }, - ))), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "operation_outcome_recorded.cancelled.cancelled_by" - }) - ); -} - -#[test] -fn validate_operation_outcome_recorded_accepts_unknown_outcome() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::OperationOutcomeRecorded { - session_id: "session-1".to_string(), - operation_id: "operation-1".to_string(), - outcome: Some(v1alpha1::operation_outcome_recorded::Outcome::Unknown(Box::new( - v1alpha1::OperationUnknown { detail: None }, - ))), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_user_message_recorded_accepts_thinking_content_block() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Thinking(Box::new( - v1alpha1::ThinkingBlock { - text: "reasoning".to_string(), - signature: None, - }, - ))), - }]); - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_user_message_recorded_rejects_empty_thinking_text() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Thinking(Box::new( - v1alpha1::ThinkingBlock { - text: String::new(), - signature: None, - }, - ))), - }]); - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "content_block.thinking.text" - }) - ); -} - -#[test] -fn validate_user_message_recorded_accepts_tool_use_content_block() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::ToolUse(Box::new( - v1alpha1::ToolUseBlock { - id: "tool-use-1".to_string(), - name: "search".to_string(), - input_json: "{}".to_string(), - parent_tool_use_id: None, - }, - ))), - }]); - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_user_message_recorded_rejects_empty_tool_use_id() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::ToolUse(Box::new( - v1alpha1::ToolUseBlock { - id: String::new(), - name: "search".to_string(), - input_json: "{}".to_string(), - parent_tool_use_id: None, - }, - ))), - }]); - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "content_block.tool_use.id" - }) - ); -} - -#[test] -fn validate_user_message_recorded_rejects_empty_tool_use_name() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::ToolUse(Box::new( - v1alpha1::ToolUseBlock { - id: "tool-use-1".to_string(), - name: String::new(), - input_json: "{}".to_string(), - parent_tool_use_id: None, - }, - ))), - }]); - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "content_block.tool_use.name" - }) - ); -} - -#[test] -fn validate_user_message_recorded_rejects_invalid_tool_use_input_json() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::ToolUse(Box::new( - v1alpha1::ToolUseBlock { - id: "tool-use-1".to_string(), - name: "search".to_string(), - input_json: "not json".to_string(), - parent_tool_use_id: None, - }, - ))), - }]); - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::InvalidJson { - field: "content_block.tool_use.input_json" - }) - ); -} - -#[test] -fn validate_user_message_recorded_accepts_tool_result_content_block() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::ToolResult(Box::new( - v1alpha1::ToolResultBlock { - tool_use_id: "tool-use-1".to_string(), - result: MessageField::some(v1alpha1::ToolCallResult { - status: buffa::EnumValue::from(v1alpha1::ToolCallResultStatus::Success), - kind: Some(v1alpha1::tool_call_result::Kind::Text(Box::new( - v1alpha1::TextToolResult { - content: "done".to_string(), - truncated: None, - }, - ))), - }), - }, - ))), - }]); - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_user_message_recorded_rejects_empty_tool_result_tool_use_id() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::ToolResult(Box::new( - v1alpha1::ToolResultBlock { - tool_use_id: String::new(), - result: MessageField::some(v1alpha1::ToolCallResult { - status: buffa::EnumValue::from(v1alpha1::ToolCallResultStatus::Success), - kind: Some(v1alpha1::tool_call_result::Kind::Text(Box::new( - v1alpha1::TextToolResult { - content: "done".to_string(), - truncated: None, - }, - ))), - }), - }, - ))), - }]); - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "content_block.tool_result.tool_use_id" - }) - ); -} - -#[test] -fn validate_user_message_recorded_rejects_tool_result_missing_kind() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::ToolResult(Box::new( - v1alpha1::ToolResultBlock { - tool_use_id: "tool-use-1".to_string(), - result: MessageField::some(v1alpha1::ToolCallResult { - status: buffa::EnumValue::from(v1alpha1::ToolCallResultStatus::Success), - kind: None, - }), - }, - ))), - }]); - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingOneof { - oneof: "tool_call_result.kind" - }) - ); -} - -#[test] -fn validate_user_message_recorded_rejects_tool_result_empty_text_content() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::ToolResult(Box::new( - v1alpha1::ToolResultBlock { - tool_use_id: "tool-use-1".to_string(), - result: MessageField::some(v1alpha1::ToolCallResult { - status: buffa::EnumValue::from(v1alpha1::ToolCallResultStatus::Success), - kind: Some(v1alpha1::tool_call_result::Kind::Text(Box::new( - v1alpha1::TextToolResult { - content: String::new(), - truncated: None, - }, - ))), - }), - }, - ))), - }]); - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "tool_call_result.text.content" - }) - ); -} - -#[test] -fn validate_user_message_recorded_accepts_redacted_thinking_content_block() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::RedactedThinking(vec![1, 2, 3])), - }]); - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_tool_call_completed_rejects_empty_text_result_content() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallCompleted { - detached: MessageField::none(), - accessed: Vec::new(), - failed_targets: Vec::new(), - targets_attempted: None, - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - result: MessageField::some(v1alpha1::ToolCallResult { - status: buffa::EnumValue::from(v1alpha1::ToolCallResultStatus::Success), - kind: Some(v1alpha1::tool_call_result::Kind::Text(Box::new( - v1alpha1::TextToolResult { - content: String::new(), - truncated: None, - }, - ))), - }), - duration: MessageField::none(), - observed: Vec::new(), - termination: MessageField::none(), - turn_id: "turn-1".to_string(), - output_replay: MessageField::none(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "tool_call_result.text.content" - }) - ); -} - -#[test] -fn validate_tool_call_requested_rejects_invalid_input_json() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ToolCallRequested { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - tool_name: "search".to_string(), - input_json: "{not json".to_string(), - parent_tool_use_id: None, - operation_id: None, - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::InvalidJson { field: "input_json" }) - ); -} - -#[test] -fn validate_execution_attempt_started_accepts_valid_started_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 1, - previous_attempt_id: None, - restored_checkpoint: MessageField::none(), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_execution_attempt_started_rejects_invalid_started_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 1, - previous_attempt_id: None, - restored_checkpoint: MessageField::none(), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::some(invalid_timestamp()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::InvalidTimestamp { field: "started_at" }) - ); -} - -#[test] -fn validate_execution_attempt_started_rejects_missing_started_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptStarted { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - session_execution_plan_digest: MessageField::some(digest()), - attempt_number: 1, - previous_attempt_id: None, - restored_checkpoint: MessageField::none(), - host_artifact_ref: "host-ref".to_string(), - host_artifact_digest: MessageField::some(digest()), - authenticated_remote_subject: None, - isolation_placement: None, - started_at: MessageField::none(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingTimestamp { field: "started_at" }) - ); -} - -#[test] -fn validate_execution_attempt_ready_accepts_valid_ready_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptReady { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - ready_attestation_ref: "ready-ref".to_string(), - ready_attestation_digest: MessageField::some(digest()), - ready_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_execution_attempt_ready_rejects_invalid_ready_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptReady { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - ready_attestation_ref: "ready-ref".to_string(), - ready_attestation_digest: MessageField::some(digest()), - ready_at: MessageField::some(invalid_timestamp()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::InvalidTimestamp { field: "ready_at" }) - ); -} - -#[test] -fn validate_execution_attempt_ready_rejects_missing_ready_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptReady { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - ready_attestation_ref: "ready-ref".to_string(), - ready_attestation_digest: MessageField::some(digest()), - ready_at: MessageField::none(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingTimestamp { field: "ready_at" }) - ); -} - -#[test] -fn validate_execution_attempt_ended_accepts_valid_ended_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptEnded { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - outcome: buffa::EnumValue::from(v1alpha1::AttemptOutcome::Failed), - detail: None, - ended_at: MessageField::some(valid_timestamp()), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_execution_attempt_ended_rejects_invalid_ended_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptEnded { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - outcome: buffa::EnumValue::from(v1alpha1::AttemptOutcome::Failed), - detail: None, - ended_at: MessageField::some(invalid_timestamp()), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::InvalidTimestamp { field: "ended_at" }) - ); -} - -#[test] -fn validate_execution_attempt_ended_rejects_missing_ended_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ExecutionAttemptEnded { - session_id: "session-1".to_string(), - execution_attempt_id: "attempt-1".to_string(), - outcome: buffa::EnumValue::from(v1alpha1::AttemptOutcome::Failed), - detail: None, - ended_at: MessageField::none(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingTimestamp { field: "ended_at" }) - ); -} - -#[test] -fn validate_user_message_recorded_accepts_valid_created_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(v1alpha1::MessageRole::User), - content: vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Text("hi".to_string())), - }], - model: None, - usage: MessageField::none(), - created_at: MessageField::some(valid_timestamp()), - }), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_user_message_recorded_rejects_invalid_created_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(v1alpha1::MessageRole::User), - content: vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Text("hi".to_string())), - }], - model: None, - usage: MessageField::none(), - created_at: MessageField::some(invalid_timestamp()), - }), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::InvalidTimestamp { - field: "message.created_at" - }) - ); -} - -#[test] -fn validate_user_message_recorded_rejects_missing_created_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(v1alpha1::MessageRole::User), - content: vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Text("hi".to_string())), - }], - model: None, - usage: MessageField::none(), - created_at: MessageField::none(), - }), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingTimestamp { - field: "message.created_at" - }) - ); -} - -#[test] -fn validate_artifact_recorded_accepts_valid_created_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(valid_timestamp()), - source: Some(v1alpha1::artifact_metadata::Source::Stored(Box::new( - v1alpha1::StoredArtifact { - digest: MessageField::some(digest()), - size_bytes: 128, - storage_ref: "blob://artifact-1".to_string(), - mime: "text/plain".to_string(), - chunks: MessageField::none(), - }, - ))), - }), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_artifact_recorded_rejects_invalid_created_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(invalid_timestamp()), - source: Some(v1alpha1::artifact_metadata::Source::Stored(Box::new( - v1alpha1::StoredArtifact { - digest: MessageField::some(digest()), - size_bytes: 128, - storage_ref: "blob://artifact-1".to_string(), - mime: "text/plain".to_string(), - chunks: MessageField::none(), - }, - ))), - }), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::InvalidTimestamp { - field: "artifact.created_at" - }) - ); -} - -#[test] -fn validate_artifact_recorded_rejects_missing_created_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::none(), - source: Some(v1alpha1::artifact_metadata::Source::Stored(Box::new( - v1alpha1::StoredArtifact { - digest: MessageField::some(digest()), - size_bytes: 128, - storage_ref: "blob://artifact-1".to_string(), - mime: "text/plain".to_string(), - chunks: MessageField::none(), - }, - ))), - }), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingTimestamp { - field: "artifact.created_at" - }) - ); -} - -#[test] -fn validate_artifact_recorded_accepts_external_source_with_valid_fetched_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(valid_timestamp()), - source: Some(v1alpha1::artifact_metadata::Source::External(Box::new( - v1alpha1::ExternalArtifact { - source_url: "https://example.com/artifact-1".to_string(), - source_encoding: None, - declared_mime: None, - fetched_at: MessageField::some(valid_timestamp()), - content_digest: MessageField::none(), - }, - ))), - }), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_artifact_recorded_rejects_external_source_invalid_fetched_at() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ArtifactRecorded { - session_id: "session-1".to_string(), - artifact: MessageField::some(v1alpha1::ArtifactMetadata { - artifact_id: "artifact-1".to_string(), - preview: None, - truncated: None, - created_at: MessageField::some(valid_timestamp()), - source: Some(v1alpha1::artifact_metadata::Source::External(Box::new( - v1alpha1::ExternalArtifact { - source_url: "https://example.com/artifact-1".to_string(), - source_encoding: None, - declared_mime: None, - fetched_at: MessageField::some(invalid_timestamp()), - content_digest: MessageField::none(), - }, - ))), - }), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::InvalidTimestamp { - field: "artifact_metadata.external.fetched_at" - }) - ); -} - -#[test] -fn validate_user_message_recorded_accepts_usage_without_cost() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(v1alpha1::MessageRole::User), - content: vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Text("hi".to_string())), - }], - model: None, - usage: MessageField::some(v1alpha1::TokenUsage { - input_tokens: Some(10), - output_tokens: None, - cache_creation_tokens: None, - cache_read_tokens: None, - cost: MessageField::none(), - completeness: None, - }), - created_at: MessageField::some(valid_timestamp()), - }), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_user_message_recorded_accepts_valid_usage_currency_code() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(v1alpha1::MessageRole::User), - content: vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Text("hi".to_string())), - }], - model: None, - usage: MessageField::some(token_usage_with_currency("USD")), - created_at: MessageField::some(valid_timestamp()), - }), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_user_message_recorded_rejects_invalid_usage_currency_code() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(v1alpha1::CanonicalMessage { - message_id: "message-1".to_string(), - role: buffa::EnumValue::from(v1alpha1::MessageRole::User), - content: vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Text("hi".to_string())), - }], - model: None, - usage: MessageField::some(token_usage_with_currency("dollars")), - created_at: MessageField::some(valid_timestamp()), - }), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::InvalidCurrencyCode { - field: "message.usage.cost.currency_code" - }) - ); -} - -#[test] -fn validate_compacted_accepts_valid_usage_currency_code() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::Compacted { - usage: MessageField::some(token_usage_with_currency("USD")), - ..compacted() - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_compacted_rejects_invalid_usage_currency_code() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::Compacted { - usage: MessageField::some(token_usage_with_currency("usd")), - ..compacted() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::InvalidCurrencyCode { - field: "usage.cost.currency_code" - }) - ); -} - -#[test] -fn validate_assistant_message_failed_accepts_valid_usage_currency_code() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::AssistantMessageFailed { - session_id: "session-1".to_string(), - message_id: "message-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::AssistantMessageFailureReason::Error), - detail: None, - usage: MessageField::some(token_usage_with_currency("EUR")), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_assistant_message_failed_rejects_invalid_usage_currency_code() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::AssistantMessageFailed { - session_id: "session-1".to_string(), - message_id: "message-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::AssistantMessageFailureReason::Error), - detail: None, - usage: MessageField::some(token_usage_with_currency("E1")), - turn_id: "turn-1".to_string(), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::InvalidCurrencyCode { - field: "usage.cost.currency_code" - }) - ); -} - -#[test] -fn validate_checkpoint_produced_rejects_empty_checkpoint_type() { - let mut broken_checkpoint = checkpoint(); - broken_checkpoint.checkpoint_type = String::new(); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::CheckpointProduced { - session_id: "session-1".to_string(), - checkpoint: MessageField::some(broken_checkpoint), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "checkpoint.checkpoint_type" - }) - ); -} - -#[test] -fn validate_checkpoint_produced_rejects_empty_implementation_version() { - let mut broken_checkpoint = checkpoint(); - broken_checkpoint.implementation_version = String::new(); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::CheckpointProduced { - session_id: "session-1".to_string(), - checkpoint: MessageField::some(broken_checkpoint), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "checkpoint.implementation_version" - }) - ); -} - -#[test] -fn validate_checkpoint_produced_rejects_empty_capture_attestation_ref() { - let mut broken_checkpoint = checkpoint(); - broken_checkpoint.capture_attestation_ref = String::new(); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::CheckpointProduced { - session_id: "session-1".to_string(), - checkpoint: MessageField::some(broken_checkpoint), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "checkpoint.capture_attestation_ref" - }) - ); -} - -#[test] -fn validate_checkpoint_produced_rejects_invalid_capture_attestation_digest() { - let mut broken_checkpoint = checkpoint(); - broken_checkpoint.capture_attestation_digest = MessageField::some(v1alpha1::Digest { - algorithm: String::new(), - value: vec![0u8; 32], - }); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::CheckpointProduced { - session_id: "session-1".to_string(), - checkpoint: MessageField::some(broken_checkpoint), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyDigestAlgorithm { - field: "checkpoint.capture_attestation_digest" - }) - ); -} - -#[test] -fn validate_checkpoint_produced_rejects_invalid_effective_history_digest() { - let mut broken_checkpoint = checkpoint(); - broken_checkpoint.effective_history_digest = MessageField::some(v1alpha1::Digest { - algorithm: String::new(), - value: vec![0u8; 32], - }); - - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::CheckpointProduced { - session_id: "session-1".to_string(), - checkpoint: MessageField::some(broken_checkpoint), - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyDigestAlgorithm { - field: "checkpoint.effective_history_digest" - }) - ); -} - -#[test] -fn validate_session_started_rejects_empty_workspace_id() { - let mut event = session_started(); - event.workspace = MessageField::some(v1alpha1::WorkspaceRef { - workspace_id: String::new(), - ..workspace_ref() - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { - field: "workspace.workspace_id" - }) - ); -} - -#[test] -fn validate_session_started_rejects_empty_workspace_uri() { - let mut event = session_started(); - event.workspace = MessageField::some(v1alpha1::WorkspaceRef { - uri: String::new(), - ..workspace_ref() - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "workspace.uri" }) - ); -} - -#[test] -fn validate_session_started_accepts_workspace_with_revision() { - let mut event = session_started(); - event.workspace = MessageField::some(v1alpha1::WorkspaceRef { - revision: Some("0f1e2d3c".to_string()), - ..workspace_ref() - }); - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_user_message_recorded_rejects_empty_turn_id() { - let event = v1alpha1::UserMessageRecorded { - session_id: "session-1".to_string(), - message: MessageField::some(v1alpha1::CanonicalMessage { - role: buffa::EnumValue::from(v1alpha1::MessageRole::User), - ..assistant_message() - }), - turn_id: String::new(), - }; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "turn_id" }) - ); -} - -#[test] -fn validate_assistant_message_started_rejects_empty_turn_id() { - let mut event = assistant_message_started(); - event.turn_id = String::new(); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "turn_id" }) - ); -} - -#[test] -fn validate_assistant_message_started_accepts_valid_settings() { - let mut event = assistant_message_started(); - event.settings = MessageField::some(v1alpha1::ModelSettings { - max_output_tokens: Some(4096), - temperature: Some(0.0), - top_p: Some(0.95), - thinking_budget_tokens: Some(1024), - stop_sequences: vec!["".to_string()], - raw_settings: MessageField::some(artifact_ref()), - }); - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_assistant_message_started_accepts_settings_without_raw_settings() { - let mut event = assistant_message_started(); - event.settings = MessageField::some(v1alpha1::ModelSettings { - max_output_tokens: Some(4096), - temperature: Some(1.0), - top_p: Some(0.5), - thinking_budget_tokens: None, - stop_sequences: vec!["".to_string()], - raw_settings: MessageField::none(), - }); - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_assistant_message_started_rejects_non_finite_temperature() { - let mut event = assistant_message_started(); - event.settings = MessageField::some(v1alpha1::ModelSettings { - max_output_tokens: None, - temperature: Some(f64::NAN), - top_p: None, - thinking_budget_tokens: None, - stop_sequences: Vec::new(), - raw_settings: MessageField::none(), - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::NonFiniteSetting { - field: "settings.temperature" - }) - ); -} - -#[test] -fn validate_assistant_message_started_rejects_non_finite_top_p() { - let mut event = assistant_message_started(); - event.settings = MessageField::some(v1alpha1::ModelSettings { - max_output_tokens: None, - temperature: None, - top_p: Some(f64::INFINITY), - thinking_budget_tokens: None, - stop_sequences: Vec::new(), - raw_settings: MessageField::none(), - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::NonFiniteSetting { - field: "settings.top_p" - }) - ); -} - -#[test] -fn validate_assistant_message_started_rejects_empty_stop_sequence() { - let mut event = assistant_message_started(); - event.settings = MessageField::some(v1alpha1::ModelSettings { - max_output_tokens: None, - temperature: None, - top_p: None, - thinking_budget_tokens: None, - stop_sequences: vec![String::new()], - raw_settings: MessageField::none(), - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { - field: "settings.stop_sequences[]" - }) - ); -} - -#[test] -fn validate_assistant_message_started_rejects_invalid_raw_settings() { - let mut event = assistant_message_started(); - event.settings = MessageField::some(v1alpha1::ModelSettings { - max_output_tokens: None, - temperature: None, - top_p: None, - thinking_budget_tokens: None, - stop_sequences: Vec::new(), - raw_settings: MessageField::some(v1alpha1::ArtifactRef { - artifact_id: String::new(), - ..artifact_ref() - }), - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { - field: "artifact_ref.artifact_id" - }) - ); -} - -#[test] -fn validate_assistant_message_completed_rejects_empty_turn_id() { - let event = v1alpha1::AssistantMessageCompleted { - session_id: "session-1".to_string(), - message: MessageField::some(assistant_message()), - finish_reason: buffa::EnumValue::from(v1alpha1::FinishReason::EndTurn), - matched_stop_sequence: None, - turn_id: String::new(), - }; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "turn_id" }) - ); -} - -#[test] -fn validate_assistant_message_failed_rejects_empty_turn_id() { - let event = v1alpha1::AssistantMessageFailed { - session_id: "session-1".to_string(), - message_id: "message-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::AssistantMessageFailureReason::Error), - detail: None, - usage: MessageField::none(), - turn_id: String::new(), - }; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "turn_id" }) - ); -} - -#[test] -fn validate_tool_call_requested_rejects_empty_turn_id() { - let event = v1alpha1::ToolCallRequested { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - tool_name: "search".to_string(), - input_json: "{}".to_string(), - parent_tool_use_id: None, - operation_id: None, - turn_id: String::new(), - }; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "turn_id" }) - ); -} - -#[test] -fn validate_tool_call_started_rejects_empty_turn_id() { - let event = v1alpha1::ToolCallStarted { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - turn_id: String::new(), - }; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "turn_id" }) - ); -} - -#[test] -fn validate_tool_call_failed_rejects_empty_turn_id() { - let event = v1alpha1::ToolCallFailed { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - error: "boom".to_string(), - reason: buffa::EnumValue::from(v1alpha1::ToolCallFailureReason::Error), - turn_id: String::new(), - }; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "turn_id" }) - ); -} - -#[test] -fn validate_tool_call_approved_accepts_unset_turn_id() { - let event = v1alpha1::ToolCallApproved { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - approved_by: "user-1".to_string(), - turn_id: None, - }; - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_tool_call_approved_rejects_set_but_empty_turn_id() { - let event = v1alpha1::ToolCallApproved { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - approved_by: "user-1".to_string(), - turn_id: Some(String::new()), - }; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "turn_id" }) - ); -} - -#[test] -fn validate_tool_call_denied_rejects_set_but_empty_turn_id() { - let event = v1alpha1::ToolCallDenied { - session_id: "session-1".to_string(), - tool_call_id: "tool-call-1".to_string(), - tool_execution_id: "tool-exec-1".to_string(), - denied_by: "policy-1".to_string(), - reason: None, - turn_id: Some(String::new()), - }; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "turn_id" }) - ); -} - -#[test] -fn validate_tool_call_completed_rejects_empty_turn_id() { - let mut event = tool_call_completed(); - event.turn_id = String::new(); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "turn_id" }) - ); -} - -#[test] -fn validate_tool_call_completed_accepts_exit_code_termination() { - let mut event = tool_call_completed(); - event.termination = MessageField::some(v1alpha1::CommandTermination { - outcome: Some(v1alpha1::command_termination::Outcome::ExitCode(1)), - }); - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_tool_call_completed_accepts_signal_termination() { - let mut event = tool_call_completed(); - event.termination = MessageField::some(v1alpha1::CommandTermination { - outcome: Some(v1alpha1::command_termination::Outcome::Signal(9)), - }); - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_tool_call_completed_rejects_termination_without_outcome() { - let mut event = tool_call_completed(); - event.termination = MessageField::some(v1alpha1::CommandTermination { outcome: None }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::MissingOneof { - oneof: "command_termination.outcome" - }) - ); -} - -#[test] -fn validate_tool_call_completed_accepts_valid_duration() { - let mut event = tool_call_completed(); - event.duration = MessageField::some(buffa_types::google::protobuf::Duration::from_secs_nanos(3, 500_000_000)); - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_tool_call_completed_rejects_negative_duration() { - let mut event = tool_call_completed(); - event.duration = MessageField::some(buffa_types::google::protobuf::Duration::from_secs_nanos(-1, 0)); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::InvalidDuration { field: "duration" }) - ); -} - -#[test] -fn validate_tool_call_completed_accepts_valid_observation() { - let mut event = tool_call_completed(); - event.observed = vec![resource_observation()]; - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_tool_call_completed_rejects_observation_with_empty_uri() { - let mut event = tool_call_completed(); - event.observed = vec![v1alpha1::ResourceObservation { - uri: String::new(), - ..resource_observation() - }]; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { - field: "observed[].uri" - }) - ); -} - -#[test] -fn validate_tool_call_completed_accepts_complete_absent_observation() { - let mut event = tool_call_completed(); - event.observed = vec![v1alpha1::ResourceObservation { - outcome: Some(v1alpha1::resource_observation::Outcome::Absent(Box::new( - v1alpha1::ResourceAbsent {}, - ))), - range: MessageField::none(), - complete: Some(true), - ..resource_observation() - }]; - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_tool_call_completed_accepts_absent_resource_observation() { - let mut event = tool_call_completed(); - event.observed = vec![v1alpha1::ResourceObservation { - outcome: Some(v1alpha1::resource_observation::Outcome::Absent(Box::new( - v1alpha1::ResourceAbsent {}, - ))), - complete: None, - ..resource_observation() - }]; - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_tool_call_completed_rejects_missing_observation_outcome() { - let mut event = tool_call_completed(); - event.observed = vec![v1alpha1::ResourceObservation { - outcome: None, - ..resource_observation() - }]; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::MissingOneof { - oneof: "observed[].outcome" - }) - ); -} - -#[test] -fn validate_tool_call_completed_rejects_range_with_absent_observation() { - let mut event = tool_call_completed(); - event.observed = vec![v1alpha1::ResourceObservation { - outcome: Some(v1alpha1::resource_observation::Outcome::Absent(Box::new( - v1alpha1::ResourceAbsent {}, - ))), - range: MessageField::some(v1alpha1::ByteRange { offset: 0, length: 512 }), - ..resource_observation() - }]; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::RangeWithAbsentObservation) - ); -} - -#[test] -fn validate_tool_call_completed_rejects_observation_with_invalid_digest() { - let mut event = tool_call_completed(); - event.observed = vec![v1alpha1::ResourceObservation { - outcome: Some(v1alpha1::resource_observation::Outcome::ContentDigest(Box::new( - v1alpha1::Digest { - algorithm: "md5".to_string(), - value: vec![0u8; 32], - }, - ))), - ..resource_observation() - }]; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::UnsupportedDigestAlgorithm { - field: "observed[].content_digest" - }) - ); -} - -#[test] -fn validate_tool_call_completed_accepts_ranged_observation() { - let mut event = tool_call_completed(); - event.observed = vec![v1alpha1::ResourceObservation { - range: MessageField::some(v1alpha1::ByteRange { offset: 0, length: 512 }), - complete: Some(false), - ..resource_observation() - }]; - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_tool_call_completed_accepts_full_range_with_complete() { - let mut event = tool_call_completed(); - event.observed = vec![v1alpha1::ResourceObservation { - range: MessageField::some(v1alpha1::ByteRange { offset: 0, length: 512 }), - complete: Some(true), - ..resource_observation() - }]; - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_tool_call_completed_rejects_zero_length_range() { - let mut event = tool_call_completed(); - event.observed = vec![v1alpha1::ResourceObservation { - range: MessageField::some(v1alpha1::ByteRange { offset: 16, length: 0 }), - complete: Some(false), - ..resource_observation() - }]; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyByteRange { - field: "observed[].range" - }) - ); -} - -#[test] -fn validate_file_changed_rejects_empty_tool_call_id() { - let mut event = file_changed(); - event.tool_call_id = String::new(); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "tool_call_id" }) - ); -} - -#[test] -fn validate_file_changed_rejects_empty_turn_id() { - let mut event = file_changed(); - event.turn_id = String::new(); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { field: "turn_id" }) - ); -} - -#[test] -fn validate_file_changed_accepts_diff_with_counts_only() { - let mut event = file_changed(); - event.diff = MessageField::some(v1alpha1::DiffSummary { - added_lines: Some(12), - removed_lines: Some(3), - truncated: None, - rendered: MessageField::none(), - }); - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_file_changed_accepts_truncated_diff_with_render() { - let mut event = file_changed(); - event.diff = MessageField::some(v1alpha1::DiffSummary { - added_lines: Some(4000), - removed_lines: Some(0), - truncated: Some(true), - rendered: MessageField::some(artifact_ref()), - }); - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_file_changed_rejects_truncated_diff_without_render() { - let mut event = file_changed(); - event.diff = MessageField::some(v1alpha1::DiffSummary { - added_lines: Some(4000), - removed_lines: Some(0), - truncated: Some(true), - rendered: MessageField::none(), - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::TruncatedDiffWithoutRender) - ); -} - -#[test] -fn validate_file_changed_rejects_invalid_rendered_diff_ref() { - let mut broken_artifact_ref = artifact_ref(); - broken_artifact_ref.mime = String::new(); - - let mut event = file_changed(); - event.diff = MessageField::some(v1alpha1::DiffSummary { - added_lines: None, - removed_lines: None, - truncated: None, - rendered: MessageField::some(broken_artifact_ref), - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::EmptyIdentifier { - field: "artifact_ref.mime" - }) - ); -} - -#[test] -fn validate_artifact_ref_accepts_untruncated_size_greater_than_size() { - let mut event = file_changed(); - event.after_ref = MessageField::some(v1alpha1::ArtifactRef { - untruncated_size_bytes: Some(4096), - ..artifact_ref() - }); - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_artifact_ref_rejects_untruncated_size_equal_to_size() { - let mut event = file_changed(); - event.after_ref = MessageField::some(v1alpha1::ArtifactRef { - untruncated_size_bytes: Some(128), - ..artifact_ref() - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::UntruncatedSizeNotGreater { - size: 128, - untruncated: 128 - }) - ); -} - -#[test] -fn validate_artifact_ref_rejects_untruncated_size_below_size() { - let mut event = file_changed(); - event.after_ref = MessageField::some(v1alpha1::ArtifactRef { - untruncated_size_bytes: Some(64), - ..artifact_ref() - }); - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::UntruncatedSizeNotGreater { - size: 128, - untruncated: 64 - }) - ); -} - -#[test] -fn validate_token_usage_accepts_final_completeness() { - let event = v1alpha1::AssistantMessageFailed { - session_id: "session-1".to_string(), - message_id: "message-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::AssistantMessageFailureReason::Interrupted), - detail: None, - usage: MessageField::some(v1alpha1::TokenUsage { - completeness: Some(buffa::EnumValue::from(v1alpha1::UsageCompleteness::Partial)), - ..token_usage_with_currency("USD") - }), - turn_id: "turn-1".to_string(), - }; - - assert_eq!(validate_session_event(&event_of(event)), Ok(())); -} - -#[test] -fn validate_token_usage_rejects_unspecified_completeness() { - let event = v1alpha1::AssistantMessageFailed { - session_id: "session-1".to_string(), - message_id: "message-1".to_string(), - reason: buffa::EnumValue::from(v1alpha1::AssistantMessageFailureReason::Interrupted), - detail: None, - usage: MessageField::some(v1alpha1::TokenUsage { - completeness: Some(buffa::EnumValue::from(v1alpha1::UsageCompleteness::Unspecified)), - ..token_usage_with_currency("USD") - }), - turn_id: "turn-1".to_string(), - }; - - assert_eq!( - validate_session_event(&event_of(event)), - Err(SessionEventValidationError::UnspecifiedEnum { - field: "usage.completeness" - }) - ); -} - -#[test] -fn validate_user_message_recorded_accepts_inline_provider_content_block() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Provider(Box::new( - v1alpha1::ProviderBlock { - provider: "anthropic".to_string(), - block_type: "server_tool_use".to_string(), - payload: Some(v1alpha1::provider_block::Payload::Inline(b"{}".to_vec())), - }, - ))), - }]); - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_user_message_recorded_accepts_ref_provider_content_block() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Provider(Box::new( - v1alpha1::ProviderBlock { - provider: "anthropic".to_string(), - block_type: "server_tool_use".to_string(), - payload: Some(v1alpha1::provider_block::Payload::Ref(Box::new(artifact_ref()))), - }, - ))), - }]); - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_user_message_recorded_rejects_provider_block_empty_provider() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Provider(Box::new( - v1alpha1::ProviderBlock { - provider: String::new(), - block_type: "server_tool_use".to_string(), - payload: Some(v1alpha1::provider_block::Payload::Inline(b"{}".to_vec())), - }, - ))), - }]); - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "content_block.provider.provider" - }) - ); -} - -#[test] -fn validate_user_message_recorded_rejects_provider_block_empty_block_type() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Provider(Box::new( - v1alpha1::ProviderBlock { - provider: "anthropic".to_string(), - block_type: String::new(), - payload: Some(v1alpha1::provider_block::Payload::Inline(b"{}".to_vec())), - }, - ))), - }]); - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "content_block.provider.block_type" - }) - ); -} - -#[test] -fn validate_user_message_recorded_rejects_provider_block_missing_payload() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Provider(Box::new( - v1alpha1::ProviderBlock { - provider: "anthropic".to_string(), - block_type: "server_tool_use".to_string(), - payload: None, - }, - ))), - }]); - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingOneof { - oneof: "provider_block.payload" - }) - ); -} - -#[test] -fn validate_user_message_recorded_rejects_provider_block_empty_inline_payload() { - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Provider(Box::new( - v1alpha1::ProviderBlock { - provider: "anthropic".to_string(), - block_type: "server_tool_use".to_string(), - payload: Some(v1alpha1::provider_block::Payload::Inline(Vec::new())), - }, - ))), - }]); - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "content_block.provider.inline" - }) - ); -} - -#[test] -fn validate_user_message_recorded_rejects_provider_block_invalid_ref_payload() { - let mut broken_artifact_ref = artifact_ref(); - broken_artifact_ref.mime = String::new(); - - let event = user_message_event(vec![v1alpha1::ContentBlock { - kind: Some(v1alpha1::content_block::Kind::Provider(Box::new( - v1alpha1::ProviderBlock { - provider: "anthropic".to_string(), - block_type: "server_tool_use".to_string(), - payload: Some(v1alpha1::provider_block::Payload::Ref(Box::new(broken_artifact_ref))), - }, - ))), - }]); - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "artifact_ref.mime" - }) - ); -} - -fn session_recovered() -> v1alpha1::SessionRecovered { - v1alpha1::SessionRecovered { - session_id: "session-1".to_string(), - source_session_id: "session-0".to_string(), - source_boundary: MessageField::some(session_ordinal(7)), - source_digest: MessageField::some(digest()), - salvage_key: "salvage-1".to_string(), - completeness: buffa::EnumValue::from(v1alpha1::RecoveryCompleteness::Complete), - omitted_count: 0, - } -} - -#[test] -fn validate_session_recovered_accepts_complete_without_omissions() { - let event = v1alpha1::SessionEvent { - event: Some(session_recovered().into()), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_session_recovered_accepts_partial_with_omissions() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRecovered { - completeness: buffa::EnumValue::from(v1alpha1::RecoveryCompleteness::Partial), - omitted_count: 3, - ..session_recovered() - } - .into(), - ), - }; - - assert_eq!(validate_session_event(&event), Ok(())); -} - -#[test] -fn validate_session_recovered_rejects_empty_session_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRecovered { - session_id: String::new(), - ..session_recovered() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { field: "session_id" }) - ); -} - -#[test] -fn validate_session_recovered_rejects_empty_source_session_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRecovered { - source_session_id: String::new(), - ..session_recovered() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { - field: "source_session_id" - }) - ); -} - -#[test] -fn validate_session_recovered_rejects_zero_source_boundary() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRecovered { - source_boundary: MessageField::some(session_ordinal(0)), - ..session_recovered() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::OrdinalNotPositive { - field: "source_boundary" - }) - ); -} - -#[test] -fn validate_session_recovered_rejects_missing_source_digest() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRecovered { - source_digest: MessageField::none(), - ..session_recovered() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::MissingRequiredField { field: "source_digest" }) - ); -} - -#[test] -fn validate_session_recovered_rejects_unsupported_source_digest_algorithm() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRecovered { - source_digest: MessageField::some(v1alpha1::Digest { - algorithm: "md5".to_string(), - value: vec![0u8; 16], - }), - ..session_recovered() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnsupportedDigestAlgorithm { field: "source_digest" }) - ); -} - -#[test] -fn validate_session_recovered_rejects_empty_salvage_key() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRecovered { - salvage_key: String::new(), - ..session_recovered() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { field: "salvage_key" }) - ); -} - -#[test] -fn validate_session_recovered_rejects_unspecified_completeness() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRecovered { - completeness: buffa::EnumValue::from(v1alpha1::RecoveryCompleteness::Unspecified), - ..session_recovered() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::UnspecifiedEnum { field: "completeness" }) - ); -} - -#[test] -fn validate_session_recovered_rejects_complete_with_omissions() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRecovered { - completeness: buffa::EnumValue::from(v1alpha1::RecoveryCompleteness::Complete), - omitted_count: 2, - ..session_recovered() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::CompleteRecoveryWithOmissions { actual: 2 }) - ); -} - -#[test] -fn validate_session_recovered_rejects_partial_without_omissions() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::SessionRecovered { - completeness: buffa::EnumValue::from(v1alpha1::RecoveryCompleteness::Partial), - omitted_count: 0, - ..session_recovered() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::PartialRecoveryWithoutOmissions) - ); -} - -#[test] -fn validate_provider_tool_intent_rejected_rejects_empty_session_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ProviderToolIntentRejected { - session_id: String::new(), - ..provider_tool_intent_rejected() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { field: "session_id" }) - ); -} - -#[test] -fn validate_provider_tool_intent_rejected_rejects_empty_message_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ProviderToolIntentRejected { - message_id: String::new(), - ..provider_tool_intent_rejected() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { field: "message_id" }) - ); -} - -#[test] -fn validate_provider_tool_intent_rejected_rejects_empty_turn_id() { - let event = v1alpha1::SessionEvent { - event: Some( - v1alpha1::ProviderToolIntentRejected { - turn_id: String::new(), - ..provider_tool_intent_rejected() - } - .into(), - ), - }; - - assert_eq!( - validate_session_event(&event), - Err(SessionEventValidationError::EmptyIdentifier { field: "turn_id" }) - ); -} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/tests.rs b/rsworkspace/crates/platform/trogonai-proto/src/tests.rs index 4e02b6121..f750c738c 100644 --- a/rsworkspace/crates/platform/trogonai-proto/src/tests.rs +++ b/rsworkspace/crates/platform/trogonai-proto/src/tests.rs @@ -4,8 +4,6 @@ use buffa::{Message as _, MessageName as _}; use crate::agents::agents::v1::AgentProvisioned; #[cfg(feature = "schedules")] use crate::scheduler::schedules::v1::ScheduleOccurrenceRecorded; -#[cfg(feature = "sessions")] -use crate::session::sessions::v1alpha1::SessionCancelled; #[cfg(feature = "schedules")] use buffa::MessageField; @@ -97,56 +95,3 @@ fn decode_event_to_json_errors_on_malformed_known_agent_payload() { "{result:?}" ); } - -#[cfg(feature = "sessions")] -#[test] -fn decode_event_to_json_is_canonical_across_wire_orderings_for_sessions() { - let event = SessionCancelled { - session_id: "session-1".to_string(), - reason: buffa::EnumValue::from(crate::session::sessions::v1alpha1::SessionCancellationReason::UserRequested), - detail: Some("user requested cancellation".to_string()), - }; - let canonical = event.encode_to_vec(); - - // Re-encode the same message with field 3 (detail) emitted before field 2 - // (reason); protobuf permits any field order, so this is a valid alternate - // encoding that differs on the wire. Build each fragment with the encoder - // rather than hand-rolling tags. - let only_detail = SessionCancelled { - reason: buffa::EnumValue::from(0), - ..event.clone() - } - .encode_to_vec(); - let without_detail = SessionCancelled { - detail: None, - ..event.clone() - } - .encode_to_vec(); - let reordered = [only_detail, without_detail].concat(); - assert_ne!(canonical, reordered, "encodings must differ on the wire"); - - let from_canonical = super::decode_event_to_json(SessionCancelled::FULL_NAME, &canonical); - let from_reordered = super::decode_event_to_json(SessionCancelled::FULL_NAME, &reordered); - - assert!(matches!(from_canonical, Ok(Some(_)))); - assert_eq!(from_canonical, from_reordered); -} - -#[cfg(feature = "sessions")] -#[test] -fn decode_event_to_json_returns_none_for_unknown_session_type() { - assert_eq!( - super::decode_event_to_json("type.googleapis.com/trogonai.session.sessions.v1alpha1.Unknown", &[]), - Ok(None) - ); -} - -#[cfg(feature = "sessions")] -#[test] -fn decode_event_to_json_errors_on_malformed_known_session_payload() { - let result = super::decode_event_to_json(SessionCancelled::FULL_NAME, b"\xff\xff\xff\xff"); - assert!( - matches!(result, Err(super::EventDecodeError::Json { .. })), - "{result:?}" - ); -}