Packages
The Package aggregate: Pack-path output. An order's scanned contents become a sealed carton (package-seals, driven by a Pack task's active claim), then the SLAM weigh-check either applies a shipping label or diverts the package if the actual weight is outside tolerance of the expected weight. Read model: GET /packages/{id} and GET /packages?orderRef= expose a package's current status (and so the SLAM outcome) without side effects.
Scan contents and seal a Package for a Pack task's order
The Pack-path counterpart to `complete`: the station holding the active claim on a Pack task scans the order's contents and seals them into a brand-new Package resource (created by this call, not pre-existing โ see the `Location` header). The task itself is left claimed; a separate `POST /tasks/{id}/completions` call finishes the Pack task once the package is sealed. Requires at least one scanned item โ an empty `contents` array is a domain invariant violation (`422`), not a malformed request (`400`), since the array is present and well-formed, just semantically insufficient to seal.
Look up every Package sealed for an order reference
Read-only query returning every Package sealed for `orderRef` โ the Package-side twin of `GET /tasks?orderRef=` (same query-parameter contract, same 400 on a missing or empty `orderRef`, same empty array for an unrecognized one). An order normally yields one carton, but a multi-carton order or a re-pack after a SLAM diversion yields several, so treat the response as a set. Ordered by package id. Side-effect-free (see [ADR-0033](/docs/adr/0033-package-read-model)).
Read one Package, including its SLAM outcome
Read-only view of a single Package, in exactly the shape `POST /tasks/{id}/package-seals` returns on 201. This is how the SLAM operator and the outbound dock loader learn the SLAM outcome: `POST /packages/{id}/slam-runs` answers `204` both when a label was applied and when the package was diverted, so read `status` here โ `LABELED` means the carton goes to the truck by its `sortLane`, `DIVERTED` means it goes to problem-solve. Side-effect-free (see [ADR-0033](/docs/adr/0033-package-read-model)).
Run the SLAM weigh-check on a sealed package
SLAM = Scan, Label, Apply, Manifest. Weighs a sealed package: if `|actualWeight - expectedWeight|` is within tolerance (0.05, same unit as the two weights โ e.g. kilograms), a shipping label is applied (`LabelApplied`); otherwise the package is diverted (`WeightDiscrepancyDetected` + `PackageDiverted`) rather than shipped with a wrong manifest. Idempotent in effect once processed: a repeat call on an already-labeled-or-diverted package returns `409` rather than re-processing it.