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

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 (45) hide show
  1. package/dist/{chunk-2OM2QPBE.js → chunk-3CNYUUD7.js} +1 -1
  2. package/dist/{chunk-3UK3CDOT.js → chunk-5WOKIGLM.js} +52 -39
  3. package/dist/{chunk-MON76YBJ.js → chunk-76W5MYFF.js} +1 -1
  4. package/dist/{chunk-I555L2WK.js → chunk-AE2ITUMA.js} +1 -1
  5. package/dist/{chunk-DNG4KGSC.js → chunk-ARGYJ7SB.js} +1 -1
  6. package/dist/{chunk-HCE4MPZ5.js → chunk-C6YFACIM.js} +1 -1
  7. package/dist/{chunk-TRNMTTPX.js → chunk-CYTV76CG.js} +1 -1
  8. package/dist/{chunk-VB5OLOZH.js → chunk-DY2MIZ6E.js} +1 -1
  9. package/dist/{chunk-SPYEJXI7.js → chunk-EN7VI7T5.js} +2 -2
  10. package/dist/{chunk-RAGX6VG7.js → chunk-H2XKINRX.js} +1 -1
  11. package/dist/{chunk-AQ7OX5NX.js → chunk-KIPJRLGP.js} +1 -1
  12. package/dist/{chunk-6STC5TCP.js → chunk-LZHBNR5C.js} +1 -1
  13. package/dist/{chunk-GSLS4464.js → chunk-MCIIDEXH.js} +1 -1
  14. package/dist/{chunk-USL7ZEXN.js → chunk-MU3UX5M4.js} +1 -1
  15. package/dist/{chunk-RXPHMS4C.js → chunk-O3JEEW5V.js} +1 -1
  16. package/dist/{chunk-72V5DTEC.js → chunk-QFRU6W34.js} +1 -1
  17. package/dist/{chunk-IIZQNDQU.js → chunk-RBCHIOVB.js} +1 -1
  18. package/dist/{chunk-H5FVVEEN.js → chunk-UEYUFBSV.js} +2 -2
  19. package/dist/{chunk-LAKP6FUI.js → chunk-WIQLTSJY.js} +11 -1
  20. package/dist/{chunk-26W6GPCD.js → chunk-WNX22IND.js} +1 -1
  21. package/dist/{chunk-CLIAFTUR.js → chunk-XYLF33BJ.js} +119 -20
  22. package/dist/{credit-ledger-7Z7LOCTN.js → credit-ledger-4ZIL7IX2.js} +3 -3
  23. package/dist/{credit-menu-fy0DDigm.d.ts → credit-menu-D7lF-100.d.ts} +3 -1
  24. package/dist/{fx-DM0_NYiE.d.ts → fx-4TFUkedZ.d.ts} +9 -2
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +4 -4
  27. package/dist/internal/caller.d.ts +1 -1
  28. package/dist/internal/caller.js +6 -6
  29. package/dist/internal/server.d.ts +3 -3
  30. package/dist/internal/server.js +19 -19
  31. package/dist/{memory-credit-ledger-3WOS74UH.js → memory-credit-ledger-HCECP6R7.js} +4 -4
  32. package/dist/{mpp-setup-XB4KATMU.js → mpp-setup-OL22TIDP.js} +2 -2
  33. package/dist/{payout-reporter-WT7XYW42.js → payout-reporter-WSLDLMKK.js} +2 -2
  34. package/dist/{postgres-consumed-credential-store-W7UP33AH.js → postgres-consumed-credential-store-7ONNOW37.js} +1 -1
  35. package/dist/{postgres-job-store-3KGUGFRD.js → postgres-job-store-36GJGQMB.js} +2 -2
  36. package/dist/{postgres-replay-store-CVNJJOQG.js → postgres-replay-store-JJ6XPVIU.js} +2 -2
  37. package/dist/{pricing-QAVZUTZR.js → pricing-FM6WVLCR.js} +3 -3
  38. package/dist/{revenue-reporter-7UR3W2SD.js → revenue-reporter-CAWZMYQK.js} +2 -2
  39. package/dist/server/index.d.ts +3 -3
  40. package/dist/server/index.js +25 -25
  41. package/dist/{tempo-charge-store-GA6CED6O.js → tempo-charge-store-MVZH6CEB.js} +2 -2
  42. package/dist/{tempo-session-store-WZWQRITB.js → tempo-session-store-CCCG4HL7.js} +3 -3
  43. package/dist/testing/index.js +5 -5
  44. package/dist/{x402-ZU4GML7Z.js → x402-RHVRGUUI.js} +3 -3
  45. package/package.json +1 -1
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  diagnosticConsole,
6
6
  projectSpanRow
7
- } from "./chunk-LAKP6FUI.js";
7
+ } from "./chunk-WIQLTSJY.js";
8
8
 
9
9
  // src/lib/x402/env.ts
10
10
  import { isAddress } from "viem";
@@ -7,7 +7,7 @@ import {
7
7
  installHostedTempoCloseGuard,
8
8
  isTempoInsufficientFundsError,
9
9
  resolveTempoNetwork
10
- } from "./chunk-HCE4MPZ5.js";
10
+ } from "./chunk-C6YFACIM.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-WNX22IND.js";
20
20
  import {
21
21
  MemoryCreditLedger
22
- } from "./chunk-I555L2WK.js";
22
+ } from "./chunk-AE2ITUMA.js";
23
23
  import {
24
24
  PostgresJobStore
25
- } from "./chunk-IIZQNDQU.js";
25
+ } from "./chunk-RBCHIOVB.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-QFRU6W34.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-H2XKINRX.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-DY2MIZ6E.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-KIPJRLGP.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-XYLF33BJ.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-EN7VI7T5.js";
148
149
  import {
149
150
  withPostgresRecoveryContext
150
- } from "./chunk-TRNMTTPX.js";
151
+ } from "./chunk-CYTV76CG.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-WIQLTSJY.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-RHVRGUUI.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-RHVRGUUI.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-RHVRGUUI.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
  }
@@ -9153,7 +9166,7 @@ async function handle(c, opts, action) {
9153
9166
  }
9154
9167
 
9155
9168
  // src/sdk/server/x402-exact-settlement.ts
9156
- import { createHash as createHash4 } from "crypto";
9169
+ import { createHash as createHash5 } from "crypto";
9157
9170
  var X402ExactSettlementServer = class {
9158
9171
  constructor(opts) {
9159
9172
  this.opts = opts;
@@ -9479,7 +9492,7 @@ function settlementMayHaveMoved(response) {
9479
9492
  return reason.includes("authorization_already_used") || reason.includes("authorization already used") || /facilitator_status_5\d\d/.test(reason);
9480
9493
  }
9481
9494
  function hash(parts) {
9482
- return createHash4("sha256").update(JSON.stringify(parts)).digest("hex");
9495
+ return createHash5("sha256").update(JSON.stringify(parts)).digest("hex");
9483
9496
  }
9484
9497
  function safeError(err) {
9485
9498
  if (err instanceof Error) return err.name;
@@ -9653,7 +9666,7 @@ var HostingCleanupFence = class {
9653
9666
  };
9654
9667
 
9655
9668
  // src/sdk/server/hosting-settlement-report-obligations.ts
9656
- import { createHash as createHash5, randomUUID as randomUUID3 } from "crypto";
9669
+ import { createHash as createHash6, randomUUID as randomUUID3 } from "crypto";
9657
9670
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "util";
9658
9671
  import { BATCH_SETTLEMENT_ADDRESS as BATCH_SETTLEMENT_ADDRESS3 } from "@x402/evm";
9659
9672
  import { computeChannelId as computeChannelId2 } from "@x402/evm/batch-settlement/client";
@@ -9716,7 +9729,7 @@ var TEMPO_CLOSED_EVENT = TempoSession.Precompile.escrowAbi.find(
9716
9729
  (item) => item.type === "event" && item.name === "ChannelClosed"
9717
9730
  );
9718
9731
  function hash2(value) {
9719
- return createHash5("sha256").update(JSON.stringify(value)).digest("hex");
9732
+ return createHash6("sha256").update(JSON.stringify(value)).digest("hex");
9720
9733
  }
9721
9734
  function hex(value, bytes) {
9722
9735
  return typeof value === "string" && new RegExp(`^0x[0-9a-fA-F]{${bytes * 2}}$`).test(value);
@@ -10619,7 +10632,7 @@ var HostedSettlementReportObligations = class {
10619
10632
  };
10620
10633
 
10621
10634
  // src/sdk/server/hosting-channel-evidence.ts
10622
- import { createHash as createHash6 } from "crypto";
10635
+ import { createHash as createHash7 } from "crypto";
10623
10636
  import { Session as TempoSession2 } from "mppx/tempo";
10624
10637
  import { createPublicClient as createPublicClient5, http as http5 } from "viem";
10625
10638
  import { BATCH_SETTLEMENT_ADDRESS as BATCH_SETTLEMENT_ADDRESS4 } from "@x402/evm";
@@ -10670,7 +10683,7 @@ async function readHostedChannelSnapshot(query) {
10670
10683
  };
10671
10684
  const x402HistoryComplete = await history(names[6]);
10672
10685
  const tempoHistoryComplete = await history(names[7]);
10673
- const digest = createHash6("sha256").update(JSON.stringify({
10686
+ const digest = createHash7("sha256").update(JSON.stringify({
10674
10687
  present: [...exists].sort(),
10675
10688
  x402,
10676
10689
  x402Tombstones,
@@ -11819,9 +11832,9 @@ import { AsyncLocalStorage } from "async_hooks";
11819
11832
  import { randomBytes as randomBytes3 } from "crypto";
11820
11833
 
11821
11834
  // src/sdk/server/instrumented-kv.ts
11822
- import { createHash as createHash7 } from "crypto";
11835
+ import { createHash as createHash8 } from "crypto";
11823
11836
  function hashKey(key) {
11824
- return createHash7("sha256").update(key).digest("hex").slice(0, 16);
11837
+ return createHash8("sha256").update(key).digest("hex").slice(0, 16);
11825
11838
  }
11826
11839
  function instrumentKVStore(inner) {
11827
11840
  return {
@@ -16597,7 +16610,7 @@ function withWallClockDeadline(promise, timeoutMs) {
16597
16610
  }
16598
16611
 
16599
16612
  // src/sdk/server/app.ts
16600
- import { createHash as createHash9, randomBytes as randomBytes5, randomUUID as randomUUID6 } from "crypto";
16613
+ import { createHash as createHash10, randomBytes as randomBytes5, randomUUID as randomUUID6 } from "crypto";
16601
16614
  import { Hono } from "hono";
16602
16615
  import { getCookie } from "hono/cookie";
16603
16616
  import { cors } from "hono/cors";
@@ -19386,7 +19399,7 @@ initSchemaForm();
19386
19399
  }
19387
19400
 
19388
19401
  // src/sdk/server/request-fingerprint.ts
19389
- import { createHash as createHash8 } from "crypto";
19402
+ import { createHash as createHash9 } from "crypto";
19390
19403
  function requestFingerprint(req, opts) {
19391
19404
  const canonical = canonicalize({
19392
19405
  capability: req.capability,
@@ -19394,7 +19407,7 @@ function requestFingerprint(req, opts) {
19394
19407
  params: req.params ?? {},
19395
19408
  data: opts.stripAuthEnvelope ? stripEnvelope(req.data) : req.data
19396
19409
  });
19397
- return createHash8("sha256").update(canonical).digest("hex");
19410
+ return createHash9("sha256").update(canonical).digest("hex");
19398
19411
  }
19399
19412
  var ENVELOPE_KEYS = /* @__PURE__ */ new Set(["pubkey", "signature", "timestamp", "nonce", "auth_statement"]);
19400
19413
  function stripEnvelope(data) {
@@ -19517,7 +19530,7 @@ async function createDVMServer(descriptor, opts) {
19517
19530
  }
19518
19531
  }
19519
19532
  if (!opts.onJobCompleted && platformToken && platformUrl && dvmId && opts.db) {
19520
- const { RevenueReporter } = await import("./revenue-reporter-7UR3W2SD.js");
19533
+ const { RevenueReporter } = await import("./revenue-reporter-CAWZMYQK.js");
19521
19534
  const reporter = new RevenueReporter(
19522
19535
  opts.db,
19523
19536
  platformUrl,
@@ -19527,7 +19540,7 @@ async function createDVMServer(descriptor, opts) {
19527
19540
  revenueReporter = reporter;
19528
19541
  await reporter.init();
19529
19542
  reporter.startRetryLoop();
19530
- const { MemoryX402BatchStore, PayoutReporter } = await import("./payout-reporter-WT7XYW42.js");
19543
+ const { MemoryX402BatchStore, PayoutReporter } = await import("./payout-reporter-WSLDLMKK.js");
19531
19544
  payoutReporter = new PayoutReporter({
19532
19545
  dvmId,
19533
19546
  db: opts.db,
@@ -20392,7 +20405,7 @@ var DVMServer = class {
20392
20405
  const dvmId = this.opts.dvmId ?? `dev:${this.descriptor.name}`;
20393
20406
  return {
20394
20407
  dvm_id: dvmId,
20395
- builder_pubkey: createHash9("sha256").update(`dvmkit-dev:${dvmId}`).digest("hex")
20408
+ builder_pubkey: createHash10("sha256").update(`dvmkit-dev:${dvmId}`).digest("hex")
20396
20409
  };
20397
20410
  }
20398
20411
  throw new AuthAudienceError();
@@ -20740,7 +20753,7 @@ var DVMServer = class {
20740
20753
  const paymentAuthorization = ctx.req.header("Authorization");
20741
20754
  const mppArtifact = paymentAuthorization ? (await import("mppx")).Credential.extractPaymentScheme(paymentAuthorization) : void 0;
20742
20755
  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;
20756
+ const paymentArtifactHash = attachedPayment ? createHash10("sha256").update(attachedPayment).digest("hex") : void 0;
20744
20757
  hostingFundingArtifactHash = paymentArtifactHash;
20745
20758
  if (!await control.admit(admissionId, workId, {
20746
20759
  creditId,
@@ -21446,7 +21459,7 @@ var DVMServer = class {
21446
21459
  const authorization = c.req.header("Authorization");
21447
21460
  const mppArtifact = authorization ? (await import("mppx")).Credential.extractPaymentScheme(authorization) : void 0;
21448
21461
  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;
21462
+ const hostingPaymentArtifactHash = attachedPayment ? createHash10("sha256").update(attachedPayment).digest("hex") : void 0;
21450
21463
  if (!resumeOnly && this.opts.hostingControlInstance && hostingPaymentArtifactHash) {
21451
21464
  const priorId = await this.opts.hostingControlInstance.acceptedJobByPaymentArtifactHash(
21452
21465
  hostingPaymentArtifactHash
@@ -21744,7 +21757,7 @@ var DVMServer = class {
21744
21757
  }
21745
21758
  const isAnonymous = requesterId === "anonymous" || requesterId === "dev-anonymous";
21746
21759
  const jobToken = isAnonymous ? randomBytes5(32).toString("hex") : void 0;
21747
- const requesterTokenHash = jobToken ? createHash9("sha256").update(jobToken).digest("hex") : void 0;
21760
+ const requesterTokenHash = jobToken ? createHash10("sha256").update(jobToken).digest("hex") : void 0;
21748
21761
  const job = jm.createJob(
21749
21762
  normalisedBody,
21750
21763
  requesterId,
@@ -22456,7 +22469,7 @@ function isJobOwner(c, job) {
22456
22469
  if (job.requesterTokenHash) {
22457
22470
  const token = c.req.header("X-Job-Token");
22458
22471
  if (!token) return false;
22459
- const provided = createHash9("sha256").update(token).digest("hex");
22472
+ const provided = createHash10("sha256").update(token).digest("hex");
22460
22473
  return timingSafeEqualHex(provided, job.requesterTokenHash);
22461
22474
  }
22462
22475
  return c.get("requesterId") === job.requesterId;
@@ -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-CYTV76CG.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-EN7VI7T5.js";
19
19
 
20
20
  // src/sdk/server/memory-credit-ledger.ts
21
21
  import { randomUUID } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-LAKP6FUI.js";
3
+ } from "./chunk-WIQLTSJY.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-WIQLTSJY.js";
4
4
 
5
5
  // src/sdk/server/mpp-setup.ts
6
6
  import { createHash, randomUUID } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-LAKP6FUI.js";
3
+ } from "./chunk-WIQLTSJY.js";
4
4
 
5
5
  // src/lib/pg-retry.ts
6
6
  import { AsyncLocalStorage } from "async_hooks";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-BPYMEMQX.js";
10
10
  import {
11
11
  diagnosticConsole
12
- } from "./chunk-LAKP6FUI.js";
12
+ } from "./chunk-WIQLTSJY.js";
13
13
 
14
14
  // src/lib/cashu/lock-pubkey.ts
15
15
  function toLockPubkey(raw) {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  applyRetryToPool
3
- } from "./chunk-TRNMTTPX.js";
3
+ } from "./chunk-CYTV76CG.js";
4
4
  import {
5
5
  x402NetworkByCaip2
6
6
  } from "./chunk-BPYMEMQX.js";
7
7
  import {
8
8
  diagnosticConsole
9
- } from "./chunk-LAKP6FUI.js";
9
+ } from "./chunk-WIQLTSJY.js";
10
10
  import {
11
11
  withSdkInitLock
12
12
  } from "./chunk-COYKJRMM.js";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-AFV77S4C.js";
6
6
  import {
7
7
  loggers
8
- } from "./chunk-AQ7OX5NX.js";
8
+ } from "./chunk-KIPJRLGP.js";
9
9
  import {
10
10
  redactUrl
11
11
  } from "./chunk-KXWROQGK.js";
@@ -8,7 +8,7 @@ import {
8
8
  extendDiagnosticIdentityAuthority,
9
9
  projectDiagnosticFields,
10
10
  projectSpanRow
11
- } from "./chunk-LAKP6FUI.js";
11
+ } from "./chunk-WIQLTSJY.js";
12
12
 
13
13
  // src/sdk/logger.ts
14
14
  function createConsoleLogger(_jobId) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-LAKP6FUI.js";
3
+ } from "./chunk-WIQLTSJY.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-WIQLTSJY.js";
4
4
  import {
5
5
  withSdkInitLock
6
6
  } from "./chunk-COYKJRMM.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  validateCurrency
3
- } from "./chunk-CLIAFTUR.js";
3
+ } from "./chunk-XYLF33BJ.js";
4
4
 
5
5
  // src/sdk/pricing/upfront.ts
6
6
  function buildUpfront(input) {
@@ -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-WIQLTSJY.js";
8
8
  import {
9
9
  withSdkInitLock
10
10
  } from "./chunk-COYKJRMM.js";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-UKD3R2KU.js";
8
8
  import {
9
9
  diagnosticConsole
10
- } from "./chunk-LAKP6FUI.js";
10
+ } from "./chunk-WIQLTSJY.js";
11
11
 
12
12
  // src/sdk/server/zod-error.ts
13
13
  function humanizeZodError(err, opts) {
@@ -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-WIQLTSJY.js";
8
8
  import {
9
9
  withSdkInitLock
10
10
  } from "./chunk-COYKJRMM.js";
@@ -2,7 +2,7 @@ import {
2
2
  createX402FacilitatorAuthHeaders,
3
3
  settleWithFacilitator,
4
4
  verifyWithFacilitator
5
- } from "./chunk-26W6GPCD.js";
5
+ } from "./chunk-WNX22IND.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-WIQLTSJY.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 }) {
@@ -977,6 +977,7 @@ var diagnostic_catalogue_v1_default = {
977
977
  ],
978
978
  tokenFields: [],
979
979
  hashFields: [
980
+ "job_id_hash",
980
981
  "key_hash",
981
982
  "prefix_hash"
982
983
  ],
@@ -1018,6 +1019,14 @@ var diagnostic_catalogue_v1_default = {
1018
1019
  "rate_stale_refused",
1019
1020
  "unknown"
1020
1021
  ],
1022
+ fxSourceFailures: [
1023
+ "network_error",
1024
+ "http_error",
1025
+ "invalid_body",
1026
+ "no_usable_rate",
1027
+ "missing_currency",
1028
+ "unknown"
1029
+ ],
1021
1030
  paymentFailureCategories: [
1022
1031
  "invalid_challenge",
1023
1032
  "malformed_credential",
@@ -1051,6 +1060,7 @@ var DIAGNOSTIC_CATALOGUE_VERSION = diagnostic_catalogue_v1_default.version;
1051
1060
  var PAYMENT_ENUMS = {
1052
1061
  reason: new Set(diagnostic_catalogue_v1_default.paymentSkipReasons),
1053
1062
  cause: new Set(diagnostic_catalogue_v1_default.denominationCauses),
1063
+ source_failure: new Set(diagnostic_catalogue_v1_default.fxSourceFailures),
1054
1064
  failure_category: new Set(diagnostic_catalogue_v1_default.paymentFailureCategories),
1055
1065
  failure_stage: new Set(diagnostic_catalogue_v1_default.paymentFailureStages),
1056
1066
  phase: new Set(diagnostic_catalogue_v1_default.paymentPhases)
@@ -1273,7 +1283,7 @@ function projectField(key, value, dataset, authority, identityAuthority) {
1273
1283
  if (key === "route") return projectQualifiedRoute(value);
1274
1284
  if (key === "http.route" || key === "resource_path")
1275
1285
  return projectRouteTemplate(value);
1276
- if (key === "status_code" || key === "http.status_code") {
1286
+ if (key === "status_code" || key === "http.status_code" || key === "source_status") {
1277
1287
  return Number.isInteger(value) && value >= 100 && value <= 599 ? value : void 0;
1278
1288
  }
1279
1289
  if (key === "method" || key === "http.method") {
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-KXWROQGK.js";
7
7
  import {
8
8
  diagnosticConsole
9
- } from "./chunk-LAKP6FUI.js";
9
+ } from "./chunk-WIQLTSJY.js";
10
10
 
11
11
  // src/observability/payment-diagnostics.ts
12
12
  import { AsyncLocalStorage } from "async_hooks";