diff --git a/proto/trogonai/agents/agents/v1/agent_provisioned.proto b/proto/trogonai/agents/agents/v1/agent_provisioned.proto index f724e4d35..ff02d623e 100644 --- a/proto/trogonai/agents/agents/v1/agent_provisioned.proto +++ b/proto/trogonai/agents/agents/v1/agent_provisioned.proto @@ -3,6 +3,7 @@ edition = "2024"; package trogonai.agents.agents.v1; import "trogonai/agents/agents/v1/agent.proto"; +import "trogonai/agents/agents/v1/digest.proto"; // AgentProvisioned is the Agent registry stream's genesis event, minting // revision 1. No limits, no rubrics, no grants live here (design Q15/Q16); @@ -10,14 +11,19 @@ import "trogonai/agents/agents/v1/agent.proto"; message AgentProvisioned { string agent_id = 1 [features.field_presence = LEGACY_REQUIRED]; string display_name = 2 [features.field_presence = LEGACY_REQUIRED]; - // Placement node ref (bare spelling per the spelling rule: unsuffixed - // `parent` means placement, kinship is always `parentId`). + // Placement node the agent is provisioned under: the node ref that anchors + // the agent in the placement hierarchy and scopes ownership and addressing. + // Bare spelling is deliberate per the spelling rule: unsuffixed `parent` + // always denotes placement, while kinship refs are always `parentId`. + // Immutable for the agent's v1 lifetime; re-placement mints a new agent + // rather than mutating this ref. string parent = 3 [features.field_presence = LEGACY_REQUIRED]; AgentConfiguration configuration = 4 [features.field_presence = LEGACY_REQUIRED]; // Revision minted by this genesis event, recorded explicitly so no consumer // derives it from convention. Always 1; the decider rejects any other value // at write time. uint64 revision = 5 [features.field_presence = LEGACY_REQUIRED]; - // SHA-256 digest of the provisioned revision bundle. - string content_digest = 6 [features.field_presence = LEGACY_REQUIRED]; + // Content digest over the provisioned revision bundle, carrying its own + // algorithm identifier rather than assuming one by convention. + Digest content_digest = 6 [features.field_presence = LEGACY_REQUIRED]; } diff --git a/proto/trogonai/agents/agents/v1/digest.proto b/proto/trogonai/agents/agents/v1/digest.proto new file mode 100644 index 000000000..f5e771e22 --- /dev/null +++ b/proto/trogonai/agents/agents/v1/digest.proto @@ -0,0 +1,13 @@ +edition = "2024"; + +package trogonai.agents.agents.v1; + +// 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. +message Digest { + // Digest algorithm identifier, for example "sha256". + string algorithm = 1 [features.field_presence = LEGACY_REQUIRED]; + // Raw digest bytes produced by algorithm over the committed content. + bytes value = 2 [features.field_presence = LEGACY_REQUIRED]; +} diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.agent_provisioned.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.agent_provisioned.__view.rs index dbe170f06..7ea418a78 100644 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.agent_provisioned.__view.rs +++ b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.agent_provisioned.__view.rs @@ -10,8 +10,12 @@ pub struct AgentProvisionedView<'a> { pub agent_id: &'a str, /// Field 2: `display_name` pub display_name: &'a str, - /// Placement node ref (bare spelling per the spelling rule: unsuffixed - /// `parent` means placement, kinship is always `parentId`). + /// Placement node the agent is provisioned under: the node ref that anchors + /// the agent in the placement hierarchy and scopes ownership and addressing. + /// Bare spelling is deliberate per the spelling rule: unsuffixed `parent` + /// always denotes placement, while kinship refs are always `parentId`. + /// Immutable for the agent's v1 lifetime; re-placement mints a new agent + /// rather than mutating this ref. /// /// Field 3: `parent` pub parent: &'a str, @@ -25,10 +29,13 @@ pub struct AgentProvisionedView<'a> { /// /// Field 5: `revision` pub revision: u64, - /// SHA-256 digest of the provisioned revision bundle. + /// Content digest over the provisioned revision bundle, carrying its own + /// algorithm identifier rather than assuming one by convention. /// /// Field 6: `content_digest` - pub content_digest: &'a str, + pub content_digest: ::buffa::MessageFieldView< + super::super::__buffa::view::DigestView<'a>, + >, #[doc(hidden)] pub __buffa_required_seen_0: u64, } @@ -73,13 +80,13 @@ Distinguishes a field that was absent from one explicitly encoded with its defau pub const fn has_revision(&self) -> bool { self.__buffa_required_seen_0 & 8u64 != 0 } - /**Whether required field `content_digest` was present on the wire. + /**Whether required field `content_digest` is set. -Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/ +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.__buffa_required_seen_0 & 16u64 != 0 + self.content_digest.is_set() } } impl<'a> ::buffa::MessageView<'a> for AgentProvisionedView<'a> { @@ -167,8 +174,21 @@ impl<'a> ::buffa::MessageView<'a> for AgentProvisionedView<'a> { tag, ::buffa::encoding::WireType::LengthDelimited, )?; - view.content_digest = ::buffa::types::borrow_str(&mut cur)?; - view.__buffa_required_seen_0 |= 16u64; + 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())?; @@ -202,7 +222,14 @@ impl<'a> ::buffa::MessageView<'a> for AgentProvisionedView<'a> { None => ::buffa::MessageField::none(), }, revision: self.revision, - content_digest: self.content_digest.to_string(), + content_digest: match self.content_digest.as_option() { + Some(v) => { + ::buffa::MessageField::< + super::super::Digest, + >::some(v.to_owned_from_source(__buffa_src)?) + } + None => ::buffa::MessageField::none(), + }, ..::core::default::Default::default() }) } @@ -225,7 +252,14 @@ impl<'a> ::buffa::ViewEncode<'a> for AgentProvisionedView<'a> { + inner_size; } size += 1u32 + ::buffa::types::uint64_encoded_len(self.revision) as u32; - size += 1u32 + ::buffa::types::string_encoded_len(&self.content_digest) as u32; + 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 + += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32 + + inner_size; + } size } #[allow(clippy::needless_borrow)] @@ -244,7 +278,10 @@ impl<'a> ::buffa::ViewEncode<'a> for AgentProvisionedView<'a> { self.configuration.write_to(__cache, buf); } ::buffa::types::put_uint64_field(5u32, self.revision, buf); - ::buffa::types::put_string_field(6u32, &self.content_digest, buf); + if self.content_digest.is_set() { + ::buffa::types::put_len_delimited_header(6u32, __cache.consume_next(), buf); + self.content_digest.write_to(__cache, buf); + } } } /// Serializes this view as protobuf JSON. @@ -287,7 +324,9 @@ impl<'__a> ::serde::Serialize for AgentProvisionedView<'__a> { )?; } { - __map.serialize_entry("contentDigest", self.content_digest)?; + if let ::core::option::Option::Some(__v) = self.content_digest.as_option() { + __map.serialize_entry("contentDigest", __v)?; + } } __map.end() } @@ -390,8 +429,12 @@ impl AgentProvisionedOwnedView { pub fn display_name(&self) -> &'_ str { self.0.reborrow().display_name } - /// Placement node ref (bare spelling per the spelling rule: unsuffixed - /// `parent` means placement, kinship is always `parentId`). + /// Placement node the agent is provisioned under: the node ref that anchors + /// the agent in the placement hierarchy and scopes ownership and addressing. + /// Bare spelling is deliberate per the spelling rule: unsuffixed `parent` + /// always denotes placement, while kinship refs are always `parentId`. + /// Immutable for the agent's v1 lifetime; re-placement mints a new agent + /// rather than mutating this ref. /// /// Field 3: `parent` #[must_use] @@ -416,12 +459,15 @@ impl AgentProvisionedOwnedView { pub fn revision(&self) -> u64 { self.0.reborrow().revision } - /// SHA-256 digest of the provisioned revision bundle. + /// Content digest over the provisioned revision bundle, carrying its own + /// algorithm identifier rather than assuming one by convention. /// /// Field 6: `content_digest` #[must_use] - pub fn content_digest(&self) -> &'_ str { - self.0.reborrow().content_digest + pub fn content_digest( + &self, + ) -> &::buffa::MessageFieldView> { + &self.0.reborrow().content_digest } } impl ::core::convert::From<::buffa::OwnedView>> diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.agent_provisioned.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.agent_provisioned.rs index 36ea302df..22e07cba5 100644 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.agent_provisioned.rs +++ b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.agent_provisioned.rs @@ -22,8 +22,12 @@ pub struct AgentProvisioned { with = "::buffa::json_helpers::proto_string" )] pub display_name: ::buffa::alloc::string::String, - /// Placement node ref (bare spelling per the spelling rule: unsuffixed - /// `parent` means placement, kinship is always `parentId`). + /// Placement node the agent is provisioned under: the node ref that anchors + /// the agent in the placement hierarchy and scopes ownership and addressing. + /// Bare spelling is deliberate per the spelling rule: unsuffixed `parent` + /// always denotes placement, while kinship refs are always `parentId`. + /// Immutable for the agent's v1 lifetime; re-placement mints a new agent + /// rather than mutating this ref. /// /// Field 3: `parent` #[serde(rename = "parent", with = "::buffa::json_helpers::proto_string")] @@ -38,15 +42,12 @@ pub struct AgentProvisioned { /// Field 5: `revision` #[serde(rename = "revision", with = "::buffa::json_helpers::uint64")] pub revision: u64, - /// SHA-256 digest of the provisioned revision bundle. + /// Content digest over the provisioned revision bundle, carrying its own + /// algorithm identifier rather than assuming one by convention. /// /// Field 6: `content_digest` - #[serde( - rename = "contentDigest", - alias = "content_digest", - with = "::buffa::json_helpers::proto_string" - )] - pub content_digest: ::buffa::alloc::string::String, + #[serde(rename = "contentDigest", alias = "content_digest")] + pub content_digest: ::buffa::MessageField, } impl ::core::fmt::Debug for AgentProvisioned { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { @@ -97,7 +98,14 @@ impl ::buffa::Message for AgentProvisioned { + inner_size; } size += 1u32 + ::buffa::types::uint64_encoded_len(self.revision) as u32; - size += 1u32 + ::buffa::types::string_encoded_len(&self.content_digest) as u32; + 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 + += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32 + + inner_size; + } size } fn write_to( @@ -115,7 +123,10 @@ impl ::buffa::Message for AgentProvisioned { self.configuration.write_to(__cache, buf); } ::buffa::types::put_uint64_field(5u32, self.revision, buf); - ::buffa::types::put_string_field(6u32, &self.content_digest, buf); + if self.content_digest.is_set() { + ::buffa::types::put_len_delimited_header(6u32, __cache.consume_next(), buf); + self.content_digest.write_to(__cache, buf); + } } fn merge_field( &mut self, @@ -172,7 +183,11 @@ impl ::buffa::Message for AgentProvisioned { tag, ::buffa::encoding::WireType::LengthDelimited, )?; - ::buffa::types::merge_string(&mut self.content_digest, buf)?; + ::buffa::Message::merge_length_delimited( + self.content_digest.get_or_insert_default(), + buf, + ctx, + )?; } _ => { ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?; @@ -186,7 +201,7 @@ impl ::buffa::Message for AgentProvisioned { self.parent.clear(); self.configuration = ::buffa::MessageField::none(); self.revision = 0u64; - self.content_digest.clear(); + self.content_digest = ::buffa::MessageField::none(); } } impl ::buffa::json_helpers::ProtoElemJson for AgentProvisioned { diff --git a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.digest.__view.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.digest.__view.rs new file mode 100644 index 000000000..e9f3bff6f --- /dev/null +++ b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.digest.__view.rs @@ -0,0 +1,284 @@ +// @generated by buffa-codegen. DO NOT EDIT. +// source: trogonai/agents/agents/v1/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. +#[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) + } + 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 = 0u32; + size += 1u32 + ::buffa::types::string_encoded_len(&self.algorithm) as u32; + size += 1u32 + ::buffa::types::bytes_encoded_len(&self.value) as u32; + size + } + #[allow(clippy::needless_borrow)] + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::bytes::BufMut, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + ::buffa::types::put_string_field(1u32, &self.algorithm, buf); + ::buffa::types::put_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.agents.agents.v1"; + const NAME: &'static str = "Digest"; + const FULL_NAME: &'static str = "trogonai.agents.agents.v1.Digest"; + const TYPE_URL: &'static str = "type.googleapis.com/trogonai.agents.agents.v1.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`] 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. + /// + /// # Errors + /// + /// Returns an error if re-materializing preserved unknown fields + /// fails (e.g. the unknown-field limit is exceeded). + pub fn to_owned_message( + &self, + ) -> ::core::result::Result { + 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.agents.agents.v1.digest.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.digest.rs new file mode 100644 index 000000000..5920015a6 --- /dev/null +++ b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.digest.rs @@ -0,0 +1,124 @@ +// @generated by buffa-codegen. DO NOT EDIT. +// source: trogonai/agents/agents/v1/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. +#[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.agents.agents.v1.Digest"; +} +::buffa::impl_default_instance!(Digest); +impl ::buffa::MessageName for Digest { + const PACKAGE: &'static str = "trogonai.agents.agents.v1"; + const NAME: &'static str = "Digest"; + const FULL_NAME: &'static str = "trogonai.agents.agents.v1.Digest"; + const TYPE_URL: &'static str = "type.googleapis.com/trogonai.agents.agents.v1.Digest"; +} +impl ::buffa::Message for Digest { + /// Returns the total encoded size in bytes. + /// + /// The result is a `u32`; the protobuf specification requires all + /// messages to fit within 2 GiB (2,147,483,647 bytes), so a + /// compliant message will never overflow this type. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u32; + size += 1u32 + ::buffa::types::string_encoded_len(&self.algorithm) as u32; + size += 1u32 + ::buffa::types::bytes_encoded_len(&self.value) as u32; + size + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::bytes::BufMut, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + ::buffa::types::put_string_field(1u32, &self.algorithm, buf); + ::buffa::types::put_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.agents.agents.v1.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.agents.agents.v1.mod.rs b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.mod.rs index 8d3524811..90fbf2eff 100644 --- a/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.mod.rs +++ b/rsworkspace/crates/platform/trogonai-proto/src/gen/trogonai.agents.agents.v1.mod.rs @@ -1,6 +1,7 @@ // @generated by buffa-codegen. DO NOT EDIT. include!("trogonai.agents.agents.v1.agent.rs"); +include!("trogonai.agents.agents.v1.digest.rs"); include!("trogonai.agents.agents.v1.agent_provisioned.rs"); include!("trogonai.agents.agents.v1.events.rs"); #[allow( @@ -21,6 +22,7 @@ pub mod __buffa { #[allow(unused_imports)] use super::*; include!("trogonai.agents.agents.v1.agent.__view.rs"); + include!("trogonai.agents.agents.v1.digest.__view.rs"); include!("trogonai.agents.agents.v1.agent_provisioned.__view.rs"); include!("trogonai.agents.agents.v1.events.__view.rs"); pub mod oneof { @@ -37,6 +39,7 @@ pub mod __buffa { /// 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::__AGENT_CONFIGURATION_JSON_ANY); + reg.register_json_any(super::__DIGEST_JSON_ANY); reg.register_json_any(super::__AGENT_PROVISIONED_JSON_ANY); reg.register_json_any(super::__AGENT_EVENT_JSON_ANY); } @@ -46,6 +49,10 @@ pub use self::__buffa::view::AgentConfigurationView; #[doc(inline)] pub use self::__buffa::view::AgentConfigurationOwnedView; #[doc(inline)] +pub use self::__buffa::view::DigestView; +#[doc(inline)] +pub use self::__buffa::view::DigestOwnedView; +#[doc(inline)] pub use self::__buffa::view::AgentProvisionedView; #[doc(inline)] pub use self::__buffa::view::AgentProvisionedOwnedView;