e67f0ccef0
The operator's category choice is a hypothesis, not truth (user, 2026-09-06): each wash order with a vehicle read queues a package for a trusted reviewer over the private overlay (Netbird); the verdict becomes the phase-B training label and the per-operator error rate. wiki/concepts/vision-review-outbox.md. - Boxes: the vision service returns the vehicle bbox; snapshot.ts stores the vehicle and plate boxes on the read as FRACTIONS of the analysed frame (the stored snapshot is a downscaled copy); vehicleForIdentity() returns them. - carwash_review_outbox (migration 0031) + review-outbox.ts: crop = detector box + 8 % margin, ≤ 640 px, plate blurred in place from the plate box; payload carries a pseudonymous booth id and a keyed operator hash — no site name, no plate, no OSD, no bystanders; multipart POST with a per-booth bearer; 2xx → sent (image dropped); 400/404/413/415/422 → abandoned; anything else → backoff 1 min·2^n capped 6 h; voided orders and items older than 14 days abandoned unsent. Nothing queued while unconfigured. - Enqueue is fire-and-forget off the intake path in createOrder; the loop runs every CARWASH_REVIEW_INTERVAL_SEC (60) and stops on close. - GET /api/carwash/review/status (site:read) + a "Remote review" line in Setup → Car wash. - Env CARWASH_REVIEW_URL / _TOKEN / _BOOTH_ID (all three or off) documented in .env.example and forwarded by compose. - Tests: review-outbox.test.ts (crop + blur on a synthetic frame, config/pseudonyms, queue/drain/backoff/abandon, through the app). Wiki: new concept page, index, venue-modules As built, log. The collector is not built. Claude-Session: https://claude.ai/code/session_01FWncR69HgGPuei1dLrW3cU
29 lines
1.6 KiB
TypeScript
29 lines
1.6 KiB
TypeScript
import type { ServerModule } from "../index.js";
|
|
import { ReviewOutbox, reviewUploadConfigFromEnv } from "./review-outbox.js";
|
|
import { carwashRoutes } from "./routes.js";
|
|
import { CarwashService } from "./service.js";
|
|
|
|
// Car Wash — the pilot venue module (wiki/decisions/venue-modules.md). Everything the
|
|
// module is lives in this folder: its service (master data, the order queue, the bay
|
|
// payment, the parking sponsorship + settlement), its routes, and the booth charge
|
|
// provider it registers with the core's PayStation. The core knows it only through the
|
|
// registry line in ../index.ts and the manifest in @parking/shared.
|
|
export const carwashModule: ServerModule = {
|
|
id: "carwash",
|
|
async register(app, deps) {
|
|
// The review outbox (wiki/concepts/vision-review-outbox.md): on when the stack env
|
|
// names a collector URL, a per-booth token and a pseudonymous booth id; off = no
|
|
// queueing at all. One-way, background, never on the intake path.
|
|
const cfg = reviewUploadConfigFromEnv();
|
|
const outbox = new ReviewOutbox(deps.db, app.log, cfg);
|
|
app.log.info(cfg ? `carwash review upload: on → ${new URL(cfg.url).host} as ${cfg.boothId}` : "carwash review upload: off");
|
|
outbox.start();
|
|
app.addHook("onClose", async () => outbox.stop());
|
|
const service = new CarwashService(deps, app.log, outbox);
|
|
// A wash ordered with payAt = "booth" is a charge line on the parking settlement;
|
|
// the core calls back after the payment is signed so the order is marked paid.
|
|
deps.payStation.registerChargeProvider(service.chargeProvider());
|
|
await carwashRoutes(app, deps, service, outbox);
|
|
},
|
|
};
|