@dvmkit/dvm-cli 0.15.3 → 0.16.0

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 (26) hide show
  1. package/dist/{chunk-I7ZBID4L.js → chunk-2TNH4ME5.js} +2 -2
  2. package/dist/{chunk-HXTASGHL.js → chunk-A2B7QDMS.js} +2 -2
  3. package/dist/{chunk-EZL4IVCU.js → chunk-CEBEPXQ7.js} +3 -3
  4. package/dist/{chunk-57PXJ56K.js → chunk-DGA5EFKU.js} +354 -186
  5. package/dist/{chunk-UWVMG4VG.js → chunk-H6WQ4S6K.js} +3 -3
  6. package/dist/{chunk-D5CGDS3V.js → chunk-IK7RI645.js} +2 -2
  7. package/dist/{chunk-DZHEYRS2.js → chunk-LDYMUQZE.js} +2782 -2606
  8. package/dist/{chunk-F45ETHDP.js → chunk-NSA2RJ2T.js} +14 -6
  9. package/dist/{chunk-YQJRKWNT.js → chunk-U2PODYIS.js} +24487 -22833
  10. package/dist/{chunk-UCCT5IKU.js → chunk-UFMAHF6T.js} +63 -1
  11. package/dist/{chunk-2MCZ4QOK.js → chunk-WRIXUSMR.js} +2 -2
  12. package/dist/{chunk-HJ2JYBTT.js → chunk-WSLZBJ52.js} +4 -4
  13. package/dist/{client-NBC2IDA2.js → client-S5PTHG25.js} +6 -6
  14. package/dist/dvm.js +159 -75
  15. package/dist/{internal-O7IQD6EQ.js → internal-3SIUYRWP.js} +5 -5
  16. package/dist/{lifecycle-MIJH3JE4.js → lifecycle-7NHL5ATK.js} +6 -6
  17. package/dist/{payout-reporter-Y6OW3FYD-K6MRWQXK.js → payout-reporter-F5LFV5W4-EJ7E5ALO.js} +2 -2
  18. package/dist/{pocket-refill-LCDXSC74.js → pocket-refill-3CA4PFXG.js} +10 -10
  19. package/dist/{revenue-reporter-CIG2MEDN-ZXMO6NWG.js → revenue-reporter-2U55YH2I-EUB6PBRN.js} +2 -2
  20. package/dist/{tempo-lifecycle-FMBCHD2M.js → tempo-lifecycle-GAM3DJ63.js} +8 -8
  21. package/dist/{tempo-wallet-U3WBWIIH.js → tempo-wallet-JTARPYLN.js} +7 -7
  22. package/dist/{wallet-Z3FDX43V.js → wallet-QKAKRLPI.js} +7 -7
  23. package/dist/{x402-ARXZQ5BD-H6PNJYYT.js → x402-G6C4N2BN-TAJEBQGU.js} +2 -2
  24. package/package.json +2 -2
  25. package/skills/dvm/calling.md +1 -1
  26. package/skills/dvm/wallets.md +9 -1
package/dist/dvm.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  assertTempoWalletIdle,
6
6
  findSigningIdentityByPubkey,
7
7
  resolveSigningIdentity
8
- } from "./chunk-EZL4IVCU.js";
8
+ } from "./chunk-CEBEPXQ7.js";
9
9
  import {
10
10
  CARD_MIN_MICRO,
11
11
  DEFAULT_CREDIT_POSTURE,
@@ -43,6 +43,7 @@ import {
43
43
  computeNextAction,
44
44
  correctPendingFundAmount,
45
45
  createMessageAppendSession,
46
+ createPendingMintQuote,
46
47
  declinedAskSeqs,
47
48
  deriveAlias,
48
49
  describeMintBounds,
@@ -67,6 +68,7 @@ import {
67
68
  fundCredit,
68
69
  fundTimeoutMs,
69
70
  guidanceJobArg,
71
+ hasPendingAcceptedJobAccess,
70
72
  hasUnknownUpfrontCredit,
71
73
  hasUnknownUpfrontRail,
72
74
  heldCashuSubmissionAsks,
@@ -192,18 +194,19 @@ import {
192
194
  updateJob,
193
195
  updateObservedJob,
194
196
  walletHistory,
197
+ walletInvoiceFundingAdvice,
195
198
  warnInvalidJobIdentityHeader,
196
199
  withAcceptedUnresolved,
197
200
  withIdentityRecovery,
198
201
  withJobTokenRedaction,
199
202
  withRequestResultRecovery
200
- } from "./chunk-DZHEYRS2.js";
203
+ } from "./chunk-LDYMUQZE.js";
201
204
  import {
202
205
  connectedTempoAccount,
203
206
  generateTempoKey,
204
207
  tempoBalanceCheckHint,
205
208
  tempoWrongAssetHint
206
- } from "./chunk-HJ2JYBTT.js";
209
+ } from "./chunk-WSLZBJ52.js";
207
210
  import {
208
211
  addOutputWarnings,
209
212
  assertValidBudget,
@@ -224,7 +227,7 @@ import {
224
227
  tryResolveBtcUsdRate,
225
228
  tryX402Payment,
226
229
  withOutputWarnings
227
- } from "./chunk-F45ETHDP.js";
230
+ } from "./chunk-NSA2RJ2T.js";
228
231
  import {
229
232
  assertSupportedX402Network,
230
233
  connectedX402Payer,
@@ -233,7 +236,7 @@ import {
233
236
  repinX402WalletNetwork,
234
237
  saveX402Wallet,
235
238
  x402NetworkLabel
236
- } from "./chunk-UWVMG4VG.js";
239
+ } from "./chunk-H6WQ4S6K.js";
237
240
  import {
238
241
  CREDIT_POSTURES,
239
242
  FEEDBACK_POSTURES,
@@ -250,10 +253,10 @@ import {
250
253
  retireConfigBackup,
251
254
  rollbackConfig,
252
255
  updateConfig
253
- } from "./chunk-2MCZ4QOK.js";
256
+ } from "./chunk-WRIXUSMR.js";
254
257
  import {
255
258
  assertX402WalletIdle
256
- } from "./chunk-I7ZBID4L.js";
259
+ } from "./chunk-2TNH4ME5.js";
257
260
  import {
258
261
  A,
259
262
  AGENT_MNEMONIC_FILE,
@@ -492,7 +495,7 @@ import {
492
495
  x402PendingUnsettled,
493
496
  x402RequiredFromError,
494
497
  x402ReservationRelease
495
- } from "./chunk-YQJRKWNT.js";
498
+ } from "./chunk-U2PODYIS.js";
496
499
  import "./chunk-JBU7RKQ3.js";
497
500
  import "./chunk-KDNFUDOG.js";
498
501
  import "./chunk-IUTVV6N5.js";
@@ -778,11 +781,11 @@ import {
778
781
  usdToMsats,
779
782
  usdcToMsats,
780
783
  x402NetworkByCaip2
781
- } from "./chunk-57PXJ56K.js";
782
- import "./chunk-HXTASGHL.js";
783
- import "./chunk-D5CGDS3V.js";
784
+ } from "./chunk-DGA5EFKU.js";
785
+ import "./chunk-A2B7QDMS.js";
786
+ import "./chunk-IK7RI645.js";
784
787
  import "./chunk-R2DSAZBO.js";
785
- import "./chunk-UCCT5IKU.js";
788
+ import "./chunk-UFMAHF6T.js";
786
789
  import {
787
790
  privateKeyToAccount
788
791
  } from "./chunk-EVQERRCP.js";
@@ -11444,6 +11447,11 @@ async function handlePaymentRequest(jobId, request2, policy, transport, provider
11444
11447
  });
11445
11448
  }
11446
11449
  async function handleLockedPaymentRequest(jobId, request2, policy, transport, provider, opts) {
11450
+ if (hasPendingAcceptedJobAccess(jobId, provider.endpoint)) throw new DvmError(
11451
+ "local_job_state_unsaved",
11452
+ "Private recovery state must be folded before another payment can be sent.",
11453
+ "Run dvm status <job_id> --messages before paying; unresolved recovery records remain preserved."
11454
+ );
11447
11455
  const approval = opts?.requestSeq === void 0 ? void 0 : {
11448
11456
  requestSeq: opts.requestSeq,
11449
11457
  approval: opts.approval ?? "auto"
@@ -11605,8 +11613,8 @@ async function handleLockedPaymentRequest(jobId, request2, policy, transport, pr
11605
11613
  }
11606
11614
  }
11607
11615
  if ((opts?.rail === void 0 || opts.rail === "x402") && request2.x402) {
11608
- const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-Z3FDX43V.js");
11609
- const { tryX402Payment: tryX402Payment2 } = await import("./client-NBC2IDA2.js");
11616
+ const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-QKAKRLPI.js");
11617
+ const { tryX402Payment: tryX402Payment2 } = await import("./client-S5PTHG25.js");
11610
11618
  const wallet = loadX402Wallet2();
11611
11619
  if (wallet) {
11612
11620
  let proof;
@@ -14384,7 +14392,7 @@ async function settleCreditAfterJob(args) {
14384
14392
  }
14385
14393
  }
14386
14394
  if (args.allowTopup !== false) {
14387
- const refill = args.refillPocket ?? (await import("./pocket-refill-LCDXSC74.js")).refillPocketIfLow;
14395
+ const refill = args.refillPocket ?? (await import("./pocket-refill-3CA4PFXG.js")).refillPocketIfLow;
14388
14396
  await refill({ human: args.human }).catch(() => void 0);
14389
14397
  }
14390
14398
  }
@@ -15159,14 +15167,14 @@ async function confirmRollback(stored, preview, opts) {
15159
15167
  async function withStrandingChecked(removing, commit) {
15160
15168
  const leaving = new Set(removing.map((target) => target.split(".")[0]));
15161
15169
  if (leaving.has("tempo")) {
15162
- const { assertTempoWalletIdle: assertTempoWalletIdle2 } = await import("./tempo-lifecycle-FMBCHD2M.js");
15170
+ const { assertTempoWalletIdle: assertTempoWalletIdle2 } = await import("./tempo-lifecycle-GAM3DJ63.js");
15163
15171
  await assertTempoWalletIdle2("disconnect");
15164
15172
  }
15165
15173
  if (!leaving.has("x402")) return commit();
15166
- const { withX402ChannelLock: withX402ChannelLock2, listPendingX402Fundings: listPendingX402Fundings2, x402PendingUnsettled: x402PendingUnsettled2 } = await import("./internal-O7IQD6EQ.js");
15167
- const { assertX402WalletIdle: assertX402WalletIdle2 } = await import("./lifecycle-MIJH3JE4.js");
15168
- const { ensureAddress: ensureAddress2 } = await import("./internal-O7IQD6EQ.js");
15169
- const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-Z3FDX43V.js");
15174
+ const { withX402ChannelLock: withX402ChannelLock2, listPendingX402Fundings: listPendingX402Fundings2, x402PendingUnsettled: x402PendingUnsettled2 } = await import("./internal-3SIUYRWP.js");
15175
+ const { assertX402WalletIdle: assertX402WalletIdle2 } = await import("./lifecycle-7NHL5ATK.js");
15176
+ const { ensureAddress: ensureAddress2 } = await import("./internal-3SIUYRWP.js");
15177
+ const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-QKAKRLPI.js");
15170
15178
  return withX402ChannelLock2(async () => {
15171
15179
  const unsettled = listPendingX402Fundings2().filter((entry) => x402PendingUnsettled2(entry));
15172
15180
  if (unsettled.length > 0) {
@@ -19994,7 +20002,8 @@ async function runCreditFund(dvm, opts) {
19994
20002
  menu,
19995
20003
  providerInfo,
19996
20004
  opts,
19997
- config: config2
20005
+ config: config2,
20006
+ rail
19998
20007
  });
19999
20008
  }
20000
20009
  const outcome = await fundCredit({
@@ -20036,6 +20045,7 @@ async function runCreditFund(dvm, opts) {
20036
20045
  adopted ? `${baseHint ? `${baseHint} ` : ""}${adopted.advice}` : baseHint,
20037
20046
  {
20038
20047
  ...err?.data ?? {},
20048
+ ...outcome.walletFundCommand ? { wallet_fund_command: outcome.walletFundCommand } : {},
20039
20049
  display: outcome.display,
20040
20050
  endpoint,
20041
20051
  credit_id: outcome.creditId,
@@ -20374,17 +20384,24 @@ async function enforceTrustTier(args) {
20374
20384
  const capUsd = `$${formatUsd(cap2 / 1e6)}`;
20375
20385
  const held = fundsTracked ? Math.max(args.stored?.remainingMicro ?? 0, 0) : 0;
20376
20386
  const heldClause = held > 0 ? ` On top of the $${formatUsd(held / 1e6)} already on deposit, that would leave $${formatUsd(exposureMicro / 1e6)} here.` : "";
20387
+ const lightningMinimum = args.menu?.lightning_min_micro;
20388
+ const walletFunding = args.rail === "lightning" && lightningMinimum !== void 0 && lightningMinimum > cap2 ? {
20389
+ ...walletInvoiceFundingAdvice(args.amountMicro),
20390
+ minimumUsd: `$${formatUsd(lightningMinimum / 1e6)}`
20391
+ } : void 0;
20392
+ const walletGuidance = walletFunding ? `Lightning top-ups here start at ${walletFunding.minimumUsd}, above the ${capUsd} this caller can load at the current trust tier. ${walletFunding.text} ` : "";
20377
20393
  throw withHeadroom(
20378
20394
  new DvmError(
20379
20395
  "amount_exceeds_trust_tier",
20380
20396
  `Funding ${amountUsd} at ${args.endpoint} would exceed this DVM's ${capUsd} trust-tier cap.`,
20381
- `Nothing moved. Re-run with --over-trust to fund it anyway, or pre-grant every DVM signed by this builder with 'dvm credit trust ${args.endpoint} <builder-max|$amount>'. Or fund ${capUsd} or less.`,
20397
+ walletFunding ? `No money moved. ${walletGuidance}Re-run with --over-trust to fund credit over Lightning anyway, or pre-grant every DVM signed by this builder with 'dvm credit trust ${args.endpoint} <builder-max|$amount>'.` : `Nothing moved. Re-run with --over-trust to fund it anyway, or pre-grant every DVM signed by this builder with 'dvm credit trust ${args.endpoint} <builder-max|$amount>'. Or fund ${capUsd} or less.`,
20382
20398
  {
20383
- display: `This agent has only earned ${capUsd} of credit at ${args.endpoint} so far, and ${amountUsd} was asked for.${heldClause} No money moved. Loading more than the earned amount is allowed, but it has to be asked for explicitly \u2014 re-run with --over-trust, or pre-grant every DVM signed by this builder with 'dvm credit trust ${args.endpoint} <builder-max|$amount>'.`,
20399
+ display: `This agent has only earned ${capUsd} of credit at ${args.endpoint} so far, and ${amountUsd} was asked for.${heldClause} No money moved. ` + walletGuidance + `Loading more than the earned amount is allowed, but it has to be asked for explicitly \u2014 re-run with --over-trust, or pre-grant every DVM signed by this builder with 'dvm credit trust ${args.endpoint} <builder-max|$amount>'.`,
20384
20400
  endpoint: args.endpoint,
20385
20401
  amount_micro: args.amountMicro,
20386
20402
  exposure_micro: exposureMicro,
20387
- cap_micro: cap2
20403
+ cap_micro: cap2,
20404
+ ...walletFunding ? { wallet_fund_command: walletFunding.command } : {}
20388
20405
  }
20389
20406
  ),
20390
20407
  headroom
@@ -21864,8 +21881,8 @@ async function probeX402(x402, timeoutMs) {
21864
21881
  let network;
21865
21882
  let address;
21866
21883
  try {
21867
- const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-Z3FDX43V.js");
21868
- const { getX402Balance, ensureAddress: ensureAddress2, usdcContractByCaip2 } = await import("./internal-O7IQD6EQ.js");
21884
+ const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-QKAKRLPI.js");
21885
+ const { getX402Balance, ensureAddress: ensureAddress2, usdcContractByCaip2 } = await import("./internal-3SIUYRWP.js");
21869
21886
  const wallet = loadX402Wallet2();
21870
21887
  if (!wallet) {
21871
21888
  const storedKey = x402.privateKey;
@@ -21917,8 +21934,8 @@ async function probeMpp(mpp, timeoutMs) {
21917
21934
  if (!mpp) return null;
21918
21935
  if (mpp.method === "tempo") {
21919
21936
  try {
21920
- const { connectedTempoAccount: connectedTempoAccount2 } = await import("./tempo-wallet-U3WBWIIH.js");
21921
- const { getTempoUsdcBalance: getTempoUsdcBalance3, resolveTempoNetwork: resolveTempoNetwork2 } = await import("./internal-O7IQD6EQ.js");
21937
+ const { connectedTempoAccount: connectedTempoAccount2 } = await import("./tempo-wallet-JTARPYLN.js");
21938
+ const { getTempoUsdcBalance: getTempoUsdcBalance3, resolveTempoNetwork: resolveTempoNetwork2 } = await import("./internal-3SIUYRWP.js");
21922
21939
  const account = await connectedTempoAccount2();
21923
21940
  if (!account) {
21924
21941
  return {
@@ -27227,9 +27244,15 @@ function quoteWithinDeclaredLimit(quote2, limitMsats, declaredLimit, rail) {
27227
27244
  }
27228
27245
  function quoteWithinNativeDollarLimit(quote2, declaredLimit, rail) {
27229
27246
  const normalizedRail = rail?.trim().toLowerCase();
27230
- if (normalizedRail === "x402") return x402QuoteWithinDollarLimit(quote2, declaredLimit);
27231
- if (normalizedRail === "tempo") return tempoQuoteWithinDollarLimit(quote2, declaredLimit);
27232
- return void 0;
27247
+ if (normalizedRail === "x402") {
27248
+ const native = x402QuoteWithinDollarLimit(quote2, declaredLimit);
27249
+ if (native !== void 0) return native;
27250
+ }
27251
+ const upfront = upfrontQuoteWithinDollarLimit(quote2, declaredLimit);
27252
+ if (normalizedRail === "tempo" && declaredLimit?.trim().startsWith("$")) {
27253
+ return upfront ?? false;
27254
+ }
27255
+ return upfront;
27233
27256
  }
27234
27257
  function x402QuoteWithinDollarLimit(quote2, declaredLimit) {
27235
27258
  if (!declaredLimit || !quote2.requiredUsdcMicro) return void 0;
@@ -27237,12 +27260,12 @@ function x402QuoteWithinDollarLimit(quote2, declaredLimit) {
27237
27260
  if (limitMicro === void 0 || !/^\d+$/.test(quote2.requiredUsdcMicro)) return void 0;
27238
27261
  return BigInt(quote2.requiredUsdcMicro) <= limitMicro;
27239
27262
  }
27240
- function tempoQuoteWithinDollarLimit(quote2, declaredLimit) {
27263
+ function upfrontQuoteWithinDollarLimit(quote2, declaredLimit) {
27241
27264
  if (!declaredLimit?.trim().startsWith("$")) return void 0;
27242
27265
  const limitMicro = dollarLimitMicro(declaredLimit);
27243
- const amountMicro = quote2.upfront.amount_micro;
27244
- if (limitMicro === void 0 || quote2.upfront.currency !== "usd" || amountMicro === void 0 || !Number.isSafeInteger(amountMicro) || amountMicro <= 0) {
27245
- return false;
27266
+ const amountMicro = quote2.upfront?.amount_micro;
27267
+ if (limitMicro === void 0 || quote2.upfront?.currency !== "usd" || amountMicro === void 0 || !Number.isSafeInteger(amountMicro) || amountMicro <= 0) {
27268
+ return void 0;
27246
27269
  }
27247
27270
  return BigInt(amountMicro) <= limitMicro;
27248
27271
  }
@@ -34206,10 +34229,10 @@ var NON_FUNGIBLE_MINT_NOTE = "Balances are per-mint: each mint is a separate cus
34206
34229
  async function walletFund(amount, opts) {
34207
34230
  const rail = (opts.rail ?? "cashu").toLowerCase();
34208
34231
  if (rail === "tempo" || rail === "x402") {
34209
- if (opts.mint !== void 0 || opts.timeout !== void 0 || opts.sats || opts.testSkipLightning || opts.float === false) {
34232
+ if (opts.mint !== void 0 || opts.timeout !== void 0 || opts.sats || opts.testSkipLightning || opts.float === false || opts.wait === false) {
34210
34233
  throw new DvmError(
34211
34234
  "invalid_flags_for_rail",
34212
- "--mint, --timeout, --sats, --test-skip-lightning, and --no-float only apply to --rail cashu.",
34235
+ "--mint, --timeout, --sats, --test-skip-lightning, --no-float, and --no-wait only apply to --rail cashu.",
34213
34236
  `Drop these flags when running \`dvm wallet fund --rail ${rail}\`.`
34214
34237
  );
34215
34238
  }
@@ -34224,6 +34247,21 @@ async function walletFund(amount, opts) {
34224
34247
  "Supported rails: cashu (default), tempo, x402."
34225
34248
  );
34226
34249
  }
34250
+ if (opts.wait === false && opts.testSkipLightning) {
34251
+ throw new DvmError(
34252
+ "invalid_fund_options",
34253
+ "--no-wait cannot be combined with --test-skip-lightning: there is no human-paid invoice to hand off.",
34254
+ "Drop --no-wait to wait for the test mint to settle."
34255
+ );
34256
+ }
34257
+ const float = opts.float === false || opts.testSkipLightning ? null : loadFloat();
34258
+ if (opts.wait === false && float) {
34259
+ throw new DvmError(
34260
+ "invalid_fund_options",
34261
+ "--no-wait cannot be used while the connected Lightning float pays the invoice.",
34262
+ "Add --no-float to hand the invoice to a human, or drop --no-wait for autonomous funding."
34263
+ );
34264
+ }
34227
34265
  await loadConfiguredMints();
34228
34266
  const wallet = loadAgentWallet();
34229
34267
  if (!wallet) {
@@ -34242,7 +34280,6 @@ async function walletFund(amount, opts) {
34242
34280
  const amountPhrase = describeAmount(amt);
34243
34281
  const timeoutMs = parseTimeout2(opts.timeout);
34244
34282
  const human = opts.human ?? false;
34245
- const float = opts.float === false || opts.testSkipLightning ? null : loadFloat();
34246
34283
  const btcRate = float ? await assertFloatBudget(sats * 1e3) : null;
34247
34284
  let fundedQuoteId;
34248
34285
  const selection = await resolveFundMint({
@@ -34297,6 +34334,68 @@ async function walletFund(amount, opts) {
34297
34334
  info(`Paying from your Lightning wallet${float.alias ? ` (${float.alias})` : ""}\u2026`);
34298
34335
  }
34299
34336
  }
34337
+ const onInvoice = async (invoice, quote2) => {
34338
+ const expiresAt = quote2.expiry !== null ? new Date(quote2.expiry * 1e3).toISOString() : null;
34339
+ const previousUnpaid = sweep.still_pending.map((entry) => ({
34340
+ quote_id: entry.quote_id,
34341
+ mint: entry.mint,
34342
+ amount_sats: entry.amount_sats
34343
+ }));
34344
+ const warning = opts.wait === false && previousUnpaid.length > 0 ? `An unpaid quote already exists: ${previousUnpaid.map((entry) => `${entry.quote_id} at ${entry.mint} (${entry.amount_sats} sats)`).join(", ")}. This is a new invoice; avoid asking a human to pay both for the same top-up.` : void 0;
34345
+ if (human) {
34346
+ if (warning) info(`Warning: ${warning}`);
34347
+ info("");
34348
+ info("Pay this Lightning invoice from any Lightning wallet:");
34349
+ info("");
34350
+ info(invoice);
34351
+ info("");
34352
+ const ascii = await renderQrTerminal(invoice.toUpperCase());
34353
+ info(ascii);
34354
+ if (opts.qrImage !== void 0) {
34355
+ await writeInvoicePng(invoice, opts.qrImage);
34356
+ info(`QR PNG written to ${opts.qrImage}`);
34357
+ }
34358
+ if (opts.wait === false) {
34359
+ info(`Quote ID: ${quote2.quote}`);
34360
+ if (expiresAt) info(`Invoice expires: ${expiresAt}`);
34361
+ info("After payment, run `dvm wallet show` to collect the sats and check the new balance.");
34362
+ } else {
34363
+ info(
34364
+ "Polling for payment every 2s; press Ctrl-C to bail (the quote will be recoverable on next run)."
34365
+ );
34366
+ }
34367
+ } else {
34368
+ const qrImagePath = opts.qrImage ?? defaultQrImagePath();
34369
+ await writeInvoicePng(invoice, qrImagePath);
34370
+ json({
34371
+ status: "awaiting_payment",
34372
+ mint: mintUrl,
34373
+ mint_selection: mintSelection,
34374
+ amount_sats: sats,
34375
+ ...amountSourceFields(amt),
34376
+ invoice,
34377
+ quote_id: quote2.quote,
34378
+ next_step: "dvm wallet show",
34379
+ qr_image_path: qrImagePath,
34380
+ relay: { copy_text: invoice, standalone: true },
34381
+ expires_at: expiresAt,
34382
+ lock_pubkey: wallet.lock_pubkey,
34383
+ display: `Pay ${sats} sats to the Lightning invoice to fund ${amountPhrase} into the agent wallet at ${mintUrl} (${selectionPhrase}). Scannable QR at ${qrImagePath}.`,
34384
+ ...opts.wait === false ? {
34385
+ existing_unpaid_quotes: previousUnpaid,
34386
+ ...warning ? { warning } : {},
34387
+ sweep: summarizeSweep(sweep),
34388
+ melt_sweep: summarizeMeltSweep(meltSweep)
34389
+ } : {},
34390
+ hint: opts.wait === false ? "Forward the QR PNG (or raw invoice) to a human. After payment, run `dvm wallet show` to collect the sats and check the new balance. Funding is still pending." : "Forward the QR PNG (or raw invoice) to a human; the CLI will mint P2PK-locked Cashu proofs into ~/.dvm/wallet.json once paid."
34391
+ });
34392
+ }
34393
+ };
34394
+ if (opts.wait === false) {
34395
+ const { quote: quote2 } = await createPendingMintQuote(sats, { mintUrl });
34396
+ await onInvoice(quote2.request, quote2);
34397
+ return;
34398
+ }
34300
34399
  const result = await fundWithRecoverableWait(sats, {
34301
34400
  mintUrl,
34302
34401
  timeoutMs,
@@ -34355,42 +34454,7 @@ async function walletFund(amount, opts) {
34355
34454
  });
34356
34455
  }
34357
34456
  },
34358
- onInvoice: async (invoice, quote2) => {
34359
- const expiresAt = quote2.expiry !== null ? new Date(quote2.expiry * 1e3).toISOString() : null;
34360
- if (human) {
34361
- info("");
34362
- info("Pay this Lightning invoice from any Lightning wallet:");
34363
- info("");
34364
- info(invoice);
34365
- info("");
34366
- const ascii = await renderQrTerminal(invoice.toUpperCase());
34367
- info(ascii);
34368
- if (opts.qrImage !== void 0) {
34369
- await writeInvoicePng(invoice, opts.qrImage);
34370
- info(`QR PNG written to ${opts.qrImage}`);
34371
- }
34372
- info(
34373
- "Polling for payment every 2s; press Ctrl-C to bail (the quote will be recoverable on next run)."
34374
- );
34375
- } else {
34376
- const qrImagePath = opts.qrImage ?? defaultQrImagePath();
34377
- await writeInvoicePng(invoice, qrImagePath);
34378
- json({
34379
- status: "awaiting_payment",
34380
- mint: mintUrl,
34381
- mint_selection: mintSelection,
34382
- amount_sats: sats,
34383
- ...amountSourceFields(amt),
34384
- invoice,
34385
- qr_image_path: qrImagePath,
34386
- relay: { copy_text: invoice, standalone: true },
34387
- expires_at: expiresAt,
34388
- lock_pubkey: wallet.lock_pubkey,
34389
- display: `Pay ${sats} sats to the Lightning invoice to fund ${amountPhrase} into the agent wallet at ${mintUrl} (${selectionPhrase}). Scannable QR at ${qrImagePath}.`,
34390
- hint: "Forward the QR PNG (or raw invoice) to a human; the CLI will mint P2PK-locked Cashu proofs into ~/.dvm/wallet.json once paid."
34391
- });
34392
- }
34393
- }
34457
+ onInvoice
34394
34458
  });
34395
34459
  const totalProofSats = result.proofs.reduce((sum, p) => sum + p.amount, 0);
34396
34460
  if (human) {
@@ -34510,6 +34574,9 @@ async function walletShow(opts) {
34510
34574
  const recovered = sweep.recovered_proofs.reduce((sum, p) => sum + p.amount, 0);
34511
34575
  info(`Recovered ${recovered} sats from ${sweep.recovered_proofs.length} pending mint(s).`);
34512
34576
  }
34577
+ for (const collected of summarizeSweep(sweep).collected) {
34578
+ info(`${collected.display} Added ${collected.sats_collected} sats at ${collected.mint}.`);
34579
+ }
34513
34580
  for (const expired of expiredMints) {
34514
34581
  info(
34515
34582
  `Unpaid mint quote expired: ${expired.amount_sats} sats at ${expired.mint} (quote ID ${expired.quote_id}) \u2014 local recovery entry removed.`
@@ -34987,7 +35054,7 @@ function formatFeePpk(fee) {
34987
35054
  function formatPending(p, unchecked) {
34988
35055
  const row = `${p.amount_sats} sats at ${p.mint} (quote ${p.quote_id}, requested ${p.requested_at})`;
34989
35056
  return unchecked ? `${row}
34990
- \u21B3 ${uncheckedPendingNote(unchecked)}` : `${row} \u2014 awaiting payment`;
35057
+ \u21B3 ${uncheckedPendingNote(unchecked)}` : `${row} \u2014 not paid yet; awaiting payment`;
34991
35058
  }
34992
35059
  function reportUncheckedMints(unchecked) {
34993
35060
  for (const entry of unchecked) {
@@ -35034,6 +35101,20 @@ function summarizeMeltSweep(sweep) {
35034
35101
  }
35035
35102
  function summarizeSweep(sweep) {
35036
35103
  return {
35104
+ pending: sweep.still_pending.map((entry) => ({
35105
+ quote_id: entry.quote_id,
35106
+ mint: entry.mint,
35107
+ amount_sats: entry.amount_sats,
35108
+ display: `Mint quote ${entry.quote_id} is not paid yet.`
35109
+ })),
35110
+ collected: sweep.outcomes.flatMap(
35111
+ (outcome) => outcome.kind === "minted" || outcome.kind === "restored" ? [{
35112
+ quote_id: outcome.entry.quote_id,
35113
+ mint: outcome.entry.mint,
35114
+ sats_collected: outcome.proofs.reduce((sum, proof) => sum + proof.amount, 0),
35115
+ display: `Mint quote ${outcome.entry.quote_id} was paid and collected.`
35116
+ }] : []
35117
+ ),
35037
35118
  recovered_count: sweep.recovered_proofs.length,
35038
35119
  recovered_sats: sweep.recovered_proofs.reduce((s, p) => s + p.amount, 0),
35039
35120
  // Additive to `dropped`, which remains the compatibility field for callers
@@ -39936,6 +40017,9 @@ Docs:
39936
40017
  "--sats",
39937
40018
  "Treat numeric input as sats (Cashu only; default: fiat if a currency symbol/code is present \u2014 $5, \xA35, 5eur \u2014 else sats)"
39938
40019
  ).option("--mint <url>", "Cashu mint URL (default: configured mint, or Coinos)").option("--timeout <sec>", "Override DVM_FUND_TIMEOUT_SEC (default 600s)").option(
40020
+ "--no-wait",
40021
+ "Print a human-paid Lightning invoice and exit; collect after payment with 'dvm wallet show'. Cashu only; use --no-float if a float is connected."
40022
+ ).option(
39939
40023
  "--test-skip-lightning",
39940
40024
  "Skip Lightning \u2014 for test mints that auto-pay invoices (FakeWallet). Cashu rail only."
39941
40025
  ).option(
@@ -469,7 +469,7 @@ import {
469
469
  x402SettledShare,
470
470
  x402VoucherPendingState,
471
471
  x402WalletFromConfig
472
- } from "./chunk-YQJRKWNT.js";
472
+ } from "./chunk-U2PODYIS.js";
473
473
  import "./chunk-JBU7RKQ3.js";
474
474
  import "./chunk-KDNFUDOG.js";
475
475
  import "./chunk-IUTVV6N5.js";
@@ -531,13 +531,13 @@ import {
531
531
  x402NetworkListForCopy,
532
532
  x402NetworkToCaip2,
533
533
  x402SupportedNetworksHint
534
- } from "./chunk-57PXJ56K.js";
534
+ } from "./chunk-DGA5EFKU.js";
535
535
  import {
536
536
  RevenueReporter
537
- } from "./chunk-HXTASGHL.js";
537
+ } from "./chunk-A2B7QDMS.js";
538
538
  import {
539
539
  PayoutReporter
540
- } from "./chunk-D5CGDS3V.js";
540
+ } from "./chunk-IK7RI645.js";
541
541
  import "./chunk-R2DSAZBO.js";
542
542
  import {
543
543
  DIAGNOSTIC_CATALOGUE_VERSION,
@@ -548,7 +548,7 @@ import {
548
548
  projectDiagnosticFields,
549
549
  projectEventName,
550
550
  projectSpanRow
551
- } from "./chunk-UCCT5IKU.js";
551
+ } from "./chunk-UFMAHF6T.js";
552
552
  import "./chunk-EVQERRCP.js";
553
553
  import "./chunk-RA24J4QM.js";
554
554
  import "./chunk-B4WHUMZM.js";
@@ -3,8 +3,8 @@ import { createRequire as __dvmCreateRequire } from "node:module";
3
3
  const require = __dvmCreateRequire(import.meta.url);
4
4
  import {
5
5
  assertX402WalletIdle
6
- } from "./chunk-I7ZBID4L.js";
7
- import "./chunk-YQJRKWNT.js";
6
+ } from "./chunk-2TNH4ME5.js";
7
+ import "./chunk-U2PODYIS.js";
8
8
  import "./chunk-JBU7RKQ3.js";
9
9
  import "./chunk-KDNFUDOG.js";
10
10
  import "./chunk-IUTVV6N5.js";
@@ -13,11 +13,11 @@ import "./chunk-6LP4EGKA.js";
13
13
  import "./chunk-N3UJT2NJ.js";
14
14
  import "./chunk-SYFKO6BA.js";
15
15
  import "./chunk-PUOXBKY2.js";
16
- import "./chunk-57PXJ56K.js";
17
- import "./chunk-HXTASGHL.js";
18
- import "./chunk-D5CGDS3V.js";
16
+ import "./chunk-DGA5EFKU.js";
17
+ import "./chunk-A2B7QDMS.js";
18
+ import "./chunk-IK7RI645.js";
19
19
  import "./chunk-R2DSAZBO.js";
20
- import "./chunk-UCCT5IKU.js";
20
+ import "./chunk-UFMAHF6T.js";
21
21
  import "./chunk-EVQERRCP.js";
22
22
  import "./chunk-RA24J4QM.js";
23
23
  import "./chunk-B4WHUMZM.js";
@@ -7,9 +7,9 @@ import {
7
7
  PayoutReporter,
8
8
  PostgresX402BatchStore,
9
9
  x402EarnedCeiling
10
- } from "./chunk-D5CGDS3V.js";
10
+ } from "./chunk-IK7RI645.js";
11
11
  import "./chunk-R2DSAZBO.js";
12
- import "./chunk-UCCT5IKU.js";
12
+ import "./chunk-UFMAHF6T.js";
13
13
  import "./chunk-IYHTITNZ.js";
14
14
  export {
15
15
  MemoryX402BatchStore,
@@ -13,22 +13,22 @@ import {
13
13
  recordFloatSpend,
14
14
  resolveFundMint,
15
15
  sweepPendingMints
16
- } from "./chunk-DZHEYRS2.js";
17
- import "./chunk-HJ2JYBTT.js";
16
+ } from "./chunk-LDYMUQZE.js";
17
+ import "./chunk-WSLZBJ52.js";
18
18
  import {
19
19
  info,
20
20
  tryResolveBtcUsdRate
21
- } from "./chunk-F45ETHDP.js";
22
- import "./chunk-UWVMG4VG.js";
21
+ } from "./chunk-NSA2RJ2T.js";
22
+ import "./chunk-H6WQ4S6K.js";
23
23
  import {
24
24
  loadConfig
25
- } from "./chunk-2MCZ4QOK.js";
25
+ } from "./chunk-WRIXUSMR.js";
26
26
  import {
27
27
  effectiveFundingMint,
28
28
  effectiveMints,
29
29
  formatUsd,
30
30
  loadAgentWallet
31
- } from "./chunk-YQJRKWNT.js";
31
+ } from "./chunk-U2PODYIS.js";
32
32
  import "./chunk-JBU7RKQ3.js";
33
33
  import "./chunk-KDNFUDOG.js";
34
34
  import "./chunk-IUTVV6N5.js";
@@ -40,11 +40,11 @@ import "./chunk-PUOXBKY2.js";
40
40
  import {
41
41
  microToSats,
42
42
  msatsToMicro
43
- } from "./chunk-57PXJ56K.js";
44
- import "./chunk-HXTASGHL.js";
45
- import "./chunk-D5CGDS3V.js";
43
+ } from "./chunk-DGA5EFKU.js";
44
+ import "./chunk-A2B7QDMS.js";
45
+ import "./chunk-IK7RI645.js";
46
46
  import "./chunk-R2DSAZBO.js";
47
- import "./chunk-UCCT5IKU.js";
47
+ import "./chunk-UFMAHF6T.js";
48
48
  import "./chunk-EVQERRCP.js";
49
49
  import "./chunk-RA24J4QM.js";
50
50
  import "./chunk-B4WHUMZM.js";
@@ -3,9 +3,9 @@ import { createRequire as __dvmCreateRequire } from "node:module";
3
3
  const require = __dvmCreateRequire(import.meta.url);
4
4
  import {
5
5
  RevenueReporter
6
- } from "./chunk-HXTASGHL.js";
6
+ } from "./chunk-A2B7QDMS.js";
7
7
  import "./chunk-R2DSAZBO.js";
8
- import "./chunk-UCCT5IKU.js";
8
+ import "./chunk-UFMAHF6T.js";
9
9
  import "./chunk-IYHTITNZ.js";
10
10
  export {
11
11
  RevenueReporter
@@ -3,10 +3,10 @@ import { createRequire as __dvmCreateRequire } from "node:module";
3
3
  const require = __dvmCreateRequire(import.meta.url);
4
4
  import {
5
5
  assertTempoWalletIdle
6
- } from "./chunk-EZL4IVCU.js";
7
- import "./chunk-HJ2JYBTT.js";
8
- import "./chunk-2MCZ4QOK.js";
9
- import "./chunk-YQJRKWNT.js";
6
+ } from "./chunk-CEBEPXQ7.js";
7
+ import "./chunk-WSLZBJ52.js";
8
+ import "./chunk-WRIXUSMR.js";
9
+ import "./chunk-U2PODYIS.js";
10
10
  import "./chunk-JBU7RKQ3.js";
11
11
  import "./chunk-KDNFUDOG.js";
12
12
  import "./chunk-IUTVV6N5.js";
@@ -15,11 +15,11 @@ import "./chunk-6LP4EGKA.js";
15
15
  import "./chunk-N3UJT2NJ.js";
16
16
  import "./chunk-SYFKO6BA.js";
17
17
  import "./chunk-PUOXBKY2.js";
18
- import "./chunk-57PXJ56K.js";
19
- import "./chunk-HXTASGHL.js";
20
- import "./chunk-D5CGDS3V.js";
18
+ import "./chunk-DGA5EFKU.js";
19
+ import "./chunk-A2B7QDMS.js";
20
+ import "./chunk-IK7RI645.js";
21
21
  import "./chunk-R2DSAZBO.js";
22
- import "./chunk-UCCT5IKU.js";
22
+ import "./chunk-UFMAHF6T.js";
23
23
  import "./chunk-EVQERRCP.js";
24
24
  import "./chunk-RA24J4QM.js";
25
25
  import "./chunk-B4WHUMZM.js";
@@ -6,9 +6,9 @@ import {
6
6
  generateTempoKey,
7
7
  tempoBalanceCheckHint,
8
8
  tempoWrongAssetHint
9
- } from "./chunk-HJ2JYBTT.js";
10
- import "./chunk-2MCZ4QOK.js";
11
- import "./chunk-YQJRKWNT.js";
9
+ } from "./chunk-WSLZBJ52.js";
10
+ import "./chunk-WRIXUSMR.js";
11
+ import "./chunk-U2PODYIS.js";
12
12
  import "./chunk-JBU7RKQ3.js";
13
13
  import "./chunk-KDNFUDOG.js";
14
14
  import "./chunk-IUTVV6N5.js";
@@ -17,11 +17,11 @@ import "./chunk-6LP4EGKA.js";
17
17
  import "./chunk-N3UJT2NJ.js";
18
18
  import "./chunk-SYFKO6BA.js";
19
19
  import "./chunk-PUOXBKY2.js";
20
- import "./chunk-57PXJ56K.js";
21
- import "./chunk-HXTASGHL.js";
22
- import "./chunk-D5CGDS3V.js";
20
+ import "./chunk-DGA5EFKU.js";
21
+ import "./chunk-A2B7QDMS.js";
22
+ import "./chunk-IK7RI645.js";
23
23
  import "./chunk-R2DSAZBO.js";
24
- import "./chunk-UCCT5IKU.js";
24
+ import "./chunk-UFMAHF6T.js";
25
25
  import "./chunk-EVQERRCP.js";
26
26
  import "./chunk-RA24J4QM.js";
27
27
  import "./chunk-B4WHUMZM.js";