pages / example / resale_edge

example · resale_edge

canister coord://offchain/genie/program/resale_edge@v1/081e56d9d415ec57 · v1 · artifact root 0x081e56d9d415ec57b2d7b48dfc54dae340c2708db3145bc299d03dd7e89e2baa · 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)

the words it says

its helpdesk graph

resale edge (a .genie program) in the studio: 10 symptoms, 10 fixes

the source

// _RESALE_EDGE_v1_ (owner 2026-10-28: "implement each and every one under an actionable genie program and the coord stream pipe rule,
// where edge is defined as the whole resale, from acquire paying into selling to the other venue"). An edge is ONE resale end to end:
// we read a supply venue's offer, list it on a buyers' venue, take a buyer's paid order there, acquire the work from the supply venue
// (we pay it, from its prepaid balance or per call), deliver the answer the buyer named, settle the buyer's payment into the vault,
// pay the supply venue its leg and record the sale. The route register (lang/cue/open-market.cue → lang/gen/open-market.json) states
// each step of each edge live or not, and its four gates (price, terms, pay_to, model); the stream (register/stream.json) ranks what
// to build by the buyer USD a step blocks. Every move below is one hop of the commerce sale and one pipe envelope (`effect record`),
// so the edge's conversation is on the pipe and its money moves only through the vault, under its caps, on a meter.
//
// The edges of 2026-10-28 (the inference market review):
//   x402_per_call   deepinfra | venice → x402-base: gpt-oss-120b per call; buyers there pay 0.005 USDC a call, ours is 0.000266
//                   (seller 0.000221 + 20 %). OPEN in the register since _SERVED_SUPPLY_v1_ (the venue we buy from is served).
//   olas_takeover   near-ai → olas-gnosis: a paid prediction request its priority mech left past its 300 s timeout, answered by our
//                   mech (service 3833) on a NEAR model and delivered through the loop signer's mech.deliver; 0.01 xDAI a request.
//   near_cloud      deepinfra | taifoon-gpu → NEAR AI Cloud: our models as an upstream of its catalogue (PATCH /v1/admin/models,
//                   providerType external, backend openai_compatible); NEAR pays our price per token from its key's balance.
// Run one: COORD_API_KEY=<a relayer key> node lang/genie/cli.mjs run lang/genie/examples/resale_edge.genie --input model=gpt-oss-120b
// (dry by default; --send runs the ops). Nothing here signs: the settle and the payout stand behind their guards and the vault's caps.
genie resale_edge v1
about "One resale end to end: acquire from a supply venue, sell on a buyers' venue, settle through the vault, pay the supplier, record"

use venue deepinfra venice near-ai x402-base olas-gnosis
use chain every
use vault vault:taifoon:loop vault:taifoon:kms
use product taifoon.api
use guard owner-arm signer-allowlist day-cap receipt-check sign-sale-backing

agent edge is "one resale, from the supply venue's offer to the buyer's paid answer and the supplier's leg"
  states read listed taken acquired delivered settled supplier_paid recorded refused_model refused_terms priced_out held failed
  start read
  final recorded refused_model refused_terms priced_out held failed
  failed refused_model refused_terms priced_out failed
  read GET /v1/models as models
  read GET /v1/match/demands as demands
  // the gates of the route, in their order of precedence: the model, the terms, the price, the buyers' venue's entry cost
  move read -> refused_model when card.model_known != true
  move read -> refused_terms when supply.terms == "forbidden"
  move read -> priced_out when price.buyer_usd > demand.pays_usd
  move read -> held when venue.held == true
  move read -> listed when card.available == true hop listed venue x402-base op GET /v1/models effect record
  move read -> failed
  // take: a buyer's verified payment on its own venue (x402 exact on Base, a key balance, or a prepaid mech request on Gnosis)
  move listed -> taken when order.paid == true hop hired venue x402-base effect record
  // acquire: the request routed to the supply venue under our key; the supplier is paid from its balance (pay-across.mjs)
  move taken -> acquired hop delivered venue deepinfra op POST /v1/chat/completions effect record
  move acquired -> delivered when answer.model_matches == true hop graded effect record
  move acquired -> failed
  move delivered -> settled guard receipt-check sign-sale-backing via vault:taifoon:loop on every cap 50000 USDC meter taifoon.api hop settled effect record
  move settled -> supplier_paid guard owner-arm day-cap via vault:taifoon:kms on every cap 50000 USDC meter taifoon.api hop paid effect record
  move supplier_paid -> recorded hop recorded op POST /v1/pipe/send effect record
  refuse no_route "an edge names a supply venue and a buyers' venue of the route register (lang/gen/open-market.json)"
  say read "The supply venue's offer was read: its model, its price, its terms"
  say listed "Listed on the buyers' venue at the seller's price plus 20 %"
  say taken "A buyer paid on its own venue"
  say acquired "The request went to the supply venue under our key and was answered"
  say delivered "Delivered: the answer is the model the buyer named (model_delivery)"
  say settled "The buyer's payment settled into the loop vault"
  say supplier_paid "The supply venue's leg was paid from the vault (its balance or per call)"
  say recorded "Recorded: one sale, its legs, its envelopes on the pipe"
  say refused_model "Refused: the model is no row of the model table (models.cue): a closed vendor model is not resold"
  say refused_terms "Refused: the supply venue's terms forbid resale"
  say priced_out "Priced out: the seller's price plus 20 % is over what the buyers pay"
  say held "Held: listing on the buyers' venue costs money before a buyer paid (zero-dollar rule)"
  say failed "Failed: the supply venue did not answer as the model; the buyer is not charged"
  next read listed "The register's gates decide; a passing card is listed on the buyers' venue"
  next listed taken "Wait for a buyer: the listing is public, the first paid order moves the edge"
  next settled supplier_paid "The supplier's leg is paid from the vault once the payout path is armed"

agent olas_takeover is "one paid Olas request its priority mech left undelivered past its timeout, answered and delivered by our mech"
  states seen eligible answered pinned delivered credited skipped failed
  start seen
  final credited skipped failed
  failed failed
  read GET /v1/olas/mechs as mechs
  move seen -> skipped when request.status != "requested_expired"
  move seen -> skipped when request.tool_known != true
  move seen -> eligible when day.count < day.cap hop hired venue olas-gnosis effect record
  move seen -> skipped
  move eligible -> answered hop delivered venue near-ai op POST /v1/chat/completions effect record
  move answered -> pinned when answer.format_ok == true hop graded effect record
  move answered -> failed
  move pinned -> delivered guard signer-allowlist day-cap receipt-check hop settled venue olas-gnosis effect record
  move delivered -> credited when tracker.credited == true hop paid venue olas-gnosis effect record
  move delivered -> failed
  say seen "A request on the Gnosis marketplace was read"
  say eligible "Past its timeout, undelivered, a tool we answer, under the day's cap"
  say answered "Answered on a NEAR model through our gateway, in the tool's own format"
  say pinned "The answer is pinned on IPFS and read back"
  say delivered "Delivered through our mech by the loop signer (mech.deliver)"
  say credited "The balance tracker credited our mech the request's price"
  say skipped "Skipped: its priority mech may still answer, the tool is not ours, or the day's cap is reached"
  say failed "Failed: the answer did not parse, or the marketplace credited nothing"
  next seen eligible "Only a request past its timeout is ours to take"
  next delivered credited "The marketplace pays the delivering mech inline"

vault vault:taifoon:loop
  grid taifoon.api per_call 1 per_day 100000
  cap USDC every per_tx 50000 per_day 5000000

vault vault:taifoon:kms
  grid taifoon.api per_call 1 per_day 100000
  cap USDC every per_tx 50000 per_day 5000000

agreement resale_edge
  parties buyer seller layer
  hops offer_in classify listed hired delivered graded settled legs accrued split paid recorded
  leg our_fee 20% over
  leg seller_share rest
  settle via vault:taifoon:loop meter taifoon.api
  venue deepinfra venice near-ai x402-base olas-gnosis
  term "our fee is 20 % over the seller's price (lang/emit/margin.mjs): the buyer pays seller + fee, the seller keeps its price"
  term "the supply venue is paid where it delivered, from its own balance or per call; never a payout network we choose"

knowledge
  symptom "an edge reads open but sells nothing" caused_by "every regular buyer on the venue is bound to its own seller's URL" fixed_by "reach the seller the buyers are bound to with our supply under its price (market_match reach)"
  symptom "a closed vendor model shows as a route" caused_by "a venue resells a model that is no row of models.cue" fixed_by "the model gate refuses it; a model joins models.cue only with open weights"
  symptom "the supplier is never paid for a delivered sale" caused_by "the payout path is not armed" fixed_by "the owner step keyed-payout-submit-on (one command with the owner's MFA)"
  symptom "the Olas takeover delivers nothing" caused_by "every request was answered by its priority mech inside its timeout" fixed_by "nothing to fix: the takeover only takes what the priority mech left"
  rule "an edge is the whole resale: we pay the supplier, the buyer pays us on its venue; half an edge is work"
  rule "every hop is one pipe envelope; money moves only through a named vault under its caps, on a meter"
  term "edge" is "one resale end to end: a supply venue's offer acquired and sold on another venue, every hop on the pipe"