mtok-relay 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4648,7 +4648,8 @@ function readRelayConfig({ argv = process.argv.slice(2), env = process.env } = {
4648
4648
  const sellerAgentId = flag(argv, "--seller-agent");
4649
4649
  const outPrice = Number(flag(argv, "--out-price") ?? 0);
4650
4650
  const inPrice = Number(flag(argv, "--in-price") ?? outPrice);
4651
- const redemptionFile = flag(argv, "--redemption-file") ?? env.RELAY_REDEMPTION_FILE ?? null;
4651
+ const redemptionFlag = flag(argv, "--redemption-file") ?? env.RELAY_REDEMPTION_FILE;
4652
+ const redemptionFile = redemptionFlag === void 0 ? "./.mtok-redemption.jsonl" : redemptionFlag || null;
4652
4653
  const denylistRaw = flag(argv, "--payer-denylist") ?? env.RELAY_PAYER_DENYLIST ?? "";
4653
4654
  const payerDenylist = String(denylistRaw).split(",").map((a) => a.trim().toLowerCase()).filter(Boolean);
4654
4655
  if (!offerId) throw new Error("--offer <id> is required");
@@ -5151,7 +5152,6 @@ async function createRelayRuntime(config) {
5151
5152
  return withBookingLock(bookingId, async () => {
5152
5153
  const requestHash = hash32(request);
5153
5154
  const cacheKey = `${bookingId}:${n}:${requestHash}`;
5154
- if (served.has(cacheKey)) return send(res, 200, served.get(cacheKey));
5155
5155
  if (!platform.dripContractAddress) {
5156
5156
  return send(res, 402, { error: "contract_mode_required", detail: "this relay only serves contract-mode draws; the platform is not reporting a dripContractAddress" });
5157
5157
  }
@@ -5190,6 +5190,7 @@ async function createRelayRuntime(config) {
5190
5190
  } catch (e) {
5191
5191
  return send(res, 403, { error: "payer_denied", detail: "payer screening failed: " + e.message });
5192
5192
  }
5193
+ if (served.has(cacheKey)) return send(res, 200, served.get(cacheKey));
5193
5194
  const paidEvent = paid.event;
5194
5195
  const remainingUsd = Number(paid.event.sellerUsdAtomic || 0) / 1e6;
5195
5196
  if (remainingUsd <= BALANCE_EPSILON) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mtok-relay",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Reference seller relay for mtok.market — accepts on-chain-prepaid chunk draws and serves inference from an upstream you control. Run with: npx mtok-relay --offer <id> --model <id> --upstream <url>.",
5
5
  "type": "module",
6
6
  "bin": {