@dvmkit/sdk 0.7.0-rc.2 → 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 (52) hide show
  1. package/README.md +2 -0
  2. package/dist/{chunk-2OM2QPBE.js → chunk-3CNYUUD7.js} +1 -1
  3. package/dist/{chunk-A6CXKAQV.js → chunk-5WOKIGLM.js} +55 -41
  4. package/dist/{chunk-MON76YBJ.js → chunk-76W5MYFF.js} +1 -1
  5. package/dist/{chunk-I555L2WK.js → chunk-AE2ITUMA.js} +1 -1
  6. package/dist/{chunk-DNG4KGSC.js → chunk-ARGYJ7SB.js} +1 -1
  7. package/dist/{chunk-HCE4MPZ5.js → chunk-C6YFACIM.js} +1 -1
  8. package/dist/{chunk-TRNMTTPX.js → chunk-CYTV76CG.js} +1 -1
  9. package/dist/{chunk-VB5OLOZH.js → chunk-DY2MIZ6E.js} +1 -1
  10. package/dist/{chunk-SPYEJXI7.js → chunk-EN7VI7T5.js} +2 -2
  11. package/dist/{chunk-RAGX6VG7.js → chunk-H2XKINRX.js} +1 -1
  12. package/dist/{chunk-AQ7OX5NX.js → chunk-KIPJRLGP.js} +1 -1
  13. package/dist/{chunk-6STC5TCP.js → chunk-LZHBNR5C.js} +1 -1
  14. package/dist/{chunk-GSLS4464.js → chunk-MCIIDEXH.js} +1 -1
  15. package/dist/{chunk-USL7ZEXN.js → chunk-MU3UX5M4.js} +1 -1
  16. package/dist/{chunk-RXPHMS4C.js → chunk-O3JEEW5V.js} +1 -1
  17. package/dist/{chunk-72V5DTEC.js → chunk-QFRU6W34.js} +1 -1
  18. package/dist/{chunk-IIZQNDQU.js → chunk-RBCHIOVB.js} +1 -1
  19. package/dist/{chunk-H5FVVEEN.js → chunk-UEYUFBSV.js} +2 -2
  20. package/dist/{chunk-LAKP6FUI.js → chunk-WIQLTSJY.js} +11 -1
  21. package/dist/{chunk-26W6GPCD.js → chunk-WNX22IND.js} +1 -1
  22. package/dist/{chunk-CLIAFTUR.js → chunk-XYLF33BJ.js} +119 -20
  23. package/dist/{content-retention-CbnouEnh.d.ts → content-retention-ChFSSVO0.d.ts} +1 -1
  24. package/dist/{credit-ledger-7Z7LOCTN.js → credit-ledger-4ZIL7IX2.js} +3 -3
  25. package/dist/{credit-menu-BO8yJppy.d.ts → credit-menu-D7lF-100.d.ts} +8 -6
  26. package/dist/{fx-DSOZQ2z7.d.ts → fx-4TFUkedZ.d.ts} +10 -3
  27. package/dist/index.d.ts +5 -5
  28. package/dist/index.js +4 -4
  29. package/dist/internal/caller.d.ts +6 -6
  30. package/dist/internal/caller.js +6 -6
  31. package/dist/internal/server.d.ts +7 -7
  32. package/dist/internal/server.js +19 -19
  33. package/dist/{job-store-BJRlmq2Q.d.ts → job-store-DkfNE9sv.d.ts} +1 -1
  34. package/dist/{lightning-backend-f16-fsYK.d.ts → lightning-backend-C3Gf1XpP.d.ts} +1 -1
  35. package/dist/{memory-credit-ledger-3WOS74UH.js → memory-credit-ledger-HCECP6R7.js} +4 -4
  36. package/dist/{mpp-setup-XB4KATMU.js → mpp-setup-OL22TIDP.js} +2 -2
  37. package/dist/{payout-reporter-WT7XYW42.js → payout-reporter-WSLDLMKK.js} +2 -2
  38. package/dist/{postgres-consumed-credential-store-W7UP33AH.js → postgres-consumed-credential-store-7ONNOW37.js} +1 -1
  39. package/dist/{postgres-job-store-3KGUGFRD.js → postgres-job-store-36GJGQMB.js} +2 -2
  40. package/dist/{postgres-replay-store-CVNJJOQG.js → postgres-replay-store-JJ6XPVIU.js} +2 -2
  41. package/dist/{pricing-QAVZUTZR.js → pricing-FM6WVLCR.js} +3 -3
  42. package/dist/{revenue-reporter-7UR3W2SD.js → revenue-reporter-CAWZMYQK.js} +2 -2
  43. package/dist/server/index.d.ts +10 -10
  44. package/dist/server/index.js +25 -25
  45. package/dist/{step-cache-CJFiZU3n.d.ts → step-cache-DDTwd4SK.d.ts} +5 -1
  46. package/dist/{tempo-charge-store-GA6CED6O.js → tempo-charge-store-MVZH6CEB.js} +2 -2
  47. package/dist/{tempo-session-store-WZWQRITB.js → tempo-session-store-CCCG4HL7.js} +3 -3
  48. package/dist/testing/index.d.ts +3 -3
  49. package/dist/testing/index.js +5 -5
  50. package/dist/{usd-DmHHg0_4.d.ts → usd-DkRy9nfU.d.ts} +1 -1
  51. package/dist/{x402-ZU4GML7Z.js → x402-RHVRGUUI.js} +3 -3
  52. package/package.json +1 -1
package/README.md CHANGED
@@ -92,6 +92,8 @@ Builders can pass `onPaidJobCompleted` to observe settled customer charges after
92
92
  - A `credit` block opts into reusable prepaid balances and their reclaim obligations. Reusable channels return undrawn collateral through their channel lifecycle; one-payment stablecoin funding is disabled unless `allowOneShotStablecoin: true` because it creates manual refunds. Run and monitor the documented reclaim/payout worker.
93
93
  - Honour `ctx.signal`, use `ctx.fetch` for abortable provider calls, and declare provider cost with `ctx.cost` only after the durable step that incurred it.
94
94
 
95
+ Reusable x402 channels default to a 24-hour payer withdrawal grace (86400 seconds) on every network. For Base Sepolia (`eip155:84532`) acceptance tests, set `x402.batchSettlement.withdrawDelay: 900` or `DVMKIT_X402_WITHDRAW_DELAY_SECONDS=900` with `DVMKIT_X402_BATCH_SETTLEMENT=true`. Explicit delays must be integer seconds and at least 900 on Base Sepolia; Base mainnet retains the 86400 minimum even in development mode and still requires self-relay. The grace is bound into each channel's immutable configuration: changing the server setting affects new channels, not existing deposits. A shorter testnet run exercises early-withdrawal refusal and post-deadline recovery; retain a separate 24-hour run to cover next-day recovery.
96
+
95
97
  For Bitcoin credit monitoring, `GET /admin/credit/bitcoin-liability` reports exact in-kind obligations in satoshis. Uncovered and basisless credits need live-rate pricing on reclaim, so their whole balances appear in `uncovered_by_currency` and `unbacked_by_currency` as `{ currency, micro, credits }` entries. Sum the credit counts if useful, but display or price each currency separately. Older consumers must replace the former `uncovered_micro` and `unbacked_micro` scalar reads; the [portable response fixture](./protocol-fixtures/bitcoin-liability.json) shows the full shape.
96
98
 
97
99
  The public [SDK guide](https://dvmkit.com/docs/sdk) covers signed requests, custom routes, rail configuration, credit reclaim, persistence, and deployment in depth. The [protocol guide](https://dvmkit.com/docs/protocol) specifies the HTTP contract.
@@ -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);
@@ -1968,9 +1974,10 @@ async function createX402BatchSettlementServer(opts) {
1968
1974
  throw new Error("x402 batch-settlement payTo must be a 20-byte EVM address");
1969
1975
  }
1970
1976
  const withdrawDelay = opts.config.withdrawDelay ?? X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS;
1971
- if (!Number.isInteger(withdrawDelay) || withdrawDelay < X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS) {
1977
+ const minimumWithdrawDelay = opts.network === X402_BATCH_SETTLEMENT_NETWORK ? 900 : X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS;
1978
+ if (!Number.isInteger(withdrawDelay) || withdrawDelay < minimumWithdrawDelay) {
1972
1979
  throw new Error(
1973
- `x402 batch-settlement withdrawDelay must be at least ${String(X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS)} seconds`
1980
+ `x402 batch-settlement withdrawDelay must be at least ${String(minimumWithdrawDelay)} seconds`
1974
1981
  );
1975
1982
  }
1976
1983
  if (opts.config.autoSettlement !== false && opts.config.autoSettlement?.selectRefundChannels) {
@@ -3176,7 +3183,7 @@ function paymentFailureFields(error) {
3176
3183
  }
3177
3184
 
3178
3185
  // src/sdk/server/payment.ts
3179
- import { randomBytes, randomUUID as randomUUID2 } from "crypto";
3186
+ import { createHash as createHash4, randomBytes, randomUUID as randomUUID2 } from "crypto";
3180
3187
  import { Challenge } from "mppx";
3181
3188
 
3182
3189
  // src/lib/cashu/verify.ts
@@ -3867,7 +3874,7 @@ async function verifyUpfrontPaymentInScope(opts) {
3867
3874
  x402Requirements
3868
3875
  });
3869
3876
  }
3870
- const { verifyX402Payment } = await import("./x402-ZU4GML7Z.js");
3877
+ const { verifyX402Payment } = await import("./x402-RHVRGUUI.js");
3871
3878
  const receipt = await withPaymentStage("verifier_broadcast", () => verifyX402Payment(
3872
3879
  x402Payment,
3873
3880
  x402Config,
@@ -4855,7 +4862,7 @@ async function verifyIncomingPaymentInScope(body, opts, snapshot) {
4855
4862
  snapshot
4856
4863
  });
4857
4864
  }
4858
- const { verifyX402Payment } = await import("./x402-ZU4GML7Z.js");
4865
+ const { verifyX402Payment } = await import("./x402-RHVRGUUI.js");
4859
4866
  const receipt = await withPaymentStage("verifier_broadcast", () => verifyX402Payment(
4860
4867
  body.content.x402_payment,
4861
4868
  opts.x402Config,
@@ -5286,7 +5293,7 @@ async function processIncomingPaymentInScope(job, body, opts) {
5286
5293
  try {
5287
5294
  const requiredMsats = job.pendingPaymentMsats ?? 0;
5288
5295
  const requiredUsdcMicro = job.pendingX402AmountUsdcMicro !== void 0 ? BigInt(job.pendingX402AmountUsdcMicro) : BigInt(msatsToUsdc(requiredMsats, rate));
5289
- const { verifyX402Payment } = await import("./x402-ZU4GML7Z.js");
5296
+ const { verifyX402Payment } = await import("./x402-RHVRGUUI.js");
5290
5297
  const receipt = await withPaymentStage("verifier_broadcast", () => verifyX402Payment(
5291
5298
  body.content.x402_payment,
5292
5299
  opts.x402Config,
@@ -5674,7 +5681,10 @@ async function resolveTopUpLedgerContext(opts, snapshot, binding) {
5674
5681
  job_id: opts.jobId,
5675
5682
  credit_id: snapshot.creditId,
5676
5683
  draw_id: snapshot.drawId,
5677
- ...extra
5684
+ ...extra,
5685
+ ...typeof opts.jobId === "string" && {
5686
+ job_id_hash: createHash4("sha256").update(opts.jobId, "utf8").digest("hex")
5687
+ }
5678
5688
  }
5679
5689
  );
5680
5690
  };
@@ -5736,7 +5746,11 @@ async function resolveTopUpLedgerContext(opts, snapshot, binding) {
5736
5746
  if (!denomination.ok) {
5737
5747
  logSkip("denomination_unavailable", {
5738
5748
  currency,
5739
- cause: denomination.reason
5749
+ cause: denomination.reason,
5750
+ ...denomination.sourceFailure && {
5751
+ source_failure: denomination.sourceFailure.category,
5752
+ source_status: denomination.sourceFailure.httpStatus
5753
+ }
5740
5754
  });
5741
5755
  return void 0;
5742
5756
  }
@@ -9152,7 +9166,7 @@ async function handle(c, opts, action) {
9152
9166
  }
9153
9167
 
9154
9168
  // src/sdk/server/x402-exact-settlement.ts
9155
- import { createHash as createHash4 } from "crypto";
9169
+ import { createHash as createHash5 } from "crypto";
9156
9170
  var X402ExactSettlementServer = class {
9157
9171
  constructor(opts) {
9158
9172
  this.opts = opts;
@@ -9478,7 +9492,7 @@ function settlementMayHaveMoved(response) {
9478
9492
  return reason.includes("authorization_already_used") || reason.includes("authorization already used") || /facilitator_status_5\d\d/.test(reason);
9479
9493
  }
9480
9494
  function hash(parts) {
9481
- return createHash4("sha256").update(JSON.stringify(parts)).digest("hex");
9495
+ return createHash5("sha256").update(JSON.stringify(parts)).digest("hex");
9482
9496
  }
9483
9497
  function safeError(err) {
9484
9498
  if (err instanceof Error) return err.name;
@@ -9652,7 +9666,7 @@ var HostingCleanupFence = class {
9652
9666
  };
9653
9667
 
9654
9668
  // src/sdk/server/hosting-settlement-report-obligations.ts
9655
- import { createHash as createHash5, randomUUID as randomUUID3 } from "crypto";
9669
+ import { createHash as createHash6, randomUUID as randomUUID3 } from "crypto";
9656
9670
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "util";
9657
9671
  import { BATCH_SETTLEMENT_ADDRESS as BATCH_SETTLEMENT_ADDRESS3 } from "@x402/evm";
9658
9672
  import { computeChannelId as computeChannelId2 } from "@x402/evm/batch-settlement/client";
@@ -9715,7 +9729,7 @@ var TEMPO_CLOSED_EVENT = TempoSession.Precompile.escrowAbi.find(
9715
9729
  (item) => item.type === "event" && item.name === "ChannelClosed"
9716
9730
  );
9717
9731
  function hash2(value) {
9718
- return createHash5("sha256").update(JSON.stringify(value)).digest("hex");
9732
+ return createHash6("sha256").update(JSON.stringify(value)).digest("hex");
9719
9733
  }
9720
9734
  function hex(value, bytes) {
9721
9735
  return typeof value === "string" && new RegExp(`^0x[0-9a-fA-F]{${bytes * 2}}$`).test(value);
@@ -10618,7 +10632,7 @@ var HostedSettlementReportObligations = class {
10618
10632
  };
10619
10633
 
10620
10634
  // src/sdk/server/hosting-channel-evidence.ts
10621
- import { createHash as createHash6 } from "crypto";
10635
+ import { createHash as createHash7 } from "crypto";
10622
10636
  import { Session as TempoSession2 } from "mppx/tempo";
10623
10637
  import { createPublicClient as createPublicClient5, http as http5 } from "viem";
10624
10638
  import { BATCH_SETTLEMENT_ADDRESS as BATCH_SETTLEMENT_ADDRESS4 } from "@x402/evm";
@@ -10669,7 +10683,7 @@ async function readHostedChannelSnapshot(query) {
10669
10683
  };
10670
10684
  const x402HistoryComplete = await history(names[6]);
10671
10685
  const tempoHistoryComplete = await history(names[7]);
10672
- const digest = createHash6("sha256").update(JSON.stringify({
10686
+ const digest = createHash7("sha256").update(JSON.stringify({
10673
10687
  present: [...exists].sort(),
10674
10688
  x402,
10675
10689
  x402Tombstones,
@@ -11818,9 +11832,9 @@ import { AsyncLocalStorage } from "async_hooks";
11818
11832
  import { randomBytes as randomBytes3 } from "crypto";
11819
11833
 
11820
11834
  // src/sdk/server/instrumented-kv.ts
11821
- import { createHash as createHash7 } from "crypto";
11835
+ import { createHash as createHash8 } from "crypto";
11822
11836
  function hashKey(key) {
11823
- return createHash7("sha256").update(key).digest("hex").slice(0, 16);
11837
+ return createHash8("sha256").update(key).digest("hex").slice(0, 16);
11824
11838
  }
11825
11839
  function instrumentKVStore(inner) {
11826
11840
  return {
@@ -16596,7 +16610,7 @@ function withWallClockDeadline(promise, timeoutMs) {
16596
16610
  }
16597
16611
 
16598
16612
  // src/sdk/server/app.ts
16599
- 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";
16600
16614
  import { Hono } from "hono";
16601
16615
  import { getCookie } from "hono/cookie";
16602
16616
  import { cors } from "hono/cors";
@@ -19385,7 +19399,7 @@ initSchemaForm();
19385
19399
  }
19386
19400
 
19387
19401
  // src/sdk/server/request-fingerprint.ts
19388
- import { createHash as createHash8 } from "crypto";
19402
+ import { createHash as createHash9 } from "crypto";
19389
19403
  function requestFingerprint(req, opts) {
19390
19404
  const canonical = canonicalize({
19391
19405
  capability: req.capability,
@@ -19393,7 +19407,7 @@ function requestFingerprint(req, opts) {
19393
19407
  params: req.params ?? {},
19394
19408
  data: opts.stripAuthEnvelope ? stripEnvelope(req.data) : req.data
19395
19409
  });
19396
- return createHash8("sha256").update(canonical).digest("hex");
19410
+ return createHash9("sha256").update(canonical).digest("hex");
19397
19411
  }
19398
19412
  var ENVELOPE_KEYS = /* @__PURE__ */ new Set(["pubkey", "signature", "timestamp", "nonce", "auth_statement"]);
19399
19413
  function stripEnvelope(data) {
@@ -19516,7 +19530,7 @@ async function createDVMServer(descriptor, opts) {
19516
19530
  }
19517
19531
  }
19518
19532
  if (!opts.onJobCompleted && platformToken && platformUrl && dvmId && opts.db) {
19519
- const { RevenueReporter } = await import("./revenue-reporter-7UR3W2SD.js");
19533
+ const { RevenueReporter } = await import("./revenue-reporter-CAWZMYQK.js");
19520
19534
  const reporter = new RevenueReporter(
19521
19535
  opts.db,
19522
19536
  platformUrl,
@@ -19526,7 +19540,7 @@ async function createDVMServer(descriptor, opts) {
19526
19540
  revenueReporter = reporter;
19527
19541
  await reporter.init();
19528
19542
  reporter.startRetryLoop();
19529
- const { MemoryX402BatchStore, PayoutReporter } = await import("./payout-reporter-WT7XYW42.js");
19543
+ const { MemoryX402BatchStore, PayoutReporter } = await import("./payout-reporter-WSLDLMKK.js");
19530
19544
  payoutReporter = new PayoutReporter({
19531
19545
  dvmId,
19532
19546
  db: opts.db,
@@ -20391,7 +20405,7 @@ var DVMServer = class {
20391
20405
  const dvmId = this.opts.dvmId ?? `dev:${this.descriptor.name}`;
20392
20406
  return {
20393
20407
  dvm_id: dvmId,
20394
- builder_pubkey: createHash9("sha256").update(`dvmkit-dev:${dvmId}`).digest("hex")
20408
+ builder_pubkey: createHash10("sha256").update(`dvmkit-dev:${dvmId}`).digest("hex")
20395
20409
  };
20396
20410
  }
20397
20411
  throw new AuthAudienceError();
@@ -20739,7 +20753,7 @@ var DVMServer = class {
20739
20753
  const paymentAuthorization = ctx.req.header("Authorization");
20740
20754
  const mppArtifact = paymentAuthorization ? (await import("mppx")).Credential.extractPaymentScheme(paymentAuthorization) : void 0;
20741
20755
  const attachedPayment = ctx.req.header("X-Cashu") ?? ctx.req.header("PAYMENT-SIGNATURE") ?? ctx.req.header("X-PAYMENT") ?? mppArtifact;
20742
- const paymentArtifactHash = attachedPayment ? createHash9("sha256").update(attachedPayment).digest("hex") : void 0;
20756
+ const paymentArtifactHash = attachedPayment ? createHash10("sha256").update(attachedPayment).digest("hex") : void 0;
20743
20757
  hostingFundingArtifactHash = paymentArtifactHash;
20744
20758
  if (!await control.admit(admissionId, workId, {
20745
20759
  creditId,
@@ -21445,7 +21459,7 @@ var DVMServer = class {
21445
21459
  const authorization = c.req.header("Authorization");
21446
21460
  const mppArtifact = authorization ? (await import("mppx")).Credential.extractPaymentScheme(authorization) : void 0;
21447
21461
  const attachedPayment = c.req.header("X-Cashu") ?? c.req.header("PAYMENT-SIGNATURE") ?? c.req.header("X-PAYMENT") ?? mppArtifact;
21448
- const hostingPaymentArtifactHash = attachedPayment ? createHash9("sha256").update(attachedPayment).digest("hex") : void 0;
21462
+ const hostingPaymentArtifactHash = attachedPayment ? createHash10("sha256").update(attachedPayment).digest("hex") : void 0;
21449
21463
  if (!resumeOnly && this.opts.hostingControlInstance && hostingPaymentArtifactHash) {
21450
21464
  const priorId = await this.opts.hostingControlInstance.acceptedJobByPaymentArtifactHash(
21451
21465
  hostingPaymentArtifactHash
@@ -21743,7 +21757,7 @@ var DVMServer = class {
21743
21757
  }
21744
21758
  const isAnonymous = requesterId === "anonymous" || requesterId === "dev-anonymous";
21745
21759
  const jobToken = isAnonymous ? randomBytes5(32).toString("hex") : void 0;
21746
- const requesterTokenHash = jobToken ? createHash9("sha256").update(jobToken).digest("hex") : void 0;
21760
+ const requesterTokenHash = jobToken ? createHash10("sha256").update(jobToken).digest("hex") : void 0;
21747
21761
  const job = jm.createJob(
21748
21762
  normalisedBody,
21749
21763
  requesterId,
@@ -22455,7 +22469,7 @@ function isJobOwner(c, job) {
22455
22469
  if (job.requesterTokenHash) {
22456
22470
  const token = c.req.header("X-Job-Token");
22457
22471
  if (!token) return false;
22458
- const provided = createHash9("sha256").update(token).digest("hex");
22472
+ const provided = createHash10("sha256").update(token).digest("hex");
22459
22473
  return timingSafeEqualHex(provided, job.requesterTokenHash);
22460
22474
  }
22461
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";