@dvmkit/sdk 0.3.1-rc.10 → 0.3.2-rc.10

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 (47) hide show
  1. package/dist/{chunk-MD3H3BF7.js → chunk-2A33VHYM.js} +1 -1
  2. package/dist/{chunk-AJNFXR7J.js → chunk-3KYLYVY4.js} +4 -1
  3. package/dist/{chunk-YO56VCTQ.js → chunk-BWGRKGKG.js} +190 -75
  4. package/dist/{chunk-MMCE7XSR.js → chunk-C2AGARLM.js} +1 -13
  5. package/dist/chunk-D42FMCLJ.js +1423 -0
  6. package/dist/{chunk-QX52F6IB.js → chunk-DSVGYW3B.js} +7 -4
  7. package/dist/{chunk-CC3UY6OS.js → chunk-HNIKSOI2.js} +378 -373
  8. package/dist/{chunk-4A2RAKCW.js → chunk-IBDDIG4K.js} +7 -3
  9. package/dist/{chunk-D7YQYLLM.js → chunk-J7PW2U6P.js} +1 -1
  10. package/dist/{chunk-FDKRXOZO.js → chunk-KL4C3LQV.js} +57 -49
  11. package/dist/{chunk-VA7GT6C6.js → chunk-LHN75BTX.js} +56 -53
  12. package/dist/{chunk-C3MTFLC6.js → chunk-M4RSKQAV.js} +14 -12
  13. package/dist/{chunk-U5VNEALI.js → chunk-PPHE7XUU.js} +1 -1
  14. package/dist/{chunk-GAIPXGM3.js → chunk-SP42AI5T.js} +1 -1
  15. package/dist/{chunk-N5B66UOS.js → chunk-U2EYIPFX.js} +4 -1
  16. package/dist/{chunk-H2MEFVH6.js → chunk-UQCK5VMA.js} +7 -4
  17. package/dist/{chunk-XMDQOXHO.js → chunk-Y7JZLO5J.js} +4 -1
  18. package/dist/{chunk-HHTL3ZFT.js → chunk-YEO5GW7U.js} +16 -13
  19. package/dist/{chunk-O6D72KYA.js → chunk-YRDA7EWN.js} +1 -1
  20. package/dist/{chunk-VIVXB4CD.js → chunk-YYQG4R7T.js} +1 -1
  21. package/dist/{chunk-FPOLJRBF.js → chunk-Z3EHBW2G.js} +2 -2
  22. package/dist/{chunk-2D75MNNG.js → chunk-ZHTUITDW.js} +8 -5
  23. package/dist/{chunk-XZ7LW4S5.js → chunk-ZUTI56L7.js} +20 -16
  24. package/dist/{credit-ledger-MHA652TV.js → credit-ledger-4CCHRJE2.js} +3 -2
  25. package/dist/index.js +4 -3
  26. package/dist/internal/caller.d.ts +32 -3
  27. package/dist/internal/caller.js +22 -12
  28. package/dist/internal/index.js +1 -1
  29. package/dist/internal/server.js +16 -15
  30. package/dist/memory-credit-ledger-TERNM5T6.js +10 -0
  31. package/dist/{mpp-setup-MPP3ST5X.js → mpp-setup-OQ4OV7A5.js} +2 -1
  32. package/dist/{payout-reporter-KEMUXEUO.js → payout-reporter-TQ3YIFLZ.js} +2 -1
  33. package/dist/{postgres-consumed-credential-store-6N2V5MJN.js → postgres-consumed-credential-store-LFQNC7LD.js} +4 -1
  34. package/dist/{postgres-job-store-VE2JRUEC.js → postgres-job-store-FGOJ7UIX.js} +2 -1
  35. package/dist/{postgres-replay-store-ZF4JNZOW.js → postgres-replay-store-DFQSXPCG.js} +2 -1
  36. package/dist/{pricing-MU5GNUJZ.js → pricing-UJAPJLOM.js} +2 -1
  37. package/dist/{revenue-reporter-O75BGYFK.js → revenue-reporter-VN4WYN74.js} +2 -1
  38. package/dist/server/index.d.ts +1 -1
  39. package/dist/server/index.js +112 -112
  40. package/dist/{tempo-charge-store-SDTUNTKA.js → tempo-charge-store-EA66LSVJ.js} +2 -1
  41. package/dist/{tempo-lifecycle-G5SB4HFC.js → tempo-lifecycle-TJ62A7UX.js} +3 -3
  42. package/dist/{tempo-session-store-WF3VZXNF.js → tempo-session-store-65NA77KJ.js} +3 -2
  43. package/dist/{tempo-wallet-ZFNUDFVO.js → tempo-wallet-RCGBBAJH.js} +1 -1
  44. package/dist/testing/index.js +4 -3
  45. package/dist/{x402-CI6PSHNO.js → x402-S47Q77UE.js} +2 -2
  46. package/package.json +1 -1
  47. package/dist/memory-credit-ledger-BYBATRN3.js +0 -9
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PostgresReplayStore
3
- } from "../chunk-AJNFXR7J.js";
3
+ } from "../chunk-3KYLYVY4.js";
4
4
  import {
5
5
  PostgresKVStore
6
6
  } from "../chunk-V5ZRATJH.js";
@@ -18,7 +18,7 @@ import {
18
18
  parseNwcUri,
19
19
  validateX402Env,
20
20
  withNwcPool
21
- } from "../chunk-FDKRXOZO.js";
21
+ } from "../chunk-KL4C3LQV.js";
22
22
  import {
23
23
  MemoryKVStore
24
24
  } from "../chunk-SDK6KDJN.js";
@@ -76,7 +76,7 @@ import {
76
76
  stripProtocolEnvelope,
77
77
  toCreditView,
78
78
  unknownRouteNotFound
79
- } from "../chunk-CC3UY6OS.js";
79
+ } from "../chunk-HNIKSOI2.js";
80
80
  import {
81
81
  MemoryProcessedPaymentStore,
82
82
  PostgresProcessedPaymentStore,
@@ -85,24 +85,24 @@ import {
85
85
  import "../chunk-BQ2NMWKE.js";
86
86
  import {
87
87
  MemoryCreditLedger
88
- } from "../chunk-U5VNEALI.js";
88
+ } from "../chunk-PPHE7XUU.js";
89
89
  import {
90
90
  PostgresJobStore
91
- } from "../chunk-HHTL3ZFT.js";
91
+ } from "../chunk-YEO5GW7U.js";
92
92
  import {
93
93
  SignedRequestError,
94
94
  createDefaultReplayStore,
95
95
  createSignedRequestVerifier,
96
96
  signedRequestInput
97
- } from "../chunk-H2MEFVH6.js";
97
+ } from "../chunk-UQCK5VMA.js";
98
98
  import {
99
99
  isStreamableJobStore
100
- } from "../chunk-MD3H3BF7.js";
100
+ } from "../chunk-2A33VHYM.js";
101
101
  import {
102
102
  generateEphemeralReceiptKey,
103
103
  isTestMintUrl,
104
104
  receiptPubkeyFromSecret
105
- } from "../chunk-QX52F6IB.js";
105
+ } from "../chunk-DSVGYW3B.js";
106
106
  import {
107
107
  X402_DEFAULT_FACILITATOR,
108
108
  X402_DEFAULT_NETWORK,
@@ -122,10 +122,10 @@ import {
122
122
  } from "../chunk-KXZUCCEY.js";
123
123
  import {
124
124
  initLoggers
125
- } from "../chunk-YO56VCTQ.js";
125
+ } from "../chunk-BWGRKGKG.js";
126
126
  import "../chunk-66HGCPBU.js";
127
127
  import "../chunk-FUJ36YDV.js";
128
- import "../chunk-4A2RAKCW.js";
128
+ import "../chunk-IBDDIG4K.js";
129
129
  import "../chunk-AT6V3SY7.js";
130
130
  import {
131
131
  CreditLedger,
@@ -134,21 +134,24 @@ import {
134
134
  PostgresX402ChannelStorage,
135
135
  X402RelaySubmissionLockError,
136
136
  allocateDrawValue
137
- } from "../chunk-2D75MNNG.js";
137
+ } from "../chunk-ZHTUITDW.js";
138
138
  import {
139
139
  SDK_INIT_ADVISORY_LOCK,
140
140
  withSdkInitLock
141
141
  } from "../chunk-COYKJRMM.js";
142
142
  import {
143
143
  applyRetryToPool
144
- } from "../chunk-C3MTFLC6.js";
144
+ } from "../chunk-M4RSKQAV.js";
145
145
  import {
146
146
  TEMPO_MODERATO_CHAIN_ID,
147
147
  TEMPO_MODERATO_RPC,
148
148
  TEMPO_SETTLEMENT_DEFAULT_LOW_BALANCE_MICRO,
149
149
  TempoSettlementReadiness,
150
150
  resolveTempoNetwork
151
- } from "../chunk-XZ7LW4S5.js";
151
+ } from "../chunk-ZUTI56L7.js";
152
+ import {
153
+ diagnosticConsole
154
+ } from "../chunk-D42FMCLJ.js";
152
155
 
153
156
  // src/sdk/server/cashu-env.ts
154
157
  async function resolveCashuOptsFromEnv(env, pool, cashuModeHint) {
@@ -161,8 +164,8 @@ async function resolveCashuOptsFromEnv(env, pool, cashuModeHint) {
161
164
  const mintsConfigured = Boolean(envMaybe.DVMKIT_CASHU_MINTS);
162
165
  const cashuMode = cashuModeHint ?? (mintsConfigured ? "p2pk-accumulator" : void 0);
163
166
  if (cashuModeHint === void 0 && mintsConfigured) {
164
- console.log(
165
- JSON.stringify({ level: "info", message: "Cashu mode: p2pk-accumulator (default)" })
167
+ diagnosticConsole.log(
168
+ { level: "info", message: void 0 }
166
169
  );
167
170
  }
168
171
  const lockPubkey = envMaybe.DVMKIT_CASHU_LOCK_PUBKEY;
@@ -175,11 +178,11 @@ async function resolveCashuOptsFromEnv(env, pool, cashuModeHint) {
175
178
  if (Number.isFinite(parsed) && parsed > 0) {
176
179
  lockPubkeyGraceSeconds = Math.floor(parsed);
177
180
  } else {
178
- console.warn(
179
- JSON.stringify({
181
+ diagnosticConsole.warn(
182
+ {
180
183
  level: "lock_pubkey_grace_seconds_invalid",
181
- message: `BUILDER_LOCK_PUBKEY_GRACE_SECONDS="${lockPubkeyGraceSecondsRaw}" is not a positive number \u2014 using default ${DEFAULT_LOCK_PUBKEY_GRACE_SECONDS}s.`
182
- })
184
+ message: void 0
185
+ }
183
186
  );
184
187
  }
185
188
  }
@@ -189,22 +192,22 @@ async function resolveCashuOptsFromEnv(env, pool, cashuModeHint) {
189
192
  ...!pool ? ["DATABASE_URL"] : []
190
193
  ];
191
194
  if (envMaybe.DVMKIT_NWC_RECEIVE_URI && cashuMode !== "p2pk-accumulator" && missingAdminConfig.length > 0) {
192
- console.warn(
193
- JSON.stringify({
195
+ diagnosticConsole.warn(
196
+ {
194
197
  level: "admin_surface_missing_config",
195
- message: "Lightning credit recovery requires the builder admin surface, but its lock identity is incomplete.",
198
+ message: void 0,
196
199
  missing: missingAdminConfig
197
- })
200
+ }
198
201
  );
199
202
  }
200
203
  let db;
201
204
  if (cashuMode === "p2pk-accumulator" && missingAdminConfig.length > 0) {
202
- console.warn(
203
- JSON.stringify({
205
+ diagnosticConsole.warn(
206
+ {
204
207
  level: "accumulator_mode_missing_config",
205
- message: "Cashu accumulator mode requires extra config \u2014 dropping cashu from advertised payment methods.",
208
+ message: void 0,
206
209
  missing: missingAdminConfig
207
- })
210
+ }
208
211
  );
209
212
  }
210
213
  if (lockPubkey && dvmId && pool) {
@@ -216,11 +219,11 @@ async function resolveCashuOptsFromEnv(env, pool, cashuModeHint) {
216
219
  await initLockPubkeyTable(db);
217
220
  await seedLockPubkeyState(db, dvmId, lockPubkey);
218
221
  } catch (err) {
219
- console.error(
220
- JSON.stringify({
222
+ diagnosticConsole.error(
223
+ {
221
224
  level: cashuMode === "p2pk-accumulator" ? "accumulator_table_init_failed" : "admin_lock_table_init_failed",
222
- error: err instanceof Error ? err.message : String(err)
223
- })
225
+ error: void 0
226
+ }
224
227
  );
225
228
  if (cashuMode === "p2pk-accumulator") throw err;
226
229
  db = void 0;
@@ -343,14 +346,14 @@ var PlatformLightningRailHealth = class {
343
346
  if (ageMs >= this.maxStalenessMs) {
344
347
  if (this.ceilingLoggedForMs !== observedAtMs) {
345
348
  this.ceilingLoggedForMs = observedAtMs;
346
- console.warn(
347
- JSON.stringify({
349
+ diagnosticConsole.warn(
350
+ {
348
351
  level: "warn",
349
352
  event: "lightning_rail_health_staleness_ceiling",
350
- message: "Lightning funding rail removed from the menu because the platform's channel-liveness observation is too old.",
353
+ message: void 0,
351
354
  age_ms: ageMs,
352
355
  staleness_ceiling_ms: this.maxStalenessMs
353
- })
356
+ }
354
357
  );
355
358
  }
356
359
  return false;
@@ -385,15 +388,15 @@ var PlatformLightningRailHealth = class {
385
388
  }
386
389
  const nowMs = this.now();
387
390
  const observedAtMs = this.observation?.observedAtMs ?? this.startedAtMs;
388
- console.warn(
389
- JSON.stringify({
391
+ diagnosticConsole.warn(
392
+ {
390
393
  level: "warn",
391
394
  event: "lightning_rail_health_fallback",
392
- message: "Platform rail-health signal is unavailable; Lightning stays advertised until the liveness observation reaches its staleness ceiling.",
395
+ message: void 0,
393
396
  reason,
394
397
  age_ms: Math.max(0, nowMs - observedAtMs),
395
398
  staleness_ceiling_ms: this.maxStalenessMs
396
- })
399
+ }
397
400
  );
398
401
  }
399
402
  };
@@ -710,11 +713,11 @@ var LightningReceive = class _LightningReceive {
710
713
  } catch (markErr) {
711
714
  warnSettleFailure("block_failed", markErr, invoice);
712
715
  }
713
- console.error(
714
- JSON.stringify({
716
+ diagnosticConsole.error(
717
+ {
715
718
  level: "error",
716
719
  event: "lightning_settlement_blocked",
717
- message: "A paid Lightning invoice cannot be credited, so the received sats are stranded on a top-up that will never open. Reconcile manually \u2014 the payment hash identifies the payment in your wallet.",
720
+ message: void 0,
718
721
  reason,
719
722
  credit_id: invoice.creditId,
720
723
  fund_id: invoice.fundId,
@@ -722,7 +725,7 @@ var LightningReceive = class _LightningReceive {
722
725
  amount_msats: invoice.amountMsats,
723
726
  amount_micro: invoice.amountMicro,
724
727
  currency: invoice.currency
725
- })
728
+ }
726
729
  );
727
730
  }
728
731
  /**
@@ -780,15 +783,15 @@ var LightningReceive = class _LightningReceive {
780
783
  this.permissionRefusal = refusal;
781
784
  this.checkedAtMs = Date.now();
782
785
  if (previous?.fingerprint === refusal.fingerprint) return;
783
- console.warn(
784
- JSON.stringify({
786
+ diagnosticConsole.warn(
787
+ {
785
788
  level: "warn",
786
789
  event: "lightning_receive_permission_refused",
787
790
  reason: refusal.reason,
788
- message: refusal.message,
789
- hint: refusal.hint,
791
+ message: void 0,
792
+ hint: void 0,
790
793
  ...refusal.advertisedMethods ? { advertised_methods: refusal.advertisedMethods } : {}
791
- })
794
+ }
792
795
  );
793
796
  }
794
797
  /**
@@ -897,14 +900,14 @@ function receivePermissionHint() {
897
900
  function methodName(method) {
898
901
  return method.slice(method.lastIndexOf(".") + 1);
899
902
  }
900
- function warnReceiveUnreachable(err) {
901
- console.warn(
902
- JSON.stringify({
903
+ function warnReceiveUnreachable(_err) {
904
+ diagnosticConsole.warn(
905
+ {
903
906
  level: "warn",
904
907
  event: "lightning_receive_unreachable",
905
- message: "Lightning receive wallet is unreachable \u2014 the credit funding menu will omit `lightning` until a later permission check succeeds. Other rails are unaffected.",
906
- error: err instanceof Error ? err.message : String(err)
907
- })
908
+ message: void 0,
909
+ error: void 0
910
+ }
908
911
  );
909
912
  }
910
913
  function resolveInvoiceTtl(seconds) {
@@ -926,19 +929,19 @@ function resolveFundingMinSats(sats) {
926
929
  return sats;
927
930
  }
928
931
  function warnSettleFailure(reason, err, invoice) {
929
- console.warn(
930
- JSON.stringify({
932
+ diagnosticConsole.warn(
933
+ {
931
934
  level: "warn",
932
935
  event: "lightning_settlement_check_failed",
933
936
  reason,
934
- message: "Could not check Lightning funding invoices for this caller. Any paid invoice stays recorded and credits on a later request.",
937
+ message: void 0,
935
938
  ...invoice ? {
936
939
  credit_id: invoice.creditId,
937
940
  fund_id: invoice.fundId,
938
941
  payment_hash: invoice.paymentHash
939
942
  } : {},
940
- error: err instanceof Error ? err.message : String(err)
941
- })
943
+ error: void 0
944
+ }
942
945
  );
943
946
  }
944
947
 
@@ -1134,7 +1137,7 @@ function createDVMHost(opts = {}) {
1134
1137
  });
1135
1138
  applyRetryToPool(pool, "dvm-host");
1136
1139
  pgPool = pool;
1137
- const { PostgresJobStore: PostgresJobStore2 } = await import("../postgres-job-store-VE2JRUEC.js");
1140
+ const { PostgresJobStore: PostgresJobStore2 } = await import("../postgres-job-store-FGOJ7UIX.js");
1138
1141
  const pgJobStore = new PostgresJobStore2(pool);
1139
1142
  pendingInits.push(pgJobStore.init(), pgJobStore.initStreaming());
1140
1143
  jobStore = pgJobStore;
@@ -1154,7 +1157,7 @@ function createDVMHost(opts = {}) {
1154
1157
  throw new Error("Disposable development Cashu accepts only known test or loopback mints. Real or unknown mints require durable PostgreSQL storage.");
1155
1158
  }
1156
1159
  if (disposableCashu && opts.cashuMode === void 0) {
1157
- console.log(JSON.stringify({ level: "info", message: "Cashu mode: p2pk-accumulator (default)" }));
1160
+ diagnosticConsole.log({ level: "info", message: void 0 });
1158
1161
  }
1159
1162
  const cashuOpts = disposableCashu ? {
1160
1163
  cashuMode: "p2pk-accumulator",
@@ -1175,13 +1178,13 @@ function createDVMHost(opts = {}) {
1175
1178
  `[FATAL] Refusing to boot: platform-hosted DVM configured with test mint(s) [${testMints.join(", ")}]. A test/FakeWallet mint settles no real money \u2014 every payment would silently no-op and revenue would read $0. If this is intentional (dev stack, smoke test, or the staging fleet), set DVMKIT_ALLOW_TEST_MINTS=true.`
1176
1179
  );
1177
1180
  }
1178
- console.warn(
1179
- JSON.stringify({
1181
+ diagnosticConsole.warn(
1182
+ {
1180
1183
  level: "warn",
1181
1184
  event: "platform_hosted_test_mint_allowed",
1182
1185
  mints: testMints,
1183
- message: "Platform-hosted DVM booting with test mint(s) because DVMKIT_ALLOW_TEST_MINTS=true \u2014 payments settle no real money."
1184
- })
1186
+ message: void 0
1187
+ }
1185
1188
  );
1186
1189
  }
1187
1190
  }
@@ -1225,11 +1228,11 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1225
1228
  let tempoChargeBackend = "user-supplied";
1226
1229
  const mppTempoRecipient = envMaybe.DVMKIT_TEMPO_RECIPIENT;
1227
1230
  if (!mpp && mppTempoRecipient) {
1228
- const { createMppFromOpts, createDualKeyMppxFromOpts, parseMppMethodsAllowlist } = await import("../mpp-setup-MPP3ST5X.js");
1231
+ const { createMppFromOpts, createDualKeyMppxFromOpts, parseMppMethodsAllowlist } = await import("../mpp-setup-OQ4OV7A5.js");
1229
1232
  tempoChargeBackend = pgPool ? "postgres" : "memory";
1230
1233
  let tempoCharge;
1231
1234
  if (pgPool) {
1232
- const { PostgresTempoChargeStore } = await import("../tempo-charge-store-SDTUNTKA.js");
1235
+ const { PostgresTempoChargeStore } = await import("../tempo-charge-store-EA66LSVJ.js");
1233
1236
  const chargeStore = new PostgresTempoChargeStore(pgPool);
1234
1237
  pendingInits.push(chargeStore.init());
1235
1238
  tempoCharge = { store: chargeStore };
@@ -1248,7 +1251,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1248
1251
  { createPublicClient, createWalletClient, erc20Abi, http },
1249
1252
  { tempo: tempoMainnet, tempoModerato }
1250
1253
  ] = await Promise.all([
1251
- import("../tempo-session-store-WF3VZXNF.js"),
1254
+ import("../tempo-session-store-65NA77KJ.js"),
1252
1255
  import("viem/accounts"),
1253
1256
  import("viem"),
1254
1257
  import("viem/chains")
@@ -1315,8 +1318,8 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1315
1318
  onInsufficientFunds: (failure) => tempoSettlementReadiness?.recordInsufficientFunds(failure),
1316
1319
  onSessionSettlement: async (settlement) => {
1317
1320
  await tempoSettlementReadiness?.recordSuccessfulTransaction(settlement.recoveryVersion);
1318
- console.info(
1319
- JSON.stringify({
1321
+ diagnosticConsole.info(
1322
+ {
1320
1323
  level: "info",
1321
1324
  event: "tempo_session_settled",
1322
1325
  channel_id: settlement.channelId,
@@ -1324,7 +1327,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1324
1327
  trigger: settlement.trigger,
1325
1328
  amount: settlement.amount.toString(),
1326
1329
  delta: settlement.delta.toString()
1327
- })
1330
+ }
1328
1331
  );
1329
1332
  await payoutSinks.tempoSettled?.({
1330
1333
  txHash: settlement.txHash,
@@ -1358,14 +1361,14 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1358
1361
  );
1359
1362
  mppSecretState = rotation.state;
1360
1363
  if (rotation.rapidRotation) {
1361
- console.warn(
1362
- JSON.stringify({
1364
+ diagnosticConsole.warn(
1365
+ {
1363
1366
  level: "warn",
1364
1367
  event: "mpp_rapid_rotation_detected",
1365
- message: "MPP secret rotated twice inside the rotation window \u2014 oldest secret has been dropped",
1368
+ message: void 0,
1366
1369
  rapid_rotation_at_ms: rotation.state.rapidRotationAtMs,
1367
1370
  previous_expires_at_ms: rotation.state.previous?.expiresAtMs
1368
- })
1371
+ }
1369
1372
  );
1370
1373
  }
1371
1374
  const localPool = pgPool;
@@ -1379,7 +1382,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1379
1382
  }
1380
1383
  }
1381
1384
  const fxSource = envMaybe.DVMKIT_FX_SOURCE;
1382
- const { createFxFetcher, resolveFxSourceFromEnv, warmFxSnapshot } = await import("../pricing-MU5GNUJZ.js");
1385
+ const { createFxFetcher, resolveFxSourceFromEnv, warmFxSnapshot } = await import("../pricing-UJAPJLOM.js");
1383
1386
  const fxFetcher = opts.fx ?? createFxFetcher({ source: resolveFxSourceFromEnv(envMaybe) });
1384
1387
  const hostRailConfigured = (opts.paymentMethods?.length ?? 0) > 0 || (effectiveMints?.length ?? 0) > 0 || !!x402WithDualServe || !!mpp;
1385
1388
  if (mounts.some((entry) => mountNeedsFx(entry, hostRailConfigured))) warmFxSnapshot(fxFetcher);
@@ -1389,7 +1392,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1389
1392
  assertReceiptIdentity(envMaybe, opts.builder, receiptKey, cashuOpts.dvmId, opts.devMode);
1390
1393
  let sharedPgReplayStore;
1391
1394
  if (pgPool) {
1392
- const { PostgresReplayStore: PostgresReplayStore2 } = await import("../postgres-replay-store-ZF4JNZOW.js");
1395
+ const { PostgresReplayStore: PostgresReplayStore2 } = await import("../postgres-replay-store-DFQSXPCG.js");
1393
1396
  const store2 = new PostgresReplayStore2(pgPool);
1394
1397
  pendingInits.push(store2.init());
1395
1398
  sharedPgReplayStore = store2;
@@ -1405,25 +1408,25 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1405
1408
  if (failFast) {
1406
1409
  throw new Error(`[FATAL] ${msg}`);
1407
1410
  }
1408
- console.warn(
1409
- JSON.stringify({
1411
+ diagnosticConsole.warn(
1412
+ {
1410
1413
  level: "warn",
1411
1414
  event: "secp256k1_auth_replay_store_in_memory",
1412
1415
  mount: entry.descriptor.name,
1413
- message: msg
1414
- })
1416
+ message: void 0
1417
+ }
1415
1418
  );
1416
1419
  }
1417
1420
  }
1418
1421
  let sharedPgConsumedStore;
1419
1422
  if (pgPool) {
1420
- const { PostgresConsumedCredentialStore } = await import("../postgres-consumed-credential-store-6N2V5MJN.js");
1423
+ const { PostgresConsumedCredentialStore } = await import("../postgres-consumed-credential-store-LFQNC7LD.js");
1421
1424
  const consumedStore = new PostgresConsumedCredentialStore(pgPool);
1422
1425
  pendingInits.push(consumedStore.init());
1423
1426
  sharedPgConsumedStore = consumedStore;
1424
1427
  }
1425
1428
  if (pgPool) {
1426
- const { CreditLedger: CreditLedger2 } = await import("../credit-ledger-MHA652TV.js");
1429
+ const { CreditLedger: CreditLedger2 } = await import("../credit-ledger-4CCHRJE2.js");
1427
1430
  const pgLedger = new CreditLedger2(pgPool, tempoSessionStore);
1428
1431
  pendingInits.push(pgLedger.init());
1429
1432
  creditLedger = pgLedger;
@@ -1432,7 +1435,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1432
1435
  pendingInits.push(pgProcessed.init());
1433
1436
  processedPayments = pgProcessed;
1434
1437
  } else {
1435
- const { MemoryCreditLedger: MemoryCreditLedger2 } = await import("../memory-credit-ledger-BYBATRN3.js");
1438
+ const { MemoryCreditLedger: MemoryCreditLedger2 } = await import("../memory-credit-ledger-TERNM5T6.js");
1436
1439
  creditLedger = disposableCashu?.ledger ?? new MemoryCreditLedger2();
1437
1440
  const { MemoryProcessedPaymentStore: MemoryProcessedPaymentStore2 } = await import("../processed-payment-store-GKMAWOM3.js");
1438
1441
  processedPayments = new MemoryProcessedPaymentStore2();
@@ -1447,7 +1450,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1447
1450
  if (failFast) {
1448
1451
  throw new Error(`[FATAL] ${msg}`);
1449
1452
  }
1450
- console.warn(JSON.stringify({ level: "warn", event, message: msg }));
1453
+ diagnosticConsole.warn({ level: "warn", event, message: void 0 });
1451
1454
  }
1452
1455
  };
1453
1456
  const mppActive = mounts.some((e) => (e.descriptor.mpp ?? mpp) !== void 0);
@@ -1510,7 +1513,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1510
1513
  if (descX402Support && !x402Settleable) {
1511
1514
  const message = `x402 network ${descX402Support.network} has no settleable kind at facilitator ${descX402Support.facilitator}. Use eip155:84532 (Base Sepolia) with x402.org for test funds, or a facilitator supporting your configured mainnet. No network was changed.`;
1512
1515
  if (failFast) throw new Error(message);
1513
- console.warn(JSON.stringify({ level: "warn", event: "x402_network_unsupported", message }));
1516
+ diagnosticConsole.warn({ level: "warn", event: "x402_network_unsupported", message });
1514
1517
  }
1515
1518
  const paymentMode = resolvePaymentMode({
1516
1519
  mount: descriptor.name,
@@ -1524,12 +1527,12 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1524
1527
  durable: !!pgPool
1525
1528
  });
1526
1529
  paymentModes.push(paymentMode);
1527
- console.log(JSON.stringify({
1530
+ diagnosticConsole.log({
1528
1531
  level: "info",
1529
1532
  event: "payment_mode",
1530
1533
  ...paymentMode,
1531
- ...disposableCashu ? { message: "Test funds only. Proofs, balances and jobs are lost on shutdown; the next boot uses a fresh Cashu lock identity." } : {}
1532
- }));
1534
+ ...disposableCashu ? { message: void 0 } : {}
1535
+ });
1533
1536
  const {
1534
1537
  app: subApp,
1535
1538
  shutdown,
@@ -1639,17 +1642,17 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1639
1642
  prev = atMs;
1640
1643
  }
1641
1644
  deltas.listen = portBindMs - prev;
1642
- console.log(
1643
- JSON.stringify({
1645
+ diagnosticConsole.log(
1646
+ {
1644
1647
  level: "dvm_boot_phase_timings",
1645
1648
  totalMsToPortBind: portBindMs,
1646
1649
  phaseMs: deltas
1647
1650
  // removed the pre-`listen` `mint_wait` phase: mint health
1648
1651
  // is now validated by the runtime tracker after the port binds, so
1649
1652
  // `totalMsToPortBind` no longer carries the mint-probe tail.
1650
- })
1653
+ }
1651
1654
  );
1652
- console.log(`DVM host running at ${url}`);
1655
+ diagnosticConsole.log(`DVM host running at ${url}`);
1653
1656
  resolvePromise({
1654
1657
  url,
1655
1658
  paymentModes,
@@ -1712,11 +1715,8 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1712
1715
  if (entry.bootCompleted && entry.descriptor.config.onShutdown) {
1713
1716
  try {
1714
1717
  await entry.descriptor.config.onShutdown();
1715
- } catch (err) {
1716
- console.error(
1717
- `[host] onShutdown(${entry.descriptor.name}) threw:`,
1718
- err instanceof Error ? err.message : err
1719
- );
1718
+ } catch (_err) {
1719
+ diagnosticConsole.error();
1720
1720
  }
1721
1721
  }
1722
1722
  await capture(() => entry.shutdown?.());
@@ -1926,24 +1926,24 @@ function parseTempoSettlementFloor(env) {
1926
1926
  return parsed;
1927
1927
  }
1928
1928
  function logBootSummary(s) {
1929
- console.log(
1929
+ diagnosticConsole.log(
1930
1930
  ` Mounts: ${s.mounts.map((m) => m.name + (m.prefix ?? "")).join(", ") || "(none)"}`
1931
1931
  );
1932
- console.log(` Database: ${s.databaseConnected ? "connected" : "(not configured)"}`);
1933
- console.log(` Mints: ${s.mints && s.mints.length > 0 ? s.mints.join(", ") : "(none)"}`);
1934
- console.log(` Cashu mode: ${s.cashuOpts.cashuMode ?? "(disabled)"}`);
1935
- console.log(` Tempo: ${s.mpp ? `realm=${s.mpp.realm}` : "(unconfigured)"}`);
1932
+ diagnosticConsole.log(` Database: ${s.databaseConnected ? "connected" : "(not configured)"}`);
1933
+ diagnosticConsole.log(` Mints: ${s.mints && s.mints.length > 0 ? s.mints.join(", ") : "(none)"}`);
1934
+ diagnosticConsole.log(` Cashu mode: ${s.cashuOpts.cashuMode ?? "(disabled)"}`);
1935
+ diagnosticConsole.log(` Tempo: ${s.mpp ? `realm=${s.mpp.realm}` : "(unconfigured)"}`);
1936
1936
  if (s.mpp) {
1937
1937
  const rotState = !s.mppSecretState ? "single-key (no DB-backed rotation)" : s.mppSecretState.previous ? `dual-key (previous expires ${new Date(s.mppSecretState.previous.expiresAtMs).toISOString()})` : "active-only";
1938
- console.log(` Tempo secret: ${rotState}`);
1938
+ diagnosticConsole.log(` Tempo secret: ${rotState}`);
1939
1939
  }
1940
- console.log(
1940
+ diagnosticConsole.log(
1941
1941
  ` x402: ${s.x402 ? `${s.x402.network} \u2192 ${s.x402.payTo}${s.x402Support?.available === false ? isConfiguredX402Settleable(s.x402Support, s.x402) ? " (exact unavailable \u2014 batch configured)" : " (no configured settleable path)" : ""}` : "(unconfigured)"}`
1942
1942
  );
1943
- console.log(
1943
+ diagnosticConsole.log(
1944
1944
  ` LN receive: ${s.lightningReceive ? `receive-only NWC (${s.lightningReceive.available() ? "reachable" : "unreachable \u2014 omitted from the funding menu"})` : "(unconfigured)"}`
1945
1945
  );
1946
- console.log(
1946
+ diagnosticConsole.log(
1947
1947
  ` Platform rep.: ${revenueReporterBannerState({
1948
1948
  platformUrl: s.platformUrl,
1949
1949
  hasPlatformToken: s.hasPlatformToken,
@@ -1952,14 +1952,14 @@ function logBootSummary(s) {
1952
1952
  devMode: s.devMode
1953
1953
  })}`
1954
1954
  );
1955
- console.log(` FX source: ${s.fxSource ?? "(default \u2014 CoinGecko)"}`);
1956
- console.log(` Fail-fast: ${s.failFast ? "on" : "off"}`);
1957
- console.log(` Observability: ${s.observability}`);
1955
+ diagnosticConsole.log(` FX source: ${s.fxSource ?? "(default \u2014 CoinGecko)"}`);
1956
+ diagnosticConsole.log(` Fail-fast: ${s.failFast ? "on" : "off"}`);
1957
+ diagnosticConsole.log(` Observability: ${s.observability}`);
1958
1958
  for (const entry of s.replayStores) {
1959
- console.log(` Replay store: ${entry.mount} \u2192 ${formatReplayBackend(entry.backend)}`);
1959
+ diagnosticConsole.log(` Replay store: ${entry.mount} \u2192 ${formatReplayBackend(entry.backend)}`);
1960
1960
  }
1961
1961
  for (const entry of s.stores) {
1962
- console.log(` ${storeLabel(entry.label)} ${formatStoreBackend(entry.backend)}`);
1962
+ diagnosticConsole.log(` ${storeLabel(entry.label)} ${formatStoreBackend(entry.backend)}`);
1963
1963
  }
1964
1964
  }
1965
1965
  function storeLabel(label) {
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  PostgresTempoChargeStore
3
- } from "./chunk-N5B66UOS.js";
3
+ } from "./chunk-U2EYIPFX.js";
4
4
  import "./chunk-YG7G4DPZ.js";
5
5
  import "./chunk-COYKJRMM.js";
6
+ import "./chunk-D42FMCLJ.js";
6
7
  export {
7
8
  PostgresTempoChargeStore
8
9
  };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  assertTempoWalletIdle
3
- } from "./chunk-FPOLJRBF.js";
4
- import "./chunk-VIVXB4CD.js";
5
- import "./chunk-MMCE7XSR.js";
3
+ } from "./chunk-Z3EHBW2G.js";
4
+ import "./chunk-YYQG4R7T.js";
5
+ import "./chunk-C2AGARLM.js";
6
6
  import "./chunk-MG67KXU7.js";
7
7
  import "./chunk-A4CM2BD3.js";
8
8
  import "./chunk-MKI6OVW4.js";
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  PostgresTempoSessionStore,
3
3
  assertMonotonicTransition
4
- } from "./chunk-D7YQYLLM.js";
4
+ } from "./chunk-J7PW2U6P.js";
5
5
  import "./chunk-YG7G4DPZ.js";
6
6
  import "./chunk-COYKJRMM.js";
7
- import "./chunk-C3MTFLC6.js";
7
+ import "./chunk-M4RSKQAV.js";
8
+ import "./chunk-D42FMCLJ.js";
8
9
  export {
9
10
  PostgresTempoSessionStore,
10
11
  assertMonotonicTransition
@@ -15,7 +15,7 @@ import {
15
15
  tempoTokenReference,
16
16
  tempoWrongAssetHint,
17
17
  tryResolveTempoAsset
18
- } from "./chunk-VIVXB4CD.js";
18
+ } from "./chunk-YYQG4R7T.js";
19
19
  import "./chunk-MG67KXU7.js";
20
20
  import "./chunk-MKI6OVW4.js";
21
21
  import "./chunk-FUJ36YDV.js";
@@ -5,16 +5,17 @@ import {
5
5
  JobCancelledError,
6
6
  MemoryJobStore,
7
7
  createInstrumentedFetch
8
- } from "../chunk-MD3H3BF7.js";
8
+ } from "../chunk-2A33VHYM.js";
9
9
  import {
10
10
  createNoopLogger
11
- } from "../chunk-YO56VCTQ.js";
11
+ } from "../chunk-BWGRKGKG.js";
12
12
  import "../chunk-66HGCPBU.js";
13
13
  import "../chunk-FUJ36YDV.js";
14
14
  import {
15
15
  validateCurrency
16
- } from "../chunk-4A2RAKCW.js";
16
+ } from "../chunk-IBDDIG4K.js";
17
17
  import "../chunk-AT6V3SY7.js";
18
+ import "../chunk-D42FMCLJ.js";
18
19
 
19
20
  // src/sdk/testing/test-context.ts
20
21
  function createTestContext(opts) {
@@ -10,8 +10,8 @@ import {
10
10
  saveX402Wallet,
11
11
  tryX402Payment,
12
12
  x402WrongAssetHint
13
- } from "./chunk-O6D72KYA.js";
14
- import "./chunk-MMCE7XSR.js";
13
+ } from "./chunk-YRDA7EWN.js";
14
+ import "./chunk-C2AGARLM.js";
15
15
  import "./chunk-MG67KXU7.js";
16
16
  import {
17
17
  verifyX402Payment
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvmkit/sdk",
3
- "version": "0.3.1-rc.10",
3
+ "version": "0.3.2-rc.10",
4
4
  "description": "SDK for building accountless, pay-per-use Digital Vending Machines",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {