Expand description
The history-run seam — the async RUN machine behind a trait, mirroring the
platform-seam shape of brep-app/src/store.rs’s ModelStore (a trait with
impls behind it, async surfaced via a poll idiom).
A history run is split SUBMIT → POLL/APPLY: HistoryRunner::submit_run
kicks off a run tagged with a monotonic generation, and the completed
RunReply is drained later via HistoryRunner::poll_run. The runner OWNS
the SceneRunner — so a future thread/worker
impl owns the resident registry that execute_history populates — and holds
the delta baseline across reruns.
This slice ships the DEFAULT InlineRunner: it runs on submit_run and
stashes the reply for an immediate poll_run, so the run stays synchronous
and byte-identical to the pre-seam in-process run. A native-thread impl (M2b)
and a wasm-worker impl (M3) slot in behind the SAME trait — submit_run
defers the work and poll_run surfaces it a frame (or many) later, so the
EngineState::pump caller never changes.
Structs§
- Apply
Region Choices Job - Rebuild an interactive import’s chosen regions as NURBS faces: the
conversion’s STEP, the welded mesh the regions index, and one choice per
region (
brep_reconstruction::import_session::apply_region_choices). - Apply
Region Choices Reply - CamJob
- ONE CAM operation’s generation, off the UI thread (the CAM workbench’s
Generate). The job carries everything the generator reads as plain data:
the operation, its setup and the document’s tools (the shared model, by
value), and the resident solids it machines by
(name, handle), which the runner clones out of its registry and tessellates through the CAM kernel adapter. The main side submits ONE operation per job and the next when its reply lands, so a cancel between operations is immediate on every platform; inside a job the native thread’s cancel flag ends it at the generator’s next work chunk, and the browser worker — which cannot read a message while it is inside a job — finishes the operation, whose reply the main side then drops as cancelled. A documentResetdrops nothing here: the job holds no parked state across commands. - CamProgress
- A generation’s progress, posted from inside the job at its stage and chunk boundaries.
- CamReply
- A completed
CamJob: the toolpath, or why the operation could not be generated (the generator’s own words), and how much work it took. - CamSim
Job - One simulation command, paired back by
(session, seq). - CamSim
Progress - A simulation chunk’s progress, posted between motions.
- CamSim
Reply - The session’s state after a
CamSimJob. - FitAttempt
- One kind tried by
fit_region. - Hybrid
Demotion - One demoted region of a mixed analytic/faceted rebuild.
- Import
Region - One region of the segmentation the mixed builder starts from.
- Import
Regions - The segmentation phase of an import.
- Inline
Runner - The default, SYNCHRONOUS runner: runs on submit, stashes the reply for an immediate poll. Behavior-identical to the pre-seam in-process run.
- Measure
Query - A per-object MEASUREMENT request routed to the runner (which owns the warm
registry). The runner resolves
ownerto its resident handle and measures bykind; the reply is the object-info JSON fragment MINUS the main-injectedname/creatingFeaturefields. Tagged with a monotonicidso the main side can pair the reply with its pending request. - Measure
Reply - A completed
MeasureQuery: the object-info measurement fields as a JSON fragment (WITHOUTname/creatingFeature, which the main thread injects from its eager provenance), tagged with the requestid. - Mesh
Import Phase Reply - Mesh
Import Reply - Completed off-thread reconstruction. Success carries validated STEP and diagnostics for a preview or an ordinary IMPORT3D history insertion.
- Mesh
Import Request - A mesh reconstruction request. The byte payload moves to the native thread or is serialized to the browser worker; no parsing or fitting happens on UI.
- Nurbs
Face Choice - One region to rebuild as a NURBS face.
- Nurbs
Face Outcome - What became of one
NurbsFaceChoice. - Nurbs
Fit - A least-squares B-spline surface fitted to a region.
- Plugin
Action Reply - Plugin
Action Request - A callback request against an immutable document/selection snapshot.
- Plugin
Install Reply - Plugin
Install Request - Validate explicitly installed packages away from the UI thread.
- Region
Fit - The result of
fit_region. - Region
FitJob - Refit one region of an interactive import. The caller sends the region’s own triangles (a small mesh), so the runner keeps no import state.
- Region
FitReply - Region
FitRequest - Refit one region.
- RunProgress
- A feature about to EXECUTE inside an in-flight run (cached replays are instant and are not reported): which one, of how many, under which generation. Posted by the runner before the kernel starts the feature, so the UI can name what it is waiting on — and, after a cancel, what it was waiting on.
- RunReply
- A completed history run, tagged with the
generationit was submitted under so the applier can drop stale replies (a newer run that finished first). Theoutputis theSceneRunnerdelta to apply to the display scene. - Sheet
Lines Reply - A completed
SheetLinesRequest: the placement’s lines relative to its position, or why the runner could not draw them (a handle its registry no longer holds, or holds different geometry under). - Sheet
Lines Request - A drawing sheet’s exact hidden-line pass for ONE placement, handed to the
runner so the UI thread never runs it (see
crate::sheets::project::LinesJob). The job names the runner’s own resident solids by handle and content fingerprint, so nothing crosses the seam but the question and the lines. - Step
Probe Reply - The probe’s answer: the parsed assembly (
Some), no structure (None), or a parse failure. The assembly crosses back to the main side whole — its JSON is large (74 MB for the file above) but the trip costs a third of a second against the seconds the parse took. - Step
Probe Request - A STEP text to PROBE for product structure on the runner — the parse that
brep_kernel::read_step_assemblyperforms, which builds every product’s bodies and takes seconds on a real assembly (8.3 s natively for a 5 MB, 140-product file), so it must not run on the browser’s main thread. - StlConversion
Options - Controls recognition and STEP topology construction.
- StlConversion
Output - STEP text and its complete conversion report.
- StlConversion
Report - Detailed conversion outcome suitable for terminal or JSON reporting.
- Thread
Runner - Topology
Reply - A completed
TopologyRequest: a clone of every requested solid the registry still holds,(name, handle, solid). A handle the registry no longer holds (a later run freed it) is left out. - Topology
Request - A request for the B-rep TOPOLOGY of resident solids, by the handle each display was tessellated from. The drawing sheet’s exact hidden-line pass reads faces and edges, and the resident registry that holds them is thread-local to the runner, so the main side asks for exactly the solids a placement draws and does not already hold. Nothing else ever asks, so a document with no sheet never pays for the topology crossing.
Enums§
- CamSim
Request - A CAM SIMULATION request (lane C17b). The runner keeps ONE simulation session resident (its stock and checkpoints live runner-side; a thread local, so the native thread and the wasm worker hold it the same way); the main side loads it once and then asks it to advance in bounded chunks, so a cancel between chunks is immediate on every platform and a chunk stops between two motions on the native thread.
- Command
- A command sent main → runner (thread channel OR worker
postMessage) over one ordered stream (so aResetbefore aRunstays before it).Runcarries the whole request; the driver coalesces consecutiveRuns to shed a slider drag’s backlog (the thread inthread_main, the worker’s main side inWorkerRunner). - Conversion
Backend - Topology path used to produce the final STEP body.
- Conversion
Policy - Whether an unprovable analytic conversion may preserve the mesh as a repaired faceted STEP solid.
- FitKind
- What to fit a region as.
- Measure
Kind - Which exact measurement a
MeasureQuerywants, mirroring the object-info kinds (crate::metadata): a whole solid, one named face, or one named edge. - Mesh
Import Format - Mesh encoding accepted by the off-thread reconstruction channel.
- Mesh
Import Phase - One phase of an interactive mesh import, posted from inside the
reconstruction before its
MeshImportReply. - Region
Kind - What a region is (proposed or fitted) as.
- Reply
- A reply sent runner → main; the main side demuxes it into per-kind buffers.
- Session
OnMain - The history-run seam: SUBMIT a run, POLL for its completed reply, RESET the
delta baseline, plus a QUERY channel for per-object measurements (routed to the
runner so the warm registry answers them, never the cold main-side one). The
Inline impl runs everything synchronously; a later thread/worker impl defers
the work and surfaces the replies through the same poll idiom.
Where the main thread gets the assembly session of the run it applied
(
HistoryRunner::session_for_main).
Constants§
- CAM_
TRIANGLE_ BUDGET - The most triangles a CAM job’s part mesh may have (the triangle index and the drop-cutter queries scale with it).
- UNASSIGNED_
REGION - Unassigned triangles’ region id, re-exported for callers colouring them.
Traits§
Functions§
- apply_
region_ choices_ reply - Apply region choices wherever the runner runs.
- process_
command - Execute ONE
Commandagainstrunnerand return theReplyit produces, if any. The shared step both async drivers run: the nativethread_maincalls it for each (post-coalescing) command on the runner thread; the wasmWorkerRunner’sworker_entrycalls it perpostMessageon the worker.Run→ aReply::Run;Query→ aReply::Query;Resetdrops the delta baseline AND the runner’s OWN kernel history cache (the resident registry lives with the runner — thread or worker — not on main) and yields no reply. - region_
fit_ reply - Run a region refit wherever the runner runs.
- set_
reply_ waker - Install (or with
Noneremove) the hook a runner thread calls after each reply it posts. The desktop event loop installs its own waker here.