Commerce Layer
Compiled RobotRoss knowledge page generated from RobotRoss source code, architecture notes, and operational documentation.
Contents
Commerce Layer Subsystem
1. Role
The Commerce Layer is the central cloud-based "brain" of the RobotRoss ecosystem. It manages the global order queue, competitive bidding for the physical Wall of Fame, and provides the public-facing API for integrations with Shopify, Virtuals ACP, and other 3rd party agents.
2. Main API Server: server.mjs
This Node.js server (running on a DigitalOcean VPS) coordinates all commerce activities:
- Order Intake: Accepts orders from Shopify webhooks, Virtuals ACP, and direct API calls.
- Competitive Bidding: Enforces a 120% overwrite rule for slots on the 64-position (A1-H8) Wall of Fame.
- Queue Management: Status-based tracking (
new,claimed,in_progress,complete,failed). - Artist Handshake: Provides endpoints for the Artist (Mac Mini) to poll for and claim jobs.
- Proof Delivery: Manages the
/proof/:idbranded delivery pages that redirect to YouTube.
3. Order Lifecycle
The full lifecycle of an order across the Commerce Layer:
- Creation: Order enters via
POST /salesman/ordersor webhook. - Polling: Artist polls
GET /salesman/orders/incoming?status=new. - Claim/ACK: Artist claims and acknowledges the start of work.
- Completion: Artist uploads the YouTube URL via
POST /salesman/orders/:id/complete. - Fulfilment: Server triggers write-back to the origin (e.g., Shopify metadata).
4. Key Configurations
- Database:
/var/lib/salesman-api/orders.json(flat file for simplicity and auditability). - Environment: Managed via
systemdon therobotsalesVPS. - Offering:
offering.jsondefines the Virtuals ACP marketplace entry.
5. Notes and Open Points
- Atomic Locking: The use of a single
orders.jsonflat file for persistence implies that high-concurrency writes must be handled carefully. The current implementation uses simple file-system writes; as volume grows, this may become a point of contention. - ACP Mapping: A known bug exists in
server.mjswheresvgoffering IDs may map incorrectly to thewritetype instead ofsketch. - Shopify Metafields: The process for writing back proof-of-work URLs to Shopify relies on a specific metafield (
custom.proof_of_work), but the recovery path if this fails is not fully automated.
Sources:
AGENTS/CONTEXT/robot_ross_salesman.mdsalesman-cloud-infra/opt/salesman-api/server.mjssalesman-cloud-infra/opt/salesman-api/offering.json