pages / example / market_onboard
canister coord://offchain/genie/program/market_onboard@v1/6f5cfb1af807e4bf · v1 · artifact root 0x6f5cfb1af807e4bfbde321e069a1c1c606108554605bba1a6518bb7b03baeefe · previous none (first version) · superroot at publish not sealed yet
sealed cases that reached it: 0 — sealed cases that reached this word (the store counts, never reads)
market onboard (a .genie program) in the studio: 8 symptoms, 8 fixes
// _GENIE_MARKET_ONBOARD_v1_ — every market, every class its buyers pay for, and the one step that sells there. A cell is one venue × // one class × one supply that can serve it. The agent `cell` walks a cell from the buyers' side to exactly one action: no venue, no // demand, supply to onboard, the route's first missing field (each names who closes it), an edge to write, or an edge that sells. // The agent `node_check` takes our own medicine: the nodes other people read (venues, resale routes, exchange edges, the match index, // the x402 Bazaar mirror) answer their contract, or the run names the first one that does not. // `node lang/genie/cli.mjs markets` runs `cell` over every cell of the live venues (the board); `run … --agent node_check` checks the nodes. // Run one cell: COORD_API_KEY=<a relayer key> node lang/genie/cli.mjs run lang/genie/examples/market_onboard.genie \ // --input venue=x402-base --input class=inference.chat --input supply=gpu:deepinfra // A class of the class language reads its buyers from GET /v1/venues (classes); an inference class (inference.chat, inference.mixed…) // from the sides view (GET /v1/venues?view=sides: inference), where the paid inference calls are counted per venue. genie market_onboard v1 about "List every market and the class its buyers pay for, and walk each cell to the one step that sells there; check the nodes we share answer their contract" agent cell is "one market cell: a venue, a class its buyers pay for, a supply that serves it" states observed demand routed complete edged agreed no_venue classify_jobs no_demand onboard_supply close_meter onboard_seller list_demand open_rail reference_only price_supply route_supply owner_step house_class write_edge selling unsold start observed final no_venue classify_jobs no_demand onboard_supply close_meter onboard_seller list_demand open_rail reference_only price_supply route_supply owner_step house_class write_edge selling unsold failed no_venue read GET /v1/venues as place pick venues where row.id == input.venue read GET /v1/venues as want pick classes where row.class == input.class read GET /v1/venues with view from "sides" as fed pick inference where row.venue == input.venue and row.class == input.class read GET /v1/resale as route pick routes where row.supply == input.supply and row.demand == input.venue read GET /v1/exchanges as edge pick rows where row.class == input.class and row.chain_id == 8453 and row.check.passed == true move observed -> no_venue when not place move observed -> demand when fed.buy.usd > 0 move observed -> classify_jobs when not want and place.demand.usd_7d > 0 move observed -> no_demand when not want move observed -> no_demand when want.usd_7d <= 0 move observed -> demand move demand -> onboard_supply when not route move demand -> routed move routed -> complete when route.complete == true move routed -> close_meter when route.missing.0.field == "meter.step" move routed -> onboard_seller when route.missing.0.field == "supply.delivers" move routed -> list_demand when route.missing.0.field == "demand.listed" move routed -> open_rail when route.missing.0.field == "demand.rail" move routed -> reference_only when route.missing.0.field == "supply.terms" move routed -> price_supply when route.missing.0.field == "supply.price" move routed -> route_supply when route.missing.0.field == "supply.route" move routed -> owner_step // _HOUSE_CLASS_ONLY_v1_ (2026-10-29): a complete route of our own GPU lanes (route.product gpu) sells only through a house edge, and the // house writes only inference.chat; another class there is the owner's step, never a task move complete -> house_class when not edge and route.product == "gpu" and input.class != "inference.chat" move complete -> write_edge when not edge move complete -> edged move edged -> agreed op GET /v1/exchanges/:edge_id/agreement with edge_id from edge.edge_id into agreement move agreed -> selling op GET /v1/exchanges/:edge_id/meter with edge_id from edge.edge_id into lines when edge.state == "live" move agreed -> unsold say no_venue "The layer reads no venue by that name" say classify_jobs "Buyers pay on this venue and the layer classifies none of their jobs as this class: classify the venue's jobs first" say no_demand "No buyer of the venue paid for this class in the last seven days" say onboard_supply "Buyers pay for this class here and the layer has no supply that serves it: onboard an agent of the class" say close_meter "The route is complete but for its meter step: the wall that resells it writes no line yet" say onboard_seller "The supply has not delivered through the layer yet: probe and onboard the seller" say list_demand "The layer is not listed on this venue yet" say open_rail "The venue has no rail the layer can be paid on yet" say reference_only "The supply's terms forbid resale: its price is a reference only" say price_supply "The supply has no price the layer can quote" say route_supply "The layer has no route to the supply" say owner_step "The route waits on an owner step; the route names it" say house_class "The supply is our own GPU lane and the house sells only inference.chat (HOUSE_OFFER_v1, one edge per model): an edge of this class needs the owner's yes to widen the house offer, or an outside seller of the class" say write_edge "The route is complete and no Base edge of the class has passed its check: write the edge" say selling "A Base edge of the class is live: buyers' calls go through it and each writes a meter line" say unsold "A Base edge of the class passed its check and is not live: no outside payment has reached it" next observed demand "Name a venue and a class its buyers pay for (GET /v1/venues: classes[].venues)" next demand routed "Name a supply that serves the class (the reseller engines of GET /v1/resale)" next complete edged "A complete route sells through one Base edge of its class" agent node_check is "the nodes we share answer their contract: one read each, the first that does not is named" states checking venues_ok resale_ok edges_ok offers_ok answering broken_venues broken_resale broken_edges broken_offers broken_bazaar start checking final answering broken_venues broken_resale broken_edges broken_offers broken_bazaar failed broken_venues broken_resale broken_edges broken_offers broken_bazaar read GET /v1/venues as venues read GET /v1/resale as resale read GET /v1/exchanges as edges read GET /v1/match/offers as offers read GET /v1/x402/bazaar as bazaar move checking -> venues_ok when venues.schema == "taifoon.venues.v1" and venues.venues.0.id and venues.classes.0.class move checking -> broken_venues move venues_ok -> resale_ok when resale.schema == "taifoon.resale.view.v1" and resale.routes.0.supply and resale.counts.routes > 0 move venues_ok -> broken_resale move resale_ok -> edges_ok when edges.schema == "taifoon.exchanges.v1" and edges.rows.0.edge_id and edges.count > 0 move resale_ok -> broken_edges move edges_ok -> offers_ok when offers.schema == "taifoon.match.offers.v1" and offers.totals.offers > 0 move edges_ok -> broken_offers move offers_ok -> answering when bazaar.ok == true and bazaar.rows.0.resource and bazaar.payable > 0 move offers_ok -> broken_bazaar say answering "Every shared node answered its contract" say broken_venues "GET /v1/venues did not answer its contract: the venues and the classes their buyers pay for" say broken_resale "GET /v1/resale did not answer its contract: the resale routes and their counts" say broken_edges "GET /v1/exchanges did not answer its contract: the exchange edges" say broken_offers "GET /v1/match/offers did not answer its contract: the match index totals" say broken_bazaar "GET /v1/x402/bazaar did not answer its contract: payable Bazaar rows" next checking venues_ok "Each node is read once; a node passes when its schema and its first row are there" knowledge symptom "a cell ends at onboard_supply" caused_by "buyers pay for the class on the venue and no supply route serves it" fixed_by "GET /v1/classes/:class/agents names the agents of the class; onboard one (POST /v1/exchanges/auto)" symptom "a cell ends at close_meter" caused_by "the route's meter row writes no line on the stream" fixed_by "the route names its meter row; the register's row and the live answer may differ until the node is deployed" symptom "a cell ends at unsold" caused_by "the edge passed its check and no outside payment reached it" fixed_by "list the edge where the class's buyers pay (the venue of the cell)" symptom "node_check ends broken" caused_by "a shared node answered without its schema or its first row" fixed_by "read the node's answer; a 401 or 429 is the key, anything else is the node" rule "a cell's facts come from the live nodes; nothing is typed into the program" rule "the program reads and records: no edge is written, no call is sold, nothing is signed"