Skip to main content

Crate printobserver_types

Crate printobserver_types 

Source
Expand description

printobserver-types.

Owns: the shared domain vocabulary every other crate speaks — printer and job identity, observed printer state, vision observations, supervisory decisions, and their serialized forms. It holds data and total functions over that data, never I/O.

May depend on: no crate of this workspace. It is the root of the graph, so a type it does not hold is a type the rest of the workspace cannot agree on.

§One authoritative source per restated fact

The types here are declared once and imported by every consumer rather than re-declared. The JSON Schemas the clients and the agent’s structured answer are validated against are generated from these types by the printobserver-types:schemas graph target, which the gate runs: a schema checked into schemas/ that no longer matches what these types generate fails that target. Nothing transcribes a schema by hand, and nothing restates a field.

contract is where that generation reads the declared set from: it is this crate’s own claim about which types it declares and what a canonical value of each looks like.

§The representations, stated once

  • Identifiers. Every identifier this system mints is a UUID version 7, minted by the store, held as a distinct newtype per record, and serialized as its lowercase hyphenated string. See ids.
  • Numbers. Every temperature, factor, multiplier, percentage and fraction is a 64-bit float. Every byte count and every integer identifier an external system supplies is a 64-bit signed integer. Every duration is whole seconds as a 64-bit signed integer.
  • Timestamps. Every timestamp is an instant in UTC, serialized as an RFC 3339 string with a zero offset. See Timestamp.
  • Optionality. An optional field absent means the source did not report it, and is never rendered as a zero, an empty string, or a default. Absent serializes as absent and parses back as absent.
  • Declared ranges. A numeric field this crate declares a range for is typed Reported<f64>. See reported for the whole rule, including why a non-finite value is out of range and why one is refused on emission.

§Why serde, schemars and serde_json are re-exported

The four port crates depend on this crate and on nothing else, and each of them declares request and answer shapes that cross a process boundary and so must derive the same traits these types derive. They reach the derive macros through serde, schemars and serde_json here rather than by declaring a dependency of their own.

Re-exports§

pub use action::AcknowledgementDisposition;
pub use action::ActionKind;
pub use action::ActionRecord;
pub use action::ActionRequest;
pub use action::Actor;
pub use action::ActorClass;
pub use action::ExecutionOutcome;
pub use action::PrintAction;
pub use adjustable::Adjustable;
pub use adjustable::AdjustableError;
pub use assessment::AgentAssessment;
pub use assessment::Confidence;
pub use context::PrintContext;
pub use contract::RANGED_FIELDS;
pub use contract::RangedField;
pub use contract::Sample;
pub use contract::TypeContract;
pub use contract::WireField;
pub use contract::declared;
pub use contract::wire_fields;
pub use event::ActionExecutedPayload;
pub use event::ActionRejectedPayload;
pub use event::ActionRequestedPayload;
pub use event::AgentAssessmentPayload;
pub use event::EventKind;
pub use event::EventPayload;
pub use event::EventRecord;
pub use event::EventSource;
pub use event::InterventionExpiredPayload;
pub use event::MalformedExternalEventPayload;
pub use event::ObicoFailureAlertPayload;
pub use event::ObicoNotificationType;
pub use event::ObicoPrinterNotificationPayload;
pub use event::OperatorAcknowledgementPayload;
pub use event::PortFailurePayload;
pub use event::PortFailureSite;
pub use event::StartupOutcome;
pub use event::StartupReconciliationPayload;
pub use event::SupervisionSessionClosedPayload;
pub use event::SupervisionSessionOpenedPayload;
pub use file_name::FileName;
pub use file_name::FileNameError;
pub use file_name::FileNameRefusal;
pub use file_name::SEPARATORS;
pub use ids::ActionId;
pub use ids::EventId;
pub use ids::IdentifierError;
pub use ids::ImageId;
pub use ids::InterventionId;
pub use ids::PrintId;
pub use image::ImageRecord;
pub use image::ImageRef;
pub use intervention::Intervention;
pub use intervention::InterventionOutcome;
pub use manifest::JobManifest;
pub use obico::ObicoEventType;
pub use obico::ObicoFailureAlert;
pub use obico::ObicoFailureEvent;
pub use obico::ObicoFailureEventType;
pub use obico::ObicoNotificationEvent;
pub use obico::ObicoPrintInfo;
pub use obico::ObicoPrinterInfo;
pub use obico::ObicoPrinterNotification;
pub use obico::ObicoTimestamp;
pub use policy::EffectiveBounds;
pub use policy::PolicyDecision;
pub use policy::RejectionReason;
pub use policy::SafetyEnvelope;
pub use print::ManifestNarrowing;
pub use print::PrintRecord;
pub use printer::HeaterSnapshot;
pub use printer::JobSnapshot;
pub use printer::PrinterSnapshot;
pub use printer::PrinterState;
pub use raw::RawBytes;
pub use reported::COMPLETION_RANGE;
pub use reported::FAN_PERCENT_RANGE;
pub use reported::FEEDRATE_FACTOR_RANGE;
pub use reported::FLOWRATE_FACTOR_RANGE;
pub use reported::HEATER_ACTUAL_C_RANGE;
pub use reported::HEATER_OFFSET_C_RANGE;
pub use reported::HEATER_TARGET_C_RANGE;
pub use reported::Range;
pub use reported::Reported;
pub use session::SessionPhase;
pub use session::SupervisionSession;
pub use timestamp::Timestamp;
pub use timestamp::TimestampError;
pub use schemars;
pub use serde;
pub use serde_json;

Modules§

action
The closed vocabulary an actor may ask for, and the record of one request.
adjustable
The closed set of things an adjustment may change.
assessment
What a supervision turn answers with.
context
The one aggregate a caller and the agent both read.
contract
This crate’s own claim about the types it declares.
event
The history: one closed pair of an event kind and the payload it carries.
file_name
The one piece of caller-supplied text that crosses to a printer’s file API.
ids
The identifiers this system mints, one distinct newtype per record.
image
Images fetched for a print, and the handle one travels in context under.
intervention
A bounded change, and what became of it when it expired.
manifest
What a sliced job says about itself, and the bounds it narrows to.
obico
The wire shapes the self-hosted Obico webhook notification plugin sends.
policy
What an actor is allowed to ask for, and the decision taken on one request.
print
The print itself: PrintObserver’s own record of one job being watched.
printer
Normalized observations of a printer and of the job it is running.
raw
The bytes an externally sourced event arrived as.
reported
Reported numbers, and the plausibility ranges this crate declares for them.
session
The supervision session one print is watched through.
timestamp
The one instant representation this vocabulary has.