Skip to main content

Module context

Module context 

Source
Expand description

The one aggregate a caller and the agent both read.

PrintContext is the supervision domain’s own view of one print: the record, the printer and job as the printer port last reported them, the manifest and the bounds in force, the interventions still active, the events most recently written down — the print’s own, and what the printer watch recorded of the machine since the print opened — the failure detector’s health, and what the slicer planned at the job’s current file position (crate::gcode_index). The loop collects it when it handles an event, holds it for the turn that event prompts, and answers it to the context operation, so what the agent reasons about is the state the event was handled at rather than whatever the machine has drifted to since.

It is declared here rather than centrally because every field of it is this domain’s to collect: a domain that adds a fact a turn should see edits this crate and regenerates the clients, and nothing central.

Structs§

AgentContext
What a supervision turn reads about one print: PrintContext with each fact stated once, as it is now, and nothing no supervision decision reads.
AgentEvent
One event of the print’s, as a turn reads it: what happened, when, and the facts it changed.
AgentHeater
One heater, in degrees Celsius: each reading absent when the printer did not report it, or reported one outside what a heater can read.
AgentPrint
The print a context is about.
AgentPrinter
The printer’s heaters as they are now.
PrintContext
Everything a supervision turn is given about one print.
Since
The events a context read asked since one carries: that event, and the print’s events newer than it, newest first.

Functions§

newer_than
The events newer than since, newest first, when events — newest first — holds it.
turn_facts
The facts a supervision turn is handed up front: the context read as the turn began, as AgentContext answers it — and no field that answer does not carry — with its events cut to unseen_events: what happened that the agent has not been shown, which its own conversation does not hold.
unseen_events
Of a print’s events, newest first, those the agent has not been shown: every event newer than its last answer, and every one that arrived while the turn behind that answer ran — after the event that turn answered, which its acknowledgement names — and was not that turn’s own doing: a person’s resume taken as the agent answered, or the printer’s own report. The turn’s own requests, their outcomes and what it recorded of itself are left out, and so is the acknowledgement written from that answer after the turn ended, with its outcome: the conversation already holds the answer it was written from. A print the agent has not answered on keeps every event; one whose answered event cannot be found keeps every event back to the answer before, its own aside, because one shown twice costs less than one never shown.