@dvmkit/sdk 0.7.0-rc.3 → 0.7.0-rc.5

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.
Files changed (51) hide show
  1. package/dist/{chunk-3UK3CDOT.js → chunk-3NVM4WPI.js} +56 -40
  2. package/dist/{chunk-TRNMTTPX.js → chunk-6RYCZLCK.js} +1 -1
  3. package/dist/{chunk-2OM2QPBE.js → chunk-BDHJVTWA.js} +1 -1
  4. package/dist/{chunk-H5FVVEEN.js → chunk-BIZR5ORK.js} +2 -2
  5. package/dist/{chunk-RXPHMS4C.js → chunk-BQP3LU2O.js} +1 -1
  6. package/dist/{chunk-I555L2WK.js → chunk-FOJKZ4E7.js} +1 -1
  7. package/dist/{chunk-LAKP6FUI.js → chunk-FXDQMJQ2.js} +29 -1
  8. package/dist/{chunk-MON76YBJ.js → chunk-GDCIHJAR.js} +1 -1
  9. package/dist/{chunk-DNG4KGSC.js → chunk-GKIOZCL7.js} +1 -1
  10. package/dist/{chunk-6STC5TCP.js → chunk-HG2CZPRJ.js} +1 -1
  11. package/dist/{chunk-IIZQNDQU.js → chunk-JUEEUV5X.js} +1 -1
  12. package/dist/{chunk-HCE4MPZ5.js → chunk-KYCLHWKO.js} +1 -1
  13. package/dist/{chunk-CLIAFTUR.js → chunk-LQQ6H4UB.js} +119 -20
  14. package/dist/{chunk-RAGX6VG7.js → chunk-MYJOV4R4.js} +1 -1
  15. package/dist/{chunk-USL7ZEXN.js → chunk-NUPEAWRM.js} +1 -1
  16. package/dist/{chunk-VB5OLOZH.js → chunk-QTH7CIA3.js} +1 -1
  17. package/dist/{chunk-AQ7OX5NX.js → chunk-SX4WCPW7.js} +1 -1
  18. package/dist/{chunk-SPYEJXI7.js → chunk-WP7UX6RF.js} +2 -2
  19. package/dist/{chunk-72V5DTEC.js → chunk-X5RY2G3C.js} +1 -1
  20. package/dist/{chunk-26W6GPCD.js → chunk-XEOTTFLH.js} +1 -1
  21. package/dist/{chunk-GSLS4464.js → chunk-YK54BJ2L.js} +1 -1
  22. package/dist/{content-retention-ChFSSVO0.d.ts → content-retention-z1fRPIkt.d.ts} +1 -1
  23. package/dist/{credit-ledger-7Z7LOCTN.js → credit-ledger-SW4BGMNH.js} +3 -3
  24. package/dist/{credit-menu-fy0DDigm.d.ts → credit-menu-CJl2Ysc-.d.ts} +9 -4
  25. package/dist/{fx-DM0_NYiE.d.ts → fx-Cin14QvX.d.ts} +10 -3
  26. package/dist/index.d.ts +5 -5
  27. package/dist/index.js +4 -4
  28. package/dist/internal/caller.d.ts +6 -6
  29. package/dist/internal/caller.js +6 -6
  30. package/dist/internal/server.d.ts +7 -7
  31. package/dist/internal/server.js +19 -19
  32. package/dist/{job-store-DkfNE9sv.d.ts → job-store-BtdD_xt1.d.ts} +1 -1
  33. package/dist/{lightning-backend-C3Gf1XpP.d.ts → lightning-backend-BYTODXJ2.d.ts} +1 -1
  34. package/dist/{memory-credit-ledger-3WOS74UH.js → memory-credit-ledger-E4C3VQE4.js} +4 -4
  35. package/dist/{mpp-setup-XB4KATMU.js → mpp-setup-BYKGEYFA.js} +2 -2
  36. package/dist/{payout-reporter-WT7XYW42.js → payout-reporter-KOGHXJH4.js} +2 -2
  37. package/dist/{postgres-consumed-credential-store-W7UP33AH.js → postgres-consumed-credential-store-EZ4KETWH.js} +1 -1
  38. package/dist/{postgres-job-store-3KGUGFRD.js → postgres-job-store-E6AUHNKB.js} +2 -2
  39. package/dist/{postgres-replay-store-CVNJJOQG.js → postgres-replay-store-GIYZS4LJ.js} +2 -2
  40. package/dist/{pricing-QAVZUTZR.js → pricing-DG5IJ5QF.js} +3 -3
  41. package/dist/{revenue-reporter-7UR3W2SD.js → revenue-reporter-E56J3NZK.js} +2 -2
  42. package/dist/server/index.d.ts +10 -10
  43. package/dist/server/index.js +25 -25
  44. package/dist/{step-cache-DDTwd4SK.d.ts → step-cache-C6lMgDH8.d.ts} +7 -0
  45. package/dist/{tempo-charge-store-GA6CED6O.js → tempo-charge-store-WTBIX2JX.js} +2 -2
  46. package/dist/{tempo-session-store-WZWQRITB.js → tempo-session-store-AWIFUAA6.js} +3 -3
  47. package/dist/testing/index.d.ts +3 -3
  48. package/dist/testing/index.js +5 -5
  49. package/dist/{usd-DkRy9nfU.d.ts → usd-5v1FQ7Mn.d.ts} +1 -1
  50. package/dist/{x402-ZU4GML7Z.js → x402-BN26TQZ6.js} +3 -3
  51. package/package.json +1 -1
@@ -7,7 +7,7 @@ import {
7
7
  installHostedTempoCloseGuard,
8
8
  isTempoInsufficientFundsError,
9
9
  resolveTempoNetwork
10
- } from "./chunk-HCE4MPZ5.js";
10
+ } from "./chunk-KYCLHWKO.js";
11
11
  import {
12
12
  createX402FacilitatorAuthHeaders,
13
13
  createX402FacilitatorClient,
@@ -16,13 +16,13 @@ import {
16
16
  verifyWithFacilitator,
17
17
  withPaymentDiagnostics,
18
18
  withPaymentStage
19
- } from "./chunk-26W6GPCD.js";
19
+ } from "./chunk-XEOTTFLH.js";
20
20
  import {
21
21
  MemoryCreditLedger
22
- } from "./chunk-I555L2WK.js";
22
+ } from "./chunk-FOJKZ4E7.js";
23
23
  import {
24
24
  PostgresJobStore
25
- } from "./chunk-IIZQNDQU.js";
25
+ } from "./chunk-JUEEUV5X.js";
26
26
  import {
27
27
  parseStoreValue
28
28
  } from "./chunk-YG7G4DPZ.js";
@@ -33,7 +33,7 @@ import {
33
33
  humanizeZodIssues,
34
34
  signedRequestInput,
35
35
  zodIssuesOf
36
- } from "./chunk-72V5DTEC.js";
36
+ } from "./chunk-X5RY2G3C.js";
37
37
  import {
38
38
  MemoryJobStore,
39
39
  UNCAPPABLE_ASK_TOTAL,
@@ -42,7 +42,7 @@ import {
42
42
  isJobRetentionStore,
43
43
  isReceiptIssuingStore,
44
44
  isStreamableJobStore
45
- } from "./chunk-RAGX6VG7.js";
45
+ } from "./chunk-MYJOV4R4.js";
46
46
  import {
47
47
  ContentHoldError,
48
48
  JobCancelledError,
@@ -80,7 +80,7 @@ import {
80
80
  signReceipt,
81
81
  toLockPubkey,
82
82
  verifyChallenge
83
- } from "./chunk-VB5OLOZH.js";
83
+ } from "./chunk-QTH7CIA3.js";
84
84
  import {
85
85
  X402_BATCH_SETTLEMENT_SCHEME,
86
86
  X402_DEFAULT_FACILITATOR,
@@ -112,7 +112,7 @@ import {
112
112
  pinDimension,
113
113
  withSpan,
114
114
  withTraceContext
115
- } from "./chunk-AQ7OX5NX.js";
115
+ } from "./chunk-SX4WCPW7.js";
116
116
  import {
117
117
  StepCache
118
118
  } from "./chunk-BQJIFRAZ.js";
@@ -124,11 +124,12 @@ import {
124
124
  fiatToSatsCeil,
125
125
  fxRateFor,
126
126
  parseUsdPrice,
127
+ readFxSourceFailure,
127
128
  resolveFxSourceFromEnv,
128
129
  roundUsd,
129
130
  satsToFiat,
130
131
  validateCurrency
131
- } from "./chunk-CLIAFTUR.js";
132
+ } from "./chunk-LQQ6H4UB.js";
132
133
  import {
133
134
  CreditLedger,
134
135
  CreditLedgerError,
@@ -144,10 +145,10 @@ import {
144
145
  isNonChannelBitcoinRail,
145
146
  netOwedSats,
146
147
  x402SettlementPending
147
- } from "./chunk-SPYEJXI7.js";
148
+ } from "./chunk-WP7UX6RF.js";
148
149
  import {
149
150
  withPostgresRecoveryContext
150
- } from "./chunk-TRNMTTPX.js";
151
+ } from "./chunk-6RYCZLCK.js";
151
152
  import {
152
153
  DvmError,
153
154
  x402NetworkByCaip2
@@ -155,7 +156,7 @@ import {
155
156
  import {
156
157
  createDiagnosticCapabilityAuthority,
157
158
  diagnosticConsole
158
- } from "./chunk-LAKP6FUI.js";
159
+ } from "./chunk-FXDQMJQ2.js";
159
160
  import {
160
161
  MemoryProcessedPaymentStore,
161
162
  PostgresProcessedPaymentStore,
@@ -1066,7 +1067,8 @@ async function resolveFxSnapshot(fetcher) {
1066
1067
  return {
1067
1068
  ok: false,
1068
1069
  reason: "rate_stale_refused",
1069
- detail: `snapshot ${err.knownStale.staleDays.toString()}d stale`
1070
+ detail: `snapshot ${err.knownStale.staleDays.toString()}d stale`,
1071
+ sourceFailure: readFxSourceFailure(err)
1070
1072
  };
1071
1073
  }
1072
1074
  const cached = fetcher.lastKnown?.();
@@ -1076,7 +1078,8 @@ async function resolveFxSnapshot(fetcher) {
1076
1078
  return {
1077
1079
  ok: false,
1078
1080
  reason: "rate_unavailable",
1079
- detail: err instanceof Error ? err.message : String(err)
1081
+ detail: err instanceof Error ? err.message : String(err),
1082
+ sourceFailure: err instanceof FxRateUnavailableError ? readFxSourceFailure(err) ?? { category: "unknown" } : { category: "unknown" }
1080
1083
  };
1081
1084
  }
1082
1085
  }
@@ -1103,7 +1106,10 @@ async function msatsToFiatMicro(args) {
1103
1106
  // A currency the snapshot never carried is the rate source narrowing, not
1104
1107
  // a currency this DVM doesn't speak — `fxRateFor` separates the two.
1105
1108
  reason: err instanceof FxRateUnavailableError ? "rate_unavailable" : "unsupported_currency",
1106
- detail: err instanceof Error ? err.message : String(err)
1109
+ detail: err instanceof Error ? err.message : String(err),
1110
+ ...err instanceof FxRateUnavailableError && {
1111
+ sourceFailure: readFxSourceFailure(err) ?? { category: "unknown" }
1112
+ }
1107
1113
  };
1108
1114
  }
1109
1115
  const amountMicro = Math.round(amount * 1e6);
@@ -3177,7 +3183,7 @@ function paymentFailureFields(error) {
3177
3183
  }
3178
3184
 
3179
3185
  // src/sdk/server/payment.ts
3180
- import { randomBytes, randomUUID as randomUUID2 } from "crypto";
3186
+ import { createHash as createHash4, randomBytes, randomUUID as randomUUID2 } from "crypto";
3181
3187
  import { Challenge } from "mppx";
3182
3188
 
3183
3189
  // src/lib/cashu/verify.ts
@@ -3868,7 +3874,7 @@ async function verifyUpfrontPaymentInScope(opts) {
3868
3874
  x402Requirements
3869
3875
  });
3870
3876
  }
3871
- const { verifyX402Payment } = await import("./x402-ZU4GML7Z.js");
3877
+ const { verifyX402Payment } = await import("./x402-BN26TQZ6.js");
3872
3878
  const receipt = await withPaymentStage("verifier_broadcast", () => verifyX402Payment(
3873
3879
  x402Payment,
3874
3880
  x402Config,
@@ -4856,7 +4862,7 @@ async function verifyIncomingPaymentInScope(body, opts, snapshot) {
4856
4862
  snapshot
4857
4863
  });
4858
4864
  }
4859
- const { verifyX402Payment } = await import("./x402-ZU4GML7Z.js");
4865
+ const { verifyX402Payment } = await import("./x402-BN26TQZ6.js");
4860
4866
  const receipt = await withPaymentStage("verifier_broadcast", () => verifyX402Payment(
4861
4867
  body.content.x402_payment,
4862
4868
  opts.x402Config,
@@ -5287,7 +5293,7 @@ async function processIncomingPaymentInScope(job, body, opts) {
5287
5293
  try {
5288
5294
  const requiredMsats = job.pendingPaymentMsats ?? 0;
5289
5295
  const requiredUsdcMicro = job.pendingX402AmountUsdcMicro !== void 0 ? BigInt(job.pendingX402AmountUsdcMicro) : BigInt(msatsToUsdc(requiredMsats, rate));
5290
- const { verifyX402Payment } = await import("./x402-ZU4GML7Z.js");
5296
+ const { verifyX402Payment } = await import("./x402-BN26TQZ6.js");
5291
5297
  const receipt = await withPaymentStage("verifier_broadcast", () => verifyX402Payment(
5292
5298
  body.content.x402_payment,
5293
5299
  opts.x402Config,
@@ -5675,7 +5681,10 @@ async function resolveTopUpLedgerContext(opts, snapshot, binding) {
5675
5681
  job_id: opts.jobId,
5676
5682
  credit_id: snapshot.creditId,
5677
5683
  draw_id: snapshot.drawId,
5678
- ...extra
5684
+ ...extra,
5685
+ ...typeof opts.jobId === "string" && {
5686
+ job_id_hash: createHash4("sha256").update(opts.jobId, "utf8").digest("hex")
5687
+ }
5679
5688
  }
5680
5689
  );
5681
5690
  };
@@ -5737,7 +5746,11 @@ async function resolveTopUpLedgerContext(opts, snapshot, binding) {
5737
5746
  if (!denomination.ok) {
5738
5747
  logSkip("denomination_unavailable", {
5739
5748
  currency,
5740
- cause: denomination.reason
5749
+ cause: denomination.reason,
5750
+ ...denomination.sourceFailure && {
5751
+ source_failure: denomination.sourceFailure.category,
5752
+ source_status: denomination.sourceFailure.httpStatus
5753
+ }
5741
5754
  });
5742
5755
  return void 0;
5743
5756
  }
@@ -5927,9 +5940,11 @@ async function fundAndDrawInScope(ctx, funding, tx) {
5927
5940
  throw new Error("deposit outbox enqueue requires the rail's open transaction and a DVM id");
5928
5941
  }
5929
5942
  const commitDeposit = async (result, credit) => {
5943
+ const instrument = credit.rail ? storedCreditBinding(credit).instrument : void 0;
5930
5944
  const report = {
5931
5945
  ...deposit,
5932
- callerPubkey: credit.callerPubkey
5946
+ callerPubkey: credit.callerPubkey,
5947
+ ...instrument && { instrument }
5933
5948
  };
5934
5949
  if (createsDepositLiability && enqueue && tx) {
5935
5950
  await enqueue(tx, creditDepositPayload(ctx.dvmId, report));
@@ -6111,6 +6126,7 @@ function creditDepositPayload(dvmId, funding) {
6111
6126
  creditCurrency: funding.currency,
6112
6127
  fundedAt: funding.fundedAt,
6113
6128
  expiryMs: funding.expiryMs,
6129
+ ...funding.instrument && { instrument: funding.instrument },
6114
6130
  // label a session-funded deposit as one, whether or not the chain
6115
6131
  // binding below could be read. `rail: "tempo"` alone does not say — a
6116
6132
  // `tempo/charge` one-shot funds a credit with no channel at all — so this is
@@ -9153,7 +9169,7 @@ async function handle(c, opts, action) {
9153
9169
  }
9154
9170
 
9155
9171
  // src/sdk/server/x402-exact-settlement.ts
9156
- import { createHash as createHash4 } from "crypto";
9172
+ import { createHash as createHash5 } from "crypto";
9157
9173
  var X402ExactSettlementServer = class {
9158
9174
  constructor(opts) {
9159
9175
  this.opts = opts;
@@ -9479,7 +9495,7 @@ function settlementMayHaveMoved(response) {
9479
9495
  return reason.includes("authorization_already_used") || reason.includes("authorization already used") || /facilitator_status_5\d\d/.test(reason);
9480
9496
  }
9481
9497
  function hash(parts) {
9482
- return createHash4("sha256").update(JSON.stringify(parts)).digest("hex");
9498
+ return createHash5("sha256").update(JSON.stringify(parts)).digest("hex");
9483
9499
  }
9484
9500
  function safeError(err) {
9485
9501
  if (err instanceof Error) return err.name;
@@ -9653,7 +9669,7 @@ var HostingCleanupFence = class {
9653
9669
  };
9654
9670
 
9655
9671
  // src/sdk/server/hosting-settlement-report-obligations.ts
9656
- import { createHash as createHash5, randomUUID as randomUUID3 } from "crypto";
9672
+ import { createHash as createHash6, randomUUID as randomUUID3 } from "crypto";
9657
9673
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "util";
9658
9674
  import { BATCH_SETTLEMENT_ADDRESS as BATCH_SETTLEMENT_ADDRESS3 } from "@x402/evm";
9659
9675
  import { computeChannelId as computeChannelId2 } from "@x402/evm/batch-settlement/client";
@@ -9716,7 +9732,7 @@ var TEMPO_CLOSED_EVENT = TempoSession.Precompile.escrowAbi.find(
9716
9732
  (item) => item.type === "event" && item.name === "ChannelClosed"
9717
9733
  );
9718
9734
  function hash2(value) {
9719
- return createHash5("sha256").update(JSON.stringify(value)).digest("hex");
9735
+ return createHash6("sha256").update(JSON.stringify(value)).digest("hex");
9720
9736
  }
9721
9737
  function hex(value, bytes) {
9722
9738
  return typeof value === "string" && new RegExp(`^0x[0-9a-fA-F]{${bytes * 2}}$`).test(value);
@@ -10619,7 +10635,7 @@ var HostedSettlementReportObligations = class {
10619
10635
  };
10620
10636
 
10621
10637
  // src/sdk/server/hosting-channel-evidence.ts
10622
- import { createHash as createHash6 } from "crypto";
10638
+ import { createHash as createHash7 } from "crypto";
10623
10639
  import { Session as TempoSession2 } from "mppx/tempo";
10624
10640
  import { createPublicClient as createPublicClient5, http as http5 } from "viem";
10625
10641
  import { BATCH_SETTLEMENT_ADDRESS as BATCH_SETTLEMENT_ADDRESS4 } from "@x402/evm";
@@ -10670,7 +10686,7 @@ async function readHostedChannelSnapshot(query) {
10670
10686
  };
10671
10687
  const x402HistoryComplete = await history(names[6]);
10672
10688
  const tempoHistoryComplete = await history(names[7]);
10673
- const digest = createHash6("sha256").update(JSON.stringify({
10689
+ const digest = createHash7("sha256").update(JSON.stringify({
10674
10690
  present: [...exists].sort(),
10675
10691
  x402,
10676
10692
  x402Tombstones,
@@ -11819,9 +11835,9 @@ import { AsyncLocalStorage } from "async_hooks";
11819
11835
  import { randomBytes as randomBytes3 } from "crypto";
11820
11836
 
11821
11837
  // src/sdk/server/instrumented-kv.ts
11822
- import { createHash as createHash7 } from "crypto";
11838
+ import { createHash as createHash8 } from "crypto";
11823
11839
  function hashKey(key) {
11824
- return createHash7("sha256").update(key).digest("hex").slice(0, 16);
11840
+ return createHash8("sha256").update(key).digest("hex").slice(0, 16);
11825
11841
  }
11826
11842
  function instrumentKVStore(inner) {
11827
11843
  return {
@@ -16597,7 +16613,7 @@ function withWallClockDeadline(promise, timeoutMs) {
16597
16613
  }
16598
16614
 
16599
16615
  // src/sdk/server/app.ts
16600
- import { createHash as createHash9, randomBytes as randomBytes5, randomUUID as randomUUID6 } from "crypto";
16616
+ import { createHash as createHash10, randomBytes as randomBytes5, randomUUID as randomUUID6 } from "crypto";
16601
16617
  import { Hono } from "hono";
16602
16618
  import { getCookie } from "hono/cookie";
16603
16619
  import { cors } from "hono/cors";
@@ -19386,7 +19402,7 @@ initSchemaForm();
19386
19402
  }
19387
19403
 
19388
19404
  // src/sdk/server/request-fingerprint.ts
19389
- import { createHash as createHash8 } from "crypto";
19405
+ import { createHash as createHash9 } from "crypto";
19390
19406
  function requestFingerprint(req, opts) {
19391
19407
  const canonical = canonicalize({
19392
19408
  capability: req.capability,
@@ -19394,7 +19410,7 @@ function requestFingerprint(req, opts) {
19394
19410
  params: req.params ?? {},
19395
19411
  data: opts.stripAuthEnvelope ? stripEnvelope(req.data) : req.data
19396
19412
  });
19397
- return createHash8("sha256").update(canonical).digest("hex");
19413
+ return createHash9("sha256").update(canonical).digest("hex");
19398
19414
  }
19399
19415
  var ENVELOPE_KEYS = /* @__PURE__ */ new Set(["pubkey", "signature", "timestamp", "nonce", "auth_statement"]);
19400
19416
  function stripEnvelope(data) {
@@ -19517,7 +19533,7 @@ async function createDVMServer(descriptor, opts) {
19517
19533
  }
19518
19534
  }
19519
19535
  if (!opts.onJobCompleted && platformToken && platformUrl && dvmId && opts.db) {
19520
- const { RevenueReporter } = await import("./revenue-reporter-7UR3W2SD.js");
19536
+ const { RevenueReporter } = await import("./revenue-reporter-E56J3NZK.js");
19521
19537
  const reporter = new RevenueReporter(
19522
19538
  opts.db,
19523
19539
  platformUrl,
@@ -19527,7 +19543,7 @@ async function createDVMServer(descriptor, opts) {
19527
19543
  revenueReporter = reporter;
19528
19544
  await reporter.init();
19529
19545
  reporter.startRetryLoop();
19530
- const { MemoryX402BatchStore, PayoutReporter } = await import("./payout-reporter-WT7XYW42.js");
19546
+ const { MemoryX402BatchStore, PayoutReporter } = await import("./payout-reporter-KOGHXJH4.js");
19531
19547
  payoutReporter = new PayoutReporter({
19532
19548
  dvmId,
19533
19549
  db: opts.db,
@@ -20392,7 +20408,7 @@ var DVMServer = class {
20392
20408
  const dvmId = this.opts.dvmId ?? `dev:${this.descriptor.name}`;
20393
20409
  return {
20394
20410
  dvm_id: dvmId,
20395
- builder_pubkey: createHash9("sha256").update(`dvmkit-dev:${dvmId}`).digest("hex")
20411
+ builder_pubkey: createHash10("sha256").update(`dvmkit-dev:${dvmId}`).digest("hex")
20396
20412
  };
20397
20413
  }
20398
20414
  throw new AuthAudienceError();
@@ -20740,7 +20756,7 @@ var DVMServer = class {
20740
20756
  const paymentAuthorization = ctx.req.header("Authorization");
20741
20757
  const mppArtifact = paymentAuthorization ? (await import("mppx")).Credential.extractPaymentScheme(paymentAuthorization) : void 0;
20742
20758
  const attachedPayment = ctx.req.header("X-Cashu") ?? ctx.req.header("PAYMENT-SIGNATURE") ?? ctx.req.header("X-PAYMENT") ?? mppArtifact;
20743
- const paymentArtifactHash = attachedPayment ? createHash9("sha256").update(attachedPayment).digest("hex") : void 0;
20759
+ const paymentArtifactHash = attachedPayment ? createHash10("sha256").update(attachedPayment).digest("hex") : void 0;
20744
20760
  hostingFundingArtifactHash = paymentArtifactHash;
20745
20761
  if (!await control.admit(admissionId, workId, {
20746
20762
  creditId,
@@ -21446,7 +21462,7 @@ var DVMServer = class {
21446
21462
  const authorization = c.req.header("Authorization");
21447
21463
  const mppArtifact = authorization ? (await import("mppx")).Credential.extractPaymentScheme(authorization) : void 0;
21448
21464
  const attachedPayment = c.req.header("X-Cashu") ?? c.req.header("PAYMENT-SIGNATURE") ?? c.req.header("X-PAYMENT") ?? mppArtifact;
21449
- const hostingPaymentArtifactHash = attachedPayment ? createHash9("sha256").update(attachedPayment).digest("hex") : void 0;
21465
+ const hostingPaymentArtifactHash = attachedPayment ? createHash10("sha256").update(attachedPayment).digest("hex") : void 0;
21450
21466
  if (!resumeOnly && this.opts.hostingControlInstance && hostingPaymentArtifactHash) {
21451
21467
  const priorId = await this.opts.hostingControlInstance.acceptedJobByPaymentArtifactHash(
21452
21468
  hostingPaymentArtifactHash
@@ -21744,7 +21760,7 @@ var DVMServer = class {
21744
21760
  }
21745
21761
  const isAnonymous = requesterId === "anonymous" || requesterId === "dev-anonymous";
21746
21762
  const jobToken = isAnonymous ? randomBytes5(32).toString("hex") : void 0;
21747
- const requesterTokenHash = jobToken ? createHash9("sha256").update(jobToken).digest("hex") : void 0;
21763
+ const requesterTokenHash = jobToken ? createHash10("sha256").update(jobToken).digest("hex") : void 0;
21748
21764
  const job = jm.createJob(
21749
21765
  normalisedBody,
21750
21766
  requesterId,
@@ -22456,7 +22472,7 @@ function isJobOwner(c, job) {
22456
22472
  if (job.requesterTokenHash) {
22457
22473
  const token = c.req.header("X-Job-Token");
22458
22474
  if (!token) return false;
22459
- const provided = createHash9("sha256").update(token).digest("hex");
22475
+ const provided = createHash10("sha256").update(token).digest("hex");
22460
22476
  return timingSafeEqualHex(provided, job.requesterTokenHash);
22461
22477
  }
22462
22478
  return c.get("requesterId") === job.requesterId;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-LAKP6FUI.js";
3
+ } from "./chunk-FXDQMJQ2.js";
4
4
 
5
5
  // src/lib/pg-retry.ts
6
6
  import { AsyncLocalStorage } from "async_hooks";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  diagnosticConsole,
6
6
  projectSpanRow
7
- } from "./chunk-LAKP6FUI.js";
7
+ } from "./chunk-FXDQMJQ2.js";
8
8
 
9
9
  // src/lib/x402/env.ts
10
10
  import { isAddress } from "viem";
@@ -2,7 +2,7 @@ import {
2
2
  createX402FacilitatorAuthHeaders,
3
3
  settleWithFacilitator,
4
4
  verifyWithFacilitator
5
- } from "./chunk-26W6GPCD.js";
5
+ } from "./chunk-XEOTTFLH.js";
6
6
  import {
7
7
  buildPaymentRequirements,
8
8
  decodePayment,
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-KXWROQGK.js";
16
16
  import {
17
17
  diagnosticConsole
18
- } from "./chunk-LAKP6FUI.js";
18
+ } from "./chunk-FXDQMJQ2.js";
19
19
 
20
20
  // src/lib/x402/verify.ts
21
21
  async function verifyX402Payment(paymentHeader, config, requiredUsdcMicro, resource, btcUsdRate, exactVersions = { v1: true, v2: true }) {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-YG7G4DPZ.js";
5
5
  import {
6
6
  diagnosticConsole
7
- } from "./chunk-LAKP6FUI.js";
7
+ } from "./chunk-FXDQMJQ2.js";
8
8
  import {
9
9
  withSdkInitLock
10
10
  } from "./chunk-COYKJRMM.js";
@@ -15,7 +15,7 @@ import {
15
15
  lotOwedSats,
16
16
  netOwedSats,
17
17
  x402SettlementPending
18
- } from "./chunk-SPYEJXI7.js";
18
+ } from "./chunk-WP7UX6RF.js";
19
19
 
20
20
  // src/sdk/server/memory-credit-ledger.ts
21
21
  import { randomUUID } from "crypto";
@@ -337,6 +337,9 @@ var diagnostic_catalogue_v1_default = {
337
337
  "revenue_skipped_unsettled_draw",
338
338
  "rollback",
339
339
  "router.proxy",
340
+ "sanctions_ip_data_incomplete",
341
+ "sanctions_ip_data_load_failed",
342
+ "sanctions_ip_data_stale",
340
343
  "scrape_cache_touch_failed",
341
344
  "scrape_cache_write_failed",
342
345
  "scrape_card_segmentation_failed",
@@ -825,6 +828,7 @@ var diagnostic_catalogue_v1_default = {
825
828
  "quota_exceeded",
826
829
  "rate_limited",
827
830
  "rate_limited_by_target",
831
+ "region_unavailable",
828
832
  "replay_detected",
829
833
  "request_integrity_failed",
830
834
  "retry_hardened",
@@ -977,6 +981,7 @@ var diagnostic_catalogue_v1_default = {
977
981
  ],
978
982
  tokenFields: [],
979
983
  hashFields: [
984
+ "job_id_hash",
980
985
  "key_hash",
981
986
  "prefix_hash"
982
987
  ],
@@ -1018,6 +1023,14 @@ var diagnostic_catalogue_v1_default = {
1018
1023
  "rate_stale_refused",
1019
1024
  "unknown"
1020
1025
  ],
1026
+ fxSourceFailures: [
1027
+ "network_error",
1028
+ "http_error",
1029
+ "invalid_body",
1030
+ "no_usable_rate",
1031
+ "missing_currency",
1032
+ "unknown"
1033
+ ],
1021
1034
  paymentFailureCategories: [
1022
1035
  "invalid_challenge",
1023
1036
  "malformed_credential",
@@ -1043,6 +1056,17 @@ var diagnostic_catalogue_v1_default = {
1043
1056
  paymentPhases: [
1044
1057
  "upfront",
1045
1058
  "mid-job"
1059
+ ],
1060
+ sanctionsRegions: [
1061
+ "BY",
1062
+ "CU",
1063
+ "IR",
1064
+ "KP",
1065
+ "RU",
1066
+ "UA-09",
1067
+ "UA-14",
1068
+ "UA-40",
1069
+ "UA-43"
1046
1070
  ]
1047
1071
  };
1048
1072
 
@@ -1051,6 +1075,7 @@ var DIAGNOSTIC_CATALOGUE_VERSION = diagnostic_catalogue_v1_default.version;
1051
1075
  var PAYMENT_ENUMS = {
1052
1076
  reason: new Set(diagnostic_catalogue_v1_default.paymentSkipReasons),
1053
1077
  cause: new Set(diagnostic_catalogue_v1_default.denominationCauses),
1078
+ source_failure: new Set(diagnostic_catalogue_v1_default.fxSourceFailures),
1054
1079
  failure_category: new Set(diagnostic_catalogue_v1_default.paymentFailureCategories),
1055
1080
  failure_stage: new Set(diagnostic_catalogue_v1_default.paymentFailureStages),
1056
1081
  phase: new Set(diagnostic_catalogue_v1_default.paymentPhases)
@@ -1079,6 +1104,7 @@ var CLIENT_PROTOCOL_VERSIONS = new Set(
1079
1104
  diagnostic_catalogue_v1_default.clientProtocolVersions
1080
1105
  );
1081
1106
  var CLIENT_VERSION_FIELDS = new Set(diagnostic_catalogue_v1_default.clientVersionFields);
1107
+ var SANCTIONS_REGIONS = new Set(diagnostic_catalogue_v1_default.sanctionsRegions);
1082
1108
  var SPAN_ID_RE = /^(?!0{16}$)[0-9a-f]{16}$/;
1083
1109
  var TRACE_ID_RE = /^(?!0{32}$)[0-9a-f]{32}$/;
1084
1110
  var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
@@ -1273,7 +1299,7 @@ function projectField(key, value, dataset, authority, identityAuthority) {
1273
1299
  if (key === "route") return projectQualifiedRoute(value);
1274
1300
  if (key === "http.route" || key === "resource_path")
1275
1301
  return projectRouteTemplate(value);
1276
- if (key === "status_code" || key === "http.status_code") {
1302
+ if (key === "status_code" || key === "http.status_code" || key === "source_status") {
1277
1303
  return Number.isInteger(value) && value >= 100 && value <= 599 ? value : void 0;
1278
1304
  }
1279
1305
  if (key === "method" || key === "http.method") {
@@ -1307,6 +1333,8 @@ function projectField(key, value, dataset, authority, identityAuthority) {
1307
1333
  return typeof value === "string" && STRIPE_EVENT_RE.test(value) ? value : void 0;
1308
1334
  if (key === "reject_reason")
1309
1335
  return value === "scanner_probe" ? value : void 0;
1336
+ if (key === "sanctions_region")
1337
+ return typeof value === "string" && SANCTIONS_REGIONS.has(value) ? value : void 0;
1310
1338
  return void 0;
1311
1339
  }
1312
1340
  function projectService(value) {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-YG7G4DPZ.js";
5
5
  import {
6
6
  withPostgresTransactionRecovery
7
- } from "./chunk-TRNMTTPX.js";
7
+ } from "./chunk-6RYCZLCK.js";
8
8
  import {
9
9
  withSdkInitLock
10
10
  } from "./chunk-COYKJRMM.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-LAKP6FUI.js";
3
+ } from "./chunk-FXDQMJQ2.js";
4
4
  import {
5
5
  withSdkInitLock
6
6
  } from "./chunk-COYKJRMM.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-LAKP6FUI.js";
3
+ } from "./chunk-FXDQMJQ2.js";
4
4
  import {
5
5
  withSdkInitLock
6
6
  } from "./chunk-COYKJRMM.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-AFV77S4C.js";
5
5
  import {
6
6
  diagnosticConsole
7
- } from "./chunk-LAKP6FUI.js";
7
+ } from "./chunk-FXDQMJQ2.js";
8
8
  import {
9
9
  withSdkInitLock
10
10
  } from "./chunk-COYKJRMM.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-LAKP6FUI.js";
3
+ } from "./chunk-FXDQMJQ2.js";
4
4
 
5
5
  // src/sdk/server/mpp-setup.ts
6
6
  import { createHash, randomUUID } from "crypto";