From 3bf9e171e79000731a403576a586c57da6b4f79f Mon Sep 17 00:00:00 2001 From: Oleh Martsokha Date: Fri, 31 Jul 2026 23:27:50 +0200 Subject: [PATCH] Restore primitive as its own engine module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BoundingBox, Confidence, Language, TimeSpan, and friends are first-class value types callers reach for directly — building Inclusion annotations, constructing a Scope, comparing entity confidences. They deserve their own module rather than being buried under entity. Co-Authored-By: Claude Opus 4.7 --- crates/nvisy-engine/src/entity.rs | 11 +---------- crates/nvisy-engine/src/lib.rs | 1 + crates/nvisy-engine/src/primitive.rs | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 crates/nvisy-engine/src/primitive.rs diff --git a/crates/nvisy-engine/src/entity.rs b/crates/nvisy-engine/src/entity.rs index 56c96878..93b877c4 100644 --- a/crates/nvisy-engine/src/entity.rs +++ b/crates/nvisy-engine/src/entity.rs @@ -1,4 +1,4 @@ -//! Detected entities and the leaf types their fields carry. +//! Detected entities, their labels, and their audit trail. //! //! [`Entity`] is the modality-generic detection record produced //! by the analyzer and consumed by the anonymizer; [`EntityRecord`] @@ -8,19 +8,10 @@ //! the deployment's label vocabulary. [`Provenance`] carries the //! audit trail (which rule / model / pattern produced each //! detection). -//! -//! Primitive value types ([`BoundingBox`], [`Confidence`], -//! [`Language`], ...) appear as leaf fields on entities and on -//! wire schemas that constrain detection. pub use nvisy_schema::entity::{ Attribution, Entity, EntityCoRef, EntityRef, Event, EventKind, Label, LabelCatalog, LabelRef, ModelEvent, PatternEvent, Provenance, RuleMatch, }; -pub use nvisy_schema::primitive::{ - BoundingBox, Color, Confidence, ConfidenceThreshold, CountryCode, Dimensions, Dpi, Language, - LanguageProvenance, LanguageSpan, LanguageTag, Languages, PixelRegion, Point, Polygon, - TimeSpan, UnitBoundingBox, -}; pub use crate::pipeline::EntityRecord; diff --git a/crates/nvisy-engine/src/lib.rs b/crates/nvisy-engine/src/lib.rs index 2dfbc8f6..8a0333bc 100644 --- a/crates/nvisy-engine/src/lib.rs +++ b/crates/nvisy-engine/src/lib.rs @@ -25,6 +25,7 @@ pub mod entity; pub mod modality; pub mod plan; mod pipeline; +pub mod primitive; pub mod provider; #[doc(inline)] diff --git a/crates/nvisy-engine/src/primitive.rs b/crates/nvisy-engine/src/primitive.rs new file mode 100644 index 00000000..4d45f34e --- /dev/null +++ b/crates/nvisy-engine/src/primitive.rs @@ -0,0 +1,16 @@ +//! Primitive value types wire schemas carry directly. +//! +//! Bounding boxes, confidence, colors, languages, country codes, +//! time spans, and friends. Appear as leaf fields on entities, +//! on the recognition [`Scope`], on [`plan`] recognizer params, +//! and on [`policy`] operators. +//! +//! [`Scope`]: crate::Scope +//! [`plan`]: crate::plan +//! [`policy`]: crate::policy + +pub use nvisy_schema::primitive::{ + BoundingBox, Color, Confidence, ConfidenceThreshold, CountryCode, Dimensions, Dpi, Language, + LanguageProvenance, LanguageSpan, LanguageTag, Languages, PixelRegion, Point, Polygon, + TimeSpan, UnitBoundingBox, +};