@dvmkit/dvm-cli 0.18.0 → 0.19.1
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.
- package/README.md +8 -0
- package/dist/{chunk-ESQ6DCS3.js → chunk-3NXAIRFF.js} +2 -2
- package/dist/{chunk-RYFCHR6Z.js → chunk-7HJ5ZR3D.js} +9 -4
- package/dist/{chunk-REIUNZQX.js → chunk-B5KW2TPR.js} +2 -2
- package/dist/{chunk-DGA5EFKU.js → chunk-DF2OWCRY.js} +6 -6
- package/dist/{chunk-OEWENVJ7.js → chunk-MM646MFM.js} +4 -4
- package/dist/{chunk-VSOIBYBF.js → chunk-NCX4JVLU.js} +345 -49
- package/dist/{chunk-VLD7OKSH.js → chunk-NKD4NEUF.js} +3 -3
- package/dist/{chunk-ZGBCVQF2.js → chunk-OCVRCWBL.js} +3 -3
- package/dist/{chunk-IK7RI645.js → chunk-W4ADV3HW.js} +449 -5
- package/dist/{chunk-UFMAHF6T.js → chunk-WCX4PNEF.js} +127 -40
- package/dist/{chunk-THTPKBZX.js → chunk-X6BETQ7V.js} +1252 -737
- package/dist/{chunk-A2B7QDMS.js → chunk-ZZCYSYXR.js} +2 -2
- package/dist/{client-PVRLAMI3.js → client-PY4T2DOA.js} +6 -6
- package/dist/dvm.js +396 -74
- package/dist/{internal-L362ZUWL.js → internal-WAQ3LZN4.js} +10 -8
- package/dist/{lifecycle-BH4OA5I3.js → lifecycle-NOK3MKL4.js} +6 -6
- package/dist/{payout-reporter-F5LFV5W4-EJ7E5ALO.js → payout-reporter-5PH53T44-7IA4NGIN.js} +2 -2
- package/dist/{pocket-refill-6UL6CHD5.js → pocket-refill-U4VK5WGO.js} +10 -10
- package/dist/{revenue-reporter-2U55YH2I-EUB6PBRN.js → revenue-reporter-4XV3OO5O-RYHS3M34.js} +2 -2
- package/dist/{tempo-lifecycle-WGTX6MJR.js → tempo-lifecycle-QGJ4JEHN.js} +8 -8
- package/dist/{tempo-wallet-OTB2YSWE.js → tempo-wallet-GDDZZP5S.js} +7 -7
- package/dist/{wallet-73EJBUSO.js → wallet-2M3H75UP.js} +7 -7
- package/dist/{x402-G6C4N2BN-TAJEBQGU.js → x402-FHHB3V4V-CM6OMLHE.js} +2 -2
- package/package.json +2 -2
- package/skills/dvm/calling.md +3 -1
- package/skills/dvm/credit.md +4 -0
- package/skills/dvm/recovery.md +4 -0
- package/skills/dvm/wallets.md +3 -1
package/dist/dvm.js
CHANGED
|
@@ -5,12 +5,13 @@ import {
|
|
|
5
5
|
assertTempoWalletIdle,
|
|
6
6
|
findSigningIdentityByPubkey,
|
|
7
7
|
resolveSigningIdentity
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OCVRCWBL.js";
|
|
9
9
|
import {
|
|
10
10
|
CARD_MIN_MICRO,
|
|
11
11
|
DEFAULT_CREDIT_POSTURE,
|
|
12
12
|
DEFAULT_RESERVE_LOCKTIME_SECONDS,
|
|
13
13
|
JOB_READ_TIMEOUT_MS,
|
|
14
|
+
MINT_QUOTE_EXPIRY_GRACE_MS,
|
|
14
15
|
NWC_FUNDING_FLOAT_ROLE,
|
|
15
16
|
SUBMISSION_EVIDENCE_DIR,
|
|
16
17
|
abandonPendingSubmission,
|
|
@@ -113,6 +114,7 @@ import {
|
|
|
113
114
|
maxSeq,
|
|
114
115
|
meltInFlightTimeoutSeconds,
|
|
115
116
|
midJobSpendLabel,
|
|
117
|
+
mintQuoteRefusal,
|
|
116
118
|
mutateCreditPayment,
|
|
117
119
|
needsTopup,
|
|
118
120
|
nextStepHint,
|
|
@@ -212,14 +214,15 @@ import {
|
|
|
212
214
|
withAcceptedUnresolved,
|
|
213
215
|
withIdentityRecovery,
|
|
214
216
|
withJobTokenRedaction,
|
|
215
|
-
withRequestResultRecovery
|
|
216
|
-
|
|
217
|
+
withRequestResultRecovery,
|
|
218
|
+
withoutPendingMint
|
|
219
|
+
} from "./chunk-NCX4JVLU.js";
|
|
217
220
|
import {
|
|
218
221
|
connectedTempoAccount,
|
|
219
222
|
generateTempoKey,
|
|
220
223
|
tempoBalanceCheckHint,
|
|
221
224
|
tempoWrongAssetHint
|
|
222
|
-
} from "./chunk-
|
|
225
|
+
} from "./chunk-MM646MFM.js";
|
|
223
226
|
import {
|
|
224
227
|
assertSupportedX402Network,
|
|
225
228
|
connectedX402Payer,
|
|
@@ -228,7 +231,7 @@ import {
|
|
|
228
231
|
repinX402WalletNetwork,
|
|
229
232
|
saveX402Wallet,
|
|
230
233
|
x402NetworkLabel
|
|
231
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-NKD4NEUF.js";
|
|
232
235
|
import {
|
|
233
236
|
CREDIT_POSTURES,
|
|
234
237
|
FEEDBACK_POSTURES,
|
|
@@ -245,7 +248,7 @@ import {
|
|
|
245
248
|
retireConfigBackup,
|
|
246
249
|
rollbackConfig,
|
|
247
250
|
updateConfig
|
|
248
|
-
} from "./chunk-
|
|
251
|
+
} from "./chunk-3NXAIRFF.js";
|
|
249
252
|
import {
|
|
250
253
|
addOutputWarnings,
|
|
251
254
|
assertValidBudget,
|
|
@@ -266,11 +269,12 @@ import {
|
|
|
266
269
|
staleRateNotice,
|
|
267
270
|
tryResolveBtcUsdRate,
|
|
268
271
|
tryX402Payment,
|
|
272
|
+
withOutputWarningContext,
|
|
269
273
|
withOutputWarnings
|
|
270
|
-
} from "./chunk-
|
|
274
|
+
} from "./chunk-7HJ5ZR3D.js";
|
|
271
275
|
import {
|
|
272
276
|
assertX402WalletIdle
|
|
273
|
-
} from "./chunk-
|
|
277
|
+
} from "./chunk-B5KW2TPR.js";
|
|
274
278
|
import {
|
|
275
279
|
A,
|
|
276
280
|
AGENT_MNEMONIC_FILE,
|
|
@@ -510,7 +514,7 @@ import {
|
|
|
510
514
|
x402PendingUnsettled,
|
|
511
515
|
x402RequiredFromError,
|
|
512
516
|
x402ReservationRelease
|
|
513
|
-
} from "./chunk-
|
|
517
|
+
} from "./chunk-X6BETQ7V.js";
|
|
514
518
|
import "./chunk-JBU7RKQ3.js";
|
|
515
519
|
import "./chunk-KDNFUDOG.js";
|
|
516
520
|
import "./chunk-IUTVV6N5.js";
|
|
@@ -796,11 +800,11 @@ import {
|
|
|
796
800
|
usdToMsats,
|
|
797
801
|
usdcToMsats,
|
|
798
802
|
x402NetworkByCaip2
|
|
799
|
-
} from "./chunk-
|
|
800
|
-
import "./chunk-
|
|
801
|
-
import "./chunk-
|
|
803
|
+
} from "./chunk-DF2OWCRY.js";
|
|
804
|
+
import "./chunk-ZZCYSYXR.js";
|
|
805
|
+
import "./chunk-W4ADV3HW.js";
|
|
802
806
|
import "./chunk-R2DSAZBO.js";
|
|
803
|
-
import "./chunk-
|
|
807
|
+
import "./chunk-WCX4PNEF.js";
|
|
804
808
|
import {
|
|
805
809
|
privateKeyToAccount
|
|
806
810
|
} from "./chunk-EVQERRCP.js";
|
|
@@ -11881,8 +11885,8 @@ async function handleLockedPaymentRequest(jobId, request2, policy, transport, pr
|
|
|
11881
11885
|
}
|
|
11882
11886
|
}
|
|
11883
11887
|
if ((opts?.rail === void 0 || opts.rail === "x402") && request2.x402) {
|
|
11884
|
-
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-
|
|
11885
|
-
const { tryX402Payment: tryX402Payment2 } = await import("./client-
|
|
11888
|
+
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-2M3H75UP.js");
|
|
11889
|
+
const { tryX402Payment: tryX402Payment2 } = await import("./client-PY4T2DOA.js");
|
|
11886
11890
|
const wallet = loadX402Wallet2();
|
|
11887
11891
|
if (wallet) {
|
|
11888
11892
|
let proof;
|
|
@@ -14028,10 +14032,12 @@ function withCreditErrorContext(err, body) {
|
|
|
14028
14032
|
}
|
|
14029
14033
|
const menu = parseCreditMenu(body.credit);
|
|
14030
14034
|
if (menu) extra.credit = menu;
|
|
14035
|
+
if (Number.isSafeInteger(body.stripe_status)) extra.stripe_status = body.stripe_status;
|
|
14031
14036
|
const lightning = parseLightningOffer(body.lightning);
|
|
14032
14037
|
if (lightning) extra.lightning = lightning;
|
|
14033
14038
|
for (const key of [
|
|
14034
14039
|
"reason",
|
|
14040
|
+
"cause",
|
|
14035
14041
|
"stripe_error_code",
|
|
14036
14042
|
"decline_code",
|
|
14037
14043
|
"blocking_drain_id",
|
|
@@ -14709,7 +14715,7 @@ async function settleCreditAfterJob(args) {
|
|
|
14709
14715
|
}
|
|
14710
14716
|
}
|
|
14711
14717
|
if (args.allowTopup !== false) {
|
|
14712
|
-
const refill = args.refillPocket ?? (await import("./pocket-refill-
|
|
14718
|
+
const refill = args.refillPocket ?? (await import("./pocket-refill-U4VK5WGO.js")).refillPocketIfLow;
|
|
14713
14719
|
await refill({ human: args.human }).catch(() => void 0);
|
|
14714
14720
|
}
|
|
14715
14721
|
}
|
|
@@ -15490,14 +15496,14 @@ async function confirmRollback(stored, preview, opts) {
|
|
|
15490
15496
|
async function withStrandingChecked(removing, commit) {
|
|
15491
15497
|
const leaving = new Set(removing.map((target) => target.split(".")[0]));
|
|
15492
15498
|
if (leaving.has("tempo")) {
|
|
15493
|
-
const { assertTempoWalletIdle: assertTempoWalletIdle2 } = await import("./tempo-lifecycle-
|
|
15499
|
+
const { assertTempoWalletIdle: assertTempoWalletIdle2 } = await import("./tempo-lifecycle-QGJ4JEHN.js");
|
|
15494
15500
|
await assertTempoWalletIdle2("disconnect");
|
|
15495
15501
|
}
|
|
15496
15502
|
if (!leaving.has("x402")) return commit();
|
|
15497
|
-
const { withX402ChannelLock: withX402ChannelLock2, listPendingX402Fundings: listPendingX402Fundings2, x402PendingUnsettled: x402PendingUnsettled2 } = await import("./internal-
|
|
15498
|
-
const { assertX402WalletIdle: assertX402WalletIdle2 } = await import("./lifecycle-
|
|
15499
|
-
const { ensureAddress: ensureAddress2 } = await import("./internal-
|
|
15500
|
-
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-
|
|
15503
|
+
const { withX402ChannelLock: withX402ChannelLock2, listPendingX402Fundings: listPendingX402Fundings2, x402PendingUnsettled: x402PendingUnsettled2 } = await import("./internal-WAQ3LZN4.js");
|
|
15504
|
+
const { assertX402WalletIdle: assertX402WalletIdle2 } = await import("./lifecycle-NOK3MKL4.js");
|
|
15505
|
+
const { ensureAddress: ensureAddress2 } = await import("./internal-WAQ3LZN4.js");
|
|
15506
|
+
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-2M3H75UP.js");
|
|
15501
15507
|
return withX402ChannelLock2(async () => {
|
|
15502
15508
|
const unsettled = listPendingX402Fundings2().filter((entry) => x402PendingUnsettled2(entry));
|
|
15503
15509
|
if (unsettled.length > 0) {
|
|
@@ -20211,6 +20217,7 @@ function capitalise(s) {
|
|
|
20211
20217
|
|
|
20212
20218
|
// src/lib/credit/funding.ts
|
|
20213
20219
|
async function runCreditFund(dvm, opts) {
|
|
20220
|
+
const invocationStartedAt = Date.now();
|
|
20214
20221
|
const endpoint = resolveCreditEndpoint(dvm);
|
|
20215
20222
|
const config2 = loadConfig();
|
|
20216
20223
|
const signer = resolveSigningIdentity({ as: opts.as, config: config2 });
|
|
@@ -20309,7 +20316,7 @@ async function runCreditFund(dvm, opts) {
|
|
|
20309
20316
|
}
|
|
20310
20317
|
const transport = createDvmTransport();
|
|
20311
20318
|
try {
|
|
20312
|
-
const menu = stored?.menu ?? (pending4 ?? signedPending ? void 0 : await discoverCreditMenu(transport, endpoint, signer));
|
|
20319
|
+
const menu = (stored?.menu && rail === "stripe" && cardSpt === void 0 && !pending4 && !signedPending ? await discoverCreditMenu(transport, endpoint, signer) : void 0) ?? stored?.menu ?? (pending4 ?? signedPending ? void 0 : await discoverCreditMenu(transport, endpoint, signer));
|
|
20313
20320
|
let sizing;
|
|
20314
20321
|
if (targetJobs !== void 0 && !pending4 && !signedPending) {
|
|
20315
20322
|
sizing = await sizeForTargetJobs({ endpoint, targetJobs, stored, menu, providerInfo });
|
|
@@ -20333,7 +20340,7 @@ async function runCreditFund(dvm, opts) {
|
|
|
20333
20340
|
transport,
|
|
20334
20341
|
ref: { endpoint },
|
|
20335
20342
|
signing: signer,
|
|
20336
|
-
creditId: pending4?.creditId ?? opts.creditId ?? (canRefillStoredCredit(stored) ? stored.creditId :
|
|
20343
|
+
creditId: pending4?.creditId ?? opts.creditId ?? signedPending?.creditId ?? (canRefillStoredCredit(stored) ? stored.creditId : randomUUID3()),
|
|
20337
20344
|
amountMicro: fundMicro,
|
|
20338
20345
|
human: opts.human,
|
|
20339
20346
|
providerInfo,
|
|
@@ -20346,7 +20353,15 @@ async function runCreditFund(dvm, opts) {
|
|
|
20346
20353
|
...maxCashuPrincipalSats !== void 0 ? { maxCashuPrincipalSats } : {},
|
|
20347
20354
|
...maxCashuFeeSats !== void 0 ? { maxCashuFeeSats } : {},
|
|
20348
20355
|
...cardSpt !== void 0 ? { cardSpt } : {},
|
|
20349
|
-
cardApprovalSteps: true
|
|
20356
|
+
cardApprovalSteps: true,
|
|
20357
|
+
cardWait: opts.wait !== false,
|
|
20358
|
+
cardCreditIdExplicit: opts.creditId !== void 0,
|
|
20359
|
+
cardInvocationStartedAt: invocationStartedAt,
|
|
20360
|
+
...signer.source.kind !== "env" ? { cardIdentity: signer.source.name } : {},
|
|
20361
|
+
cardCheckoutProgress: (handoff) => {
|
|
20362
|
+
if (opts.human) info(String(handoff.display));
|
|
20363
|
+
else json({ op: "fund", endpoint, ...handoff });
|
|
20364
|
+
}
|
|
20350
20365
|
});
|
|
20351
20366
|
if (outcome.status === "refused" || outcome.status === "unavailable") {
|
|
20352
20367
|
const err = outcome.error;
|
|
@@ -20407,6 +20422,7 @@ async function runCreditFund(dvm, opts) {
|
|
|
20407
20422
|
op: "fund",
|
|
20408
20423
|
endpoint,
|
|
20409
20424
|
status: outcome.status,
|
|
20425
|
+
...outcome.checkoutHandoff ?? {},
|
|
20410
20426
|
credit_id: outcome.creditId,
|
|
20411
20427
|
fund_id: outcome.fundId,
|
|
20412
20428
|
...resumedNote ? { resumed: resumedNote } : {},
|
|
@@ -20452,7 +20468,10 @@ async function runCreditFund(dvm, opts) {
|
|
|
20452
20468
|
}
|
|
20453
20469
|
}
|
|
20454
20470
|
function pendingSignedResume(args) {
|
|
20455
|
-
if (args.
|
|
20471
|
+
if (args.journalled) return void 0;
|
|
20472
|
+
const card = listPendingCardFundings({ endpoint: args.endpoint, callerPubkey: args.signer.pubkey }).find((entry) => !args.opts.creditId || entry.creditId === args.opts.creditId);
|
|
20473
|
+
if (card?.v === 2) return card;
|
|
20474
|
+
if (args.opts.creditId || canRefillStoredCredit(args.stored)) return void 0;
|
|
20456
20475
|
const scope = { endpoint: args.endpoint, callerPubkey: args.signer.pubkey };
|
|
20457
20476
|
return [
|
|
20458
20477
|
...listResumableX402Fundings(scope),
|
|
@@ -20712,14 +20731,15 @@ async function enforceTrustTier(args) {
|
|
|
20712
20731
|
...walletInvoiceFundingAdvice(args.amountMicro),
|
|
20713
20732
|
minimumUsd: `$${formatUsd(lightningMinimum / 1e6)}`
|
|
20714
20733
|
} : void 0;
|
|
20715
|
-
const
|
|
20734
|
+
const cardGuidance = args.menu?.stripe?.checkout ? `Pay by card: dvm credit fund ${shellQuoteArg(args.endpoint)} --rail stripe --amount ${shellQuoteArg(`$${formatUsd(args.amountMicro / 1e6)}`)}. ` : "";
|
|
20735
|
+
const walletGuidance = walletFunding ? `${cardGuidance}Lightning top-ups here start at ${walletFunding.minimumUsd}, above the ${capUsd} this caller can load at the current trust tier. ${walletFunding.text} ` : "";
|
|
20716
20736
|
throw withHeadroom(
|
|
20717
20737
|
new DvmError(
|
|
20718
20738
|
"amount_exceeds_trust_tier",
|
|
20719
20739
|
`Funding ${amountUsd} at ${args.endpoint} would exceed this DVM's ${capUsd} trust-tier cap.`,
|
|
20720
|
-
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.`,
|
|
20740
|
+
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. ${cardGuidance}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.`,
|
|
20721
20741
|
{
|
|
20722
|
-
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>'.`,
|
|
20742
|
+
display: `This agent has only earned ${capUsd} of credit at ${args.endpoint} so far, and ${amountUsd} was asked for.${heldClause} No money moved. ` + (walletGuidance || cardGuidance) + `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>'.`,
|
|
20723
20743
|
endpoint: args.endpoint,
|
|
20724
20744
|
amount_micro: args.amountMicro,
|
|
20725
20745
|
exposure_micro: exposureMicro,
|
|
@@ -22204,8 +22224,8 @@ async function probeX402(x402, timeoutMs) {
|
|
|
22204
22224
|
let network;
|
|
22205
22225
|
let address;
|
|
22206
22226
|
try {
|
|
22207
|
-
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-
|
|
22208
|
-
const { getX402Balance, ensureAddress: ensureAddress2, usdcContractByCaip2 } = await import("./internal-
|
|
22227
|
+
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-2M3H75UP.js");
|
|
22228
|
+
const { getX402Balance, ensureAddress: ensureAddress2, usdcContractByCaip2 } = await import("./internal-WAQ3LZN4.js");
|
|
22209
22229
|
const wallet = loadX402Wallet2();
|
|
22210
22230
|
if (!wallet) {
|
|
22211
22231
|
const storedKey = x402.privateKey;
|
|
@@ -22257,8 +22277,8 @@ async function probeMpp(mpp, timeoutMs) {
|
|
|
22257
22277
|
if (!mpp) return null;
|
|
22258
22278
|
if (mpp.method === "tempo") {
|
|
22259
22279
|
try {
|
|
22260
|
-
const { connectedTempoAccount: connectedTempoAccount2 } = await import("./tempo-wallet-
|
|
22261
|
-
const { getTempoUsdcBalance: getTempoUsdcBalance3, resolveTempoNetwork: resolveTempoNetwork2 } = await import("./internal-
|
|
22280
|
+
const { connectedTempoAccount: connectedTempoAccount2 } = await import("./tempo-wallet-GDDZZP5S.js");
|
|
22281
|
+
const { getTempoUsdcBalance: getTempoUsdcBalance3, resolveTempoNetwork: resolveTempoNetwork2 } = await import("./internal-WAQ3LZN4.js");
|
|
22262
22282
|
const account = await connectedTempoAccount2();
|
|
22263
22283
|
if (!account) {
|
|
22264
22284
|
return {
|
|
@@ -25656,6 +25676,61 @@ function formatBytes(bytes) {
|
|
|
25656
25676
|
return `${bytes.toLocaleString("en-US")} bytes`;
|
|
25657
25677
|
}
|
|
25658
25678
|
|
|
25679
|
+
// src/lib/unanswered-payment.ts
|
|
25680
|
+
import { isDeepStrictEqual } from "util";
|
|
25681
|
+
async function readUnansweredPaymentRequest(jobId, status2, access, transport, options = {}) {
|
|
25682
|
+
if (status2 !== "cancelled") return void 0;
|
|
25683
|
+
const job = access.endpointOverridden ? void 0 : loadJob(jobId);
|
|
25684
|
+
if (job?.callerCancelled) return void 0;
|
|
25685
|
+
const retained = job?.unansweredPaymentEvidence;
|
|
25686
|
+
const local = job ? loadMessages(jobId) : [];
|
|
25687
|
+
let history = options.messages ?? [];
|
|
25688
|
+
const hasPaymentContext = (job?.policy?.maxPayments ?? 0) > 0 || retained !== void 0 || [...local, ...history].some((message2) => message2.from === "provider" && message2.type === "payment-request");
|
|
25689
|
+
if (hasPaymentContext && !options.localOnly && !options.fullHistory) {
|
|
25690
|
+
try {
|
|
25691
|
+
history = await transport.getMessages(jobId, 0, access.ref, {
|
|
25692
|
+
jobToken: access.jobToken,
|
|
25693
|
+
timeoutMs: options.timeoutMs ?? 5e3
|
|
25694
|
+
});
|
|
25695
|
+
} catch {
|
|
25696
|
+
}
|
|
25697
|
+
}
|
|
25698
|
+
const log = [...new Map([
|
|
25699
|
+
...retained ? [retained.request, retained.cancellation] : [],
|
|
25700
|
+
...local,
|
|
25701
|
+
...history
|
|
25702
|
+
].map((message2) => [message2.seq, message2])).values()].sort((a, b) => a.seq - b.seq);
|
|
25703
|
+
const answered = answeredYieldSeqs(log);
|
|
25704
|
+
if (job) for (const seq of loadAnsweredYieldSeqs(jobId)) answered.add(seq);
|
|
25705
|
+
const evidence = unansweredPaymentEvidence(log, answered, job);
|
|
25706
|
+
if (job && !isDeepStrictEqual(retained, evidence)) updateObservedJob(jobId, { unansweredPaymentEvidence: evidence });
|
|
25707
|
+
if (!evidence) return void 0;
|
|
25708
|
+
const ask = evidence.request;
|
|
25709
|
+
const expiresAtMs = ask.content.expires_at_ms;
|
|
25710
|
+
const amount = formatPaymentAmount(ask.content.amount_msats, ask.content.fiat_amount, { anchor: false });
|
|
25711
|
+
return providerFields({
|
|
25712
|
+
seq: ask.seq,
|
|
25713
|
+
amount_msats: ask.content.amount_msats,
|
|
25714
|
+
...ask.content.fiat_amount ? { fiat_amount: ask.content.fiat_amount } : {},
|
|
25715
|
+
...ask.content.credit ? { credit: ask.content.credit } : {},
|
|
25716
|
+
reason: asProviderText(ask.content.reason),
|
|
25717
|
+
expires_at_ms: expiresAtMs,
|
|
25718
|
+
display: `The job appears to have stopped because payment ask #${ask.seq} went unanswered by its deadline (${new Date(expiresAtMs).toISOString()}). The provider asked for ${amount}, reason: ${JSON.stringify(ask.content.reason)}. Only charges paid before this ask were taken. Cancellation timestamps have one-second precision and do not establish when useful work stopped.`
|
|
25719
|
+
}, ["seq", "amount_msats", "fiat_amount", "credit", "expires_at_ms"]);
|
|
25720
|
+
}
|
|
25721
|
+
function unansweredPaymentEvidence(log, answered, job) {
|
|
25722
|
+
const ask = log.findLast((message2) => message2.from === "provider" && message2.type === "payment-request");
|
|
25723
|
+
if (ask?.type !== "payment-request" || ask.content.amount_msats <= 0) return void 0;
|
|
25724
|
+
if (answered.has(ask.seq)) return void 0;
|
|
25725
|
+
if (job?.inFlightPaymentRequestSeqs?.includes(ask.seq) || job?.unconfirmedPaymentSubmissions?.[ask.seq] || job?.askPaymentBlocks?.[ask.seq] || job?.pendingCreditPayment?.authorization.request_seq === ask.seq) return void 0;
|
|
25726
|
+
const expiresAtMs = ask.content.expires_at_ms;
|
|
25727
|
+
if (typeof expiresAtMs !== "number" || !Number.isSafeInteger(expiresAtMs) || expiresAtMs < 0 || expiresAtMs > 864e13) return void 0;
|
|
25728
|
+
const ending = log.findLast((message2) => message2.type === "cancel" || message2.type === "complete");
|
|
25729
|
+
if (ending?.type !== "cancel" || ending.from !== "provider" || ending.seq <= ask.seq || !Number.isFinite(ending.timestamp) || ending.timestamp < Math.floor(expiresAtMs / 1e3)) return void 0;
|
|
25730
|
+
if (log.some((message2) => message2.seq > ask.seq && message2.seq < ending.seq && (message2.from === "provider" && message2.type === "working" || message2.from === "requester" && (message2.type === "decline" || message2.type === "cancel")))) return void 0;
|
|
25731
|
+
return { request: ask, cancellation: ending };
|
|
25732
|
+
}
|
|
25733
|
+
|
|
25659
25734
|
// src/lib/message-human.ts
|
|
25660
25735
|
function paymentAmount(msg) {
|
|
25661
25736
|
if (msg.from === "requester" && msg.content.credit) {
|
|
@@ -26093,9 +26168,16 @@ async function messagesWithAccess(jobId, opts, access) {
|
|
|
26093
26168
|
const resolvedAction2 = await resolveNextAction2(nextAction, msgs, providerStatus2?.status);
|
|
26094
26169
|
const currency2 = access.endpointOverridden ? await providerCurrency({ receipt: providerStatus2?.receipt, status: providerStatus2, messages: msgs, transport, ref }) : void 0;
|
|
26095
26170
|
const settlement2 = await observedSettlementFields(jobId, providerStatus2, !access.endpointOverridden, currency2);
|
|
26171
|
+
const unanswered2 = await readUnansweredPaymentRequest(jobId, providerStatus2?.status ?? (access.endpointOverridden ? void 0 : loadJob(jobId)?.status), access, transport, {
|
|
26172
|
+
messages: msgs,
|
|
26173
|
+
fullHistory: after === 0,
|
|
26174
|
+
localOnly: isTerminal || providerStatus2?.content_available === false,
|
|
26175
|
+
timeoutMs: timeout
|
|
26176
|
+
});
|
|
26096
26177
|
transport.close();
|
|
26097
26178
|
if (opts.human) {
|
|
26098
26179
|
renderSettlementHuman(settlement2);
|
|
26180
|
+
if (unanswered2) info(unanswered2.display);
|
|
26099
26181
|
info(String(content2.content_hint));
|
|
26100
26182
|
if (msgs.length === 0) {
|
|
26101
26183
|
info("No new messages.");
|
|
@@ -26111,6 +26193,7 @@ async function messagesWithAccess(jobId, opts, access) {
|
|
|
26111
26193
|
jobId,
|
|
26112
26194
|
...content2,
|
|
26113
26195
|
...settlement2,
|
|
26196
|
+
...unanswered2 ? { unanswered_payment_request: unanswered2 } : {},
|
|
26114
26197
|
messages: msgs.map(serialize),
|
|
26115
26198
|
cursor: newCursor,
|
|
26116
26199
|
next_action: resolvedAction2,
|
|
@@ -26188,9 +26271,16 @@ async function messagesWithAccess(jobId, opts, access) {
|
|
|
26188
26271
|
const observed = providerStatus ?? result.providerStatus;
|
|
26189
26272
|
const currency = access.endpointOverridden ? await providerCurrency({ receipt: observed?.receipt, status: observed, messages: result.messages, transport, ref }) : void 0;
|
|
26190
26273
|
const settlement = await observedSettlementFields(jobId, observed, !access.endpointOverridden, currency);
|
|
26274
|
+
const unanswered = await readUnansweredPaymentRequest(jobId, observed?.status ?? (access.endpointOverridden ? void 0 : loadJob(jobId)?.status), access, transport, {
|
|
26275
|
+
messages: result.messages,
|
|
26276
|
+
fullHistory: after === 0 && result.messages.some((message2) => message2.type === "cancel" || message2.type === "complete"),
|
|
26277
|
+
localOnly: isTerminal || observed?.content_available === false || waitDeadline !== void 0 && Date.now() >= waitDeadline,
|
|
26278
|
+
timeoutMs: waitDeadline === void 0 ? streamOptions.timeoutMs : Math.max(1, Math.min(streamOptions.timeoutMs, waitDeadline - Date.now()))
|
|
26279
|
+
});
|
|
26191
26280
|
transport.close();
|
|
26192
26281
|
if (opts.human) {
|
|
26193
26282
|
renderSettlementHuman(settlement);
|
|
26283
|
+
if (unanswered) info(unanswered.display);
|
|
26194
26284
|
info(String(content.content_hint));
|
|
26195
26285
|
if (result.messages.length === 0) {
|
|
26196
26286
|
info("No new messages.");
|
|
@@ -26208,6 +26298,7 @@ async function messagesWithAccess(jobId, opts, access) {
|
|
|
26208
26298
|
jobId,
|
|
26209
26299
|
...content,
|
|
26210
26300
|
...settlement,
|
|
26301
|
+
...unanswered ? { unanswered_payment_request: unanswered } : {},
|
|
26211
26302
|
message_count: messageLines,
|
|
26212
26303
|
auto_payment_count: paymentLines,
|
|
26213
26304
|
cursor: result.cursor,
|
|
@@ -26219,6 +26310,7 @@ async function messagesWithAccess(jobId, opts, access) {
|
|
|
26219
26310
|
jobId,
|
|
26220
26311
|
...content,
|
|
26221
26312
|
...settlement,
|
|
26313
|
+
...unanswered ? { unanswered_payment_request: unanswered } : {},
|
|
26222
26314
|
messages: result.messages.map(serialize),
|
|
26223
26315
|
cursor: result.cursor,
|
|
26224
26316
|
next_action: resolvedAction,
|
|
@@ -26689,15 +26781,19 @@ function parsePositiveCashuSats(raw2) {
|
|
|
26689
26781
|
function positive(value) {
|
|
26690
26782
|
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
26691
26783
|
}
|
|
26692
|
-
function autoPayWarnings(quotes, limits, ceiling, btcRate = getLastKnownBtcRate()?.rate ?? 0) {
|
|
26784
|
+
function autoPayWarnings(quotes, limits, ceiling, btcRate = getLastKnownBtcRate()?.rate ?? 0, { upfrontCoveredByCredit = false } = {}) {
|
|
26693
26785
|
if (!limits.budget && !limits.autoPayBelow) return [];
|
|
26694
26786
|
if (!positive(btcRate)) {
|
|
26695
26787
|
const quoted = quotes.find((quote2) => quote2.upfront?.currency === "usd" && positive(quote2.upfront.amount) && positive(quote2.priceMsats));
|
|
26696
26788
|
btcRate = getLastKnownBtcRate()?.rate ?? (quoted ? quoted.upfront.amount * 1e11 / quoted.priceMsats : 0);
|
|
26697
26789
|
}
|
|
26698
26790
|
const amounts = [];
|
|
26791
|
+
let excludedUpfront = false;
|
|
26699
26792
|
for (const quote2 of quotes) {
|
|
26700
|
-
if (quote2.upfront?.currency === "usd" && positive(quote2.upfront.amount))
|
|
26793
|
+
if (quote2.upfront?.currency === "usd" && positive(quote2.upfront.amount)) {
|
|
26794
|
+
if (upfrontCoveredByCredit) excludedUpfront = true;
|
|
26795
|
+
else amounts.push(quote2.upfront.amount);
|
|
26796
|
+
}
|
|
26701
26797
|
const rate = quote2.rate;
|
|
26702
26798
|
if (rate?.per_unit?.currency === "usd" && positive(rate.per_unit.amount) && positive(rate.max_units)) {
|
|
26703
26799
|
const maximum2 = Number((rate.per_unit.amount * rate.max_units).toPrecision(15));
|
|
@@ -26705,7 +26801,7 @@ function autoPayWarnings(quotes, limits, ceiling, btcRate = getLastKnownBtcRate(
|
|
|
26705
26801
|
}
|
|
26706
26802
|
}
|
|
26707
26803
|
let source = "quote";
|
|
26708
|
-
if (!amounts.length && ceiling && typeof ceiling === "object") {
|
|
26804
|
+
if (!amounts.length && !excludedUpfront && ceiling && typeof ceiling === "object") {
|
|
26709
26805
|
const max = ceiling;
|
|
26710
26806
|
if (max.currency === "usd" && positive(max.amount)) {
|
|
26711
26807
|
amounts.push(max.amount);
|
|
@@ -28194,8 +28290,6 @@ async function requestWithWarnings(opts, stage) {
|
|
|
28194
28290
|
}
|
|
28195
28291
|
const pricing = providerInfo.capabilities?.[capability]?.pricing;
|
|
28196
28292
|
const warningLimits = { budget: effectiveBudget, autoPayBelow: effectiveAutoPayBelow };
|
|
28197
|
-
const previewWarnings = autoPayWarnings(previewQuotes, warningLimits, pricing?.max ?? providerInfo.pricing?.max, btcRate);
|
|
28198
|
-
addOutputWarnings(previewWarnings, opts.human);
|
|
28199
28293
|
if (signing) {
|
|
28200
28294
|
const signer = signing;
|
|
28201
28295
|
const unsignedData = signing.unsignedData;
|
|
@@ -28274,6 +28368,15 @@ async function requestWithWarnings(opts, stage) {
|
|
|
28274
28368
|
);
|
|
28275
28369
|
}
|
|
28276
28370
|
}
|
|
28371
|
+
const previewUpfrontCoveredByCredit = probePlan.mode === "draw";
|
|
28372
|
+
const previewWarnings = autoPayWarnings(
|
|
28373
|
+
previewQuotes,
|
|
28374
|
+
warningLimits,
|
|
28375
|
+
pricing?.max ?? providerInfo.pricing?.max,
|
|
28376
|
+
btcRate,
|
|
28377
|
+
{ upfrontCoveredByCredit: previewUpfrontCoveredByCredit }
|
|
28378
|
+
);
|
|
28379
|
+
addOutputWarnings(previewWarnings, opts.human);
|
|
28277
28380
|
let envelope = { ...envelopeBase, data };
|
|
28278
28381
|
let jobRequestId = opts.requestId ?? drawRequestId;
|
|
28279
28382
|
stage.intentReached = true;
|
|
@@ -28368,7 +28471,9 @@ async function requestWithWarnings(opts, stage) {
|
|
|
28368
28471
|
transport.close();
|
|
28369
28472
|
throw new DvmError("credit_only_unavailable", "The selected prepaid credit did not cover this submission; no fresh payment was attempted.");
|
|
28370
28473
|
}
|
|
28371
|
-
if (!previewWarnings.length
|
|
28474
|
+
if (!previewWarnings.length || previewUpfrontCoveredByCredit) {
|
|
28475
|
+
addOutputWarnings(autoPayWarnings(quotes, warningLimits, void 0, btcRate), opts.human);
|
|
28476
|
+
}
|
|
28372
28477
|
if (autoPayConsent && quotes.length > 0) {
|
|
28373
28478
|
const pay2 = () => handleAutoPayQuotes(
|
|
28374
28479
|
transport,
|
|
@@ -28448,11 +28553,16 @@ async function requestWithWarnings(opts, stage) {
|
|
|
28448
28553
|
recordUpfrontCreditPayment(receipt.jobId, receipt.upfrontPayment);
|
|
28449
28554
|
if (noStream && !isTerminalJobStatus(receipt.status)) {
|
|
28450
28555
|
transport.close();
|
|
28556
|
+
const nextAction = pollNextAction(receipt.jobId);
|
|
28557
|
+
if (policy.maxPayments > 1) {
|
|
28558
|
+
const job = guidanceJobArg(receipt.jobId);
|
|
28559
|
+
nextAction.hint += ` Later payment asks are paid only while \`dvm messages ${job} --wait\` stays attached within the saved spending policy, or by running \`dvm pay ${job}\` for each ask. An unanswered payment ask ends the job. Neither \`dvm status ${job}\` nor \`dvm messages ${job} --no-stream\` pays later asks.`;
|
|
28560
|
+
}
|
|
28451
28561
|
if (opts.human) {
|
|
28452
28562
|
info(`Job published: ${receipt.jobId}`);
|
|
28453
28563
|
echoTraceIdHuman();
|
|
28454
28564
|
if (!isTerminalJobStatus(receipt.status)) {
|
|
28455
|
-
printNextActionHuman(
|
|
28565
|
+
printNextActionHuman(nextAction);
|
|
28456
28566
|
}
|
|
28457
28567
|
} else {
|
|
28458
28568
|
providerJobJson({
|
|
@@ -28471,11 +28581,7 @@ async function requestWithWarnings(opts, stage) {
|
|
|
28471
28581
|
// NOT drain here: nothing may stash a feedback notice before a
|
|
28472
28582
|
// terminal, so there is nothing to carry.
|
|
28473
28583
|
...takeCreditNoticeFields(),
|
|
28474
|
-
next_action:
|
|
28475
|
-
type: "poll",
|
|
28476
|
-
job_id: receipt.jobId,
|
|
28477
|
-
hint: "Job submitted, check back for updates"
|
|
28478
|
-
}
|
|
28584
|
+
next_action: nextAction
|
|
28479
28585
|
});
|
|
28480
28586
|
}
|
|
28481
28587
|
return;
|
|
@@ -31379,10 +31485,12 @@ async function statusWithAccess(jobId, opts, access) {
|
|
|
31379
31485
|
markJobTerminal(jobId, terminalStatus, completion2);
|
|
31380
31486
|
}
|
|
31381
31487
|
await settleCreditAfterRead({ job: stored, capture: receipt2, transport: transport2, human: opts.human });
|
|
31488
|
+
const unanswered2 = await readUnansweredPaymentRequest(jobId, terminalStatus, access, transport2, { localOnly: true });
|
|
31382
31489
|
transport2.close();
|
|
31383
31490
|
await renderStatus(jobId, stored, terminalStatus, completion2, "local", null, opts, {
|
|
31384
31491
|
receipt: receipt2,
|
|
31385
|
-
content
|
|
31492
|
+
content,
|
|
31493
|
+
unanswered: unanswered2
|
|
31386
31494
|
});
|
|
31387
31495
|
return;
|
|
31388
31496
|
}
|
|
@@ -31459,13 +31567,19 @@ async function statusWithAccess(jobId, opts, access) {
|
|
|
31459
31567
|
if (newCursor !== void 0) updates.messageCursor = newCursor;
|
|
31460
31568
|
if (Object.keys(updates).length > 0) updateObservedJob(jobId, updates);
|
|
31461
31569
|
}
|
|
31570
|
+
const unanswered = await readUnansweredPaymentRequest(jobId, result.status, access, transport, {
|
|
31571
|
+
messages: msgs,
|
|
31572
|
+
timeoutMs: timeout,
|
|
31573
|
+
localOnly: result.content_available === false
|
|
31574
|
+
});
|
|
31462
31575
|
transport.close();
|
|
31463
31576
|
await renderStatus(jobId, stored, result.status, completion, "provider", nextAction, opts, {
|
|
31464
31577
|
msgs,
|
|
31465
31578
|
cursor: newCursor,
|
|
31466
31579
|
receipt,
|
|
31467
31580
|
content: result,
|
|
31468
|
-
currency
|
|
31581
|
+
currency,
|
|
31582
|
+
unanswered
|
|
31469
31583
|
});
|
|
31470
31584
|
}
|
|
31471
31585
|
function transientReceiptCapture(jobId, response, endpoint, currency) {
|
|
@@ -31507,6 +31621,7 @@ async function renderStatus(jobId, stored, jobStatus, completion, source, nextAc
|
|
|
31507
31621
|
info(`Status: ${jobStatus}${identifier ? ` [${identifier}]` : ""}`);
|
|
31508
31622
|
if (completion.message) info(` ${completion.message}`);
|
|
31509
31623
|
}
|
|
31624
|
+
if (fetched?.unanswered) info(fetched.unanswered.display);
|
|
31510
31625
|
if (artifacts.hint) info(`\u{1F4CE} ${artifacts.hint}`);
|
|
31511
31626
|
info(String(content.content_hint));
|
|
31512
31627
|
if (msgs.length > 0) {
|
|
@@ -31541,6 +31656,7 @@ ${msgs.length} new message(s):`);
|
|
|
31541
31656
|
...artifacts.fields,
|
|
31542
31657
|
...artifacts.display ? { display: artifacts.display } : {},
|
|
31543
31658
|
...completion.message ? { message: completion.message } : {},
|
|
31659
|
+
...fetched?.unanswered ? { unanswered_payment_request: fetched.unanswered } : {},
|
|
31544
31660
|
// terminal responses only. On a still-running job "absent" would
|
|
31545
31661
|
// read as "this DVM doesn't issue receipts" rather than "not yet".
|
|
31546
31662
|
...receipt ? await receiptJsonFields(receipt) : {},
|
|
@@ -34095,9 +34211,13 @@ function examples(fetcher) {
|
|
|
34095
34211
|
async function catchErrors(fn, human, jsonFields) {
|
|
34096
34212
|
const lifetimeHold = setInterval(() => void 0, 60 * 60 * 1e3);
|
|
34097
34213
|
try {
|
|
34098
|
-
await
|
|
34099
|
-
|
|
34100
|
-
|
|
34214
|
+
await withOutputWarningContext(async () => {
|
|
34215
|
+
try {
|
|
34216
|
+
await fn();
|
|
34217
|
+
} catch (err) {
|
|
34218
|
+
handleError(err, human, jsonFields);
|
|
34219
|
+
}
|
|
34220
|
+
});
|
|
34101
34221
|
} finally {
|
|
34102
34222
|
clearInterval(lifetimeHold);
|
|
34103
34223
|
}
|
|
@@ -34785,6 +34905,7 @@ async function walletFund(amount, opts) {
|
|
|
34785
34905
|
info(`Quote ID: ${quote2.quote}`);
|
|
34786
34906
|
if (expiresAt) info(`Invoice expires: ${expiresAt}`);
|
|
34787
34907
|
info("After payment, run `dvm wallet show` to collect the sats and check the new balance.");
|
|
34908
|
+
info(` \u21B3 ${collectDeadlineHint(expiresAt)}`);
|
|
34788
34909
|
} else {
|
|
34789
34910
|
info(
|
|
34790
34911
|
"Polling for payment every 2s; press Ctrl-C to bail (the quote will be recoverable on next run)."
|
|
@@ -34805,6 +34926,7 @@ async function walletFund(amount, opts) {
|
|
|
34805
34926
|
qr_image_path: qrImagePath,
|
|
34806
34927
|
relay: { copy_text: invoice, standalone: true },
|
|
34807
34928
|
expires_at: expiresAt,
|
|
34929
|
+
...opts.wait === false ? { collect_before: expiresAt } : {},
|
|
34808
34930
|
lock_pubkey: wallet.lock_pubkey,
|
|
34809
34931
|
display: `Pay ${sats} sats to the Lightning invoice to fund ${amountPhrase} into the agent wallet at ${mintUrl} (${selectionPhrase}). Scannable QR at ${qrImagePath}.`,
|
|
34810
34932
|
...opts.wait === false ? {
|
|
@@ -34813,7 +34935,7 @@ async function walletFund(amount, opts) {
|
|
|
34813
34935
|
sweep: summarizeSweep(sweep),
|
|
34814
34936
|
melt_sweep: summarizeMeltSweep(meltSweep)
|
|
34815
34937
|
} : {},
|
|
34816
|
-
hint: opts.wait === false ?
|
|
34938
|
+
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. ${collectDeadlineHint(expiresAt)} 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."
|
|
34817
34939
|
});
|
|
34818
34940
|
}
|
|
34819
34941
|
};
|
|
@@ -34949,7 +35071,8 @@ async function walletShow(opts) {
|
|
|
34949
35071
|
}
|
|
34950
35072
|
await loadConfiguredMints();
|
|
34951
35073
|
const sweep = await reconcilePendingMints();
|
|
34952
|
-
const
|
|
35074
|
+
const sweepSummary = summarizeSweep(sweep);
|
|
35075
|
+
const expiredMints = sweepSummary.expired;
|
|
34953
35076
|
const meltSweep = await reconcilePendingMelts().catch(emptyMeltSweep);
|
|
34954
35077
|
const inFlightSweepReverted = await sweepStaleInFlightUnderLock();
|
|
34955
35078
|
const submissionSweep = await sweepPendingSubmissions({ fetchImpl: dvmFetch }).catch(() => ({
|
|
@@ -34971,6 +35094,11 @@ async function walletShow(opts) {
|
|
|
34971
35094
|
(entry) => entry.state === "unreclaimable"
|
|
34972
35095
|
);
|
|
34973
35096
|
const unchecked = new Map(sweep.unchecked.map((u) => [u.quote_id, u]));
|
|
35097
|
+
const pendingNotes = new Map([
|
|
35098
|
+
...sweepSummary.pending.map((p) => [p.quote_id, p.display]),
|
|
35099
|
+
...sweepSummary.kept_past_expiry.map((p) => [p.quote_id, p.display]),
|
|
35100
|
+
...sweepSummary.paid_uncollected.map((p) => [p.quote_id, p.display])
|
|
35101
|
+
]);
|
|
34974
35102
|
const inventory = buildDisplayMintInventory(post);
|
|
34975
35103
|
const mintsToProbe = inventory.map((e) => e.url);
|
|
34976
35104
|
const sources = new Map(inventory.map((e) => [e.url, e.source]));
|
|
@@ -35000,14 +35128,18 @@ async function walletShow(opts) {
|
|
|
35000
35128
|
const recovered = sweep.recovered_proofs.reduce((sum, p) => sum + p.amount, 0);
|
|
35001
35129
|
info(`Recovered ${recovered} sats from ${sweep.recovered_proofs.length} pending mint(s).`);
|
|
35002
35130
|
}
|
|
35003
|
-
for (const collected of
|
|
35131
|
+
for (const collected of sweepSummary.collected) {
|
|
35004
35132
|
info(`${collected.display} Added ${collected.sats_collected} sats at ${collected.mint}.`);
|
|
35005
35133
|
}
|
|
35006
35134
|
for (const expired of expiredMints) {
|
|
35007
35135
|
info(
|
|
35008
|
-
`Unpaid mint quote expired: ${expired.amount_sats} sats at ${expired.mint} (quote ID ${expired.quote_id}) \u2014 local recovery entry removed.`
|
|
35136
|
+
`Unpaid mint quote expired: ${expired.amount_sats} sats at ${expired.mint} (quote ID ${expired.quote_id}) \u2014 ${describeDropReason(expired.reason)}; local recovery entry removed.`
|
|
35009
35137
|
);
|
|
35010
35138
|
}
|
|
35139
|
+
for (const refused of sweepSummary.paid_uncollected) {
|
|
35140
|
+
info(refused.display);
|
|
35141
|
+
info(` \u21B3 ${refused.hint}`);
|
|
35142
|
+
}
|
|
35011
35143
|
reportUncheckedMints(sweep.unchecked);
|
|
35012
35144
|
reportUncheckedMints(meltSweep.unchecked);
|
|
35013
35145
|
if (inFlightSweepReverted > 0) {
|
|
@@ -35070,7 +35202,7 @@ async function walletShow(opts) {
|
|
|
35070
35202
|
info("");
|
|
35071
35203
|
info(`Pending mints: ${post.pending_mints.length}`);
|
|
35072
35204
|
for (const p of post.pending_mints) {
|
|
35073
|
-
info(` ${formatPending(p, unchecked.get(p.quote_id))}`);
|
|
35205
|
+
info(` ${formatPending(p, unchecked.get(p.quote_id), pendingNotes.get(p.quote_id))}`);
|
|
35074
35206
|
}
|
|
35075
35207
|
}
|
|
35076
35208
|
if (pendingMelts.length > 0) {
|
|
@@ -35128,6 +35260,8 @@ async function walletShow(opts) {
|
|
|
35128
35260
|
const totalUsd = railsSnapshot.reduce((sum, r) => sum + (r.json.balance_usd ?? 0), 0);
|
|
35129
35261
|
const baseHint = pendingMeltSats > 0 ? `${pendingMeltSats} sats are committed to a cash-out the mint hasn't confirmed \u2014 see pending_melts. They stay unspendable until it resolves.` : submissions.at_risk_sats > 0 ? `${submissions.at_risk_sats} sats were paid to a DVM that never confirmed \u2014 see pending_submissions.` : railsSnapshot.length === 0 ? "Fund with: dvm wallet fund <amount> [--rail cashu|tempo]" : cashuSplit ? `${NON_FUNGIBLE_MINT_NOTE} Fund more with: dvm wallet fund <amount> [--rail cashu|tempo]` : "Fund more with: dvm wallet fund <amount> [--rail cashu|tempo]";
|
|
35130
35262
|
const uncheckedHint = sweep.unchecked.length > 0 ? `${sweep.unchecked.length} pending mint(s) could not be checked against their mint on this call \u2014 see sweep.unchecked for the cause and how long to wait. They keep their pending state; don't fund the same invoice again.` : null;
|
|
35263
|
+
const refusedHint = sweepSummary.paid_uncollected.length > 0 ? `${sweepSummary.paid_uncollected.length} paid invoice(s) could not be collected because the mint refuses to issue after the quote expired \u2014 see sweep.paid_uncollected. Don't pay them again.` : null;
|
|
35264
|
+
const keptHint = sweepSummary.kept_past_expiry.length > 0 ? `${sweepSummary.kept_past_expiry.length} unpaid invoice(s) are past their expiry and still checked for a late payment \u2014 see sweep.kept_past_expiry for when each is removed.` : null;
|
|
35131
35265
|
const stuckReclaims = skippedReclaimViews.filter((v) => !v.terminal);
|
|
35132
35266
|
const deadReclaims = skippedReclaimViews.filter((v) => v.terminal);
|
|
35133
35267
|
const unresolvedHint = unresolvedViews.length > 0 ? `${unresolvedViews.length} paid call(s) need attention: the provider accepted them without a clear job ID \u2014 see accepted_unresolved. Do not pay for them again.` : null;
|
|
@@ -35167,10 +35301,10 @@ async function walletShow(opts) {
|
|
|
35167
35301
|
// paid calls the provider accepted without a settled job identity,
|
|
35168
35302
|
// detected on this call or missing their evidence record.
|
|
35169
35303
|
accepted_unresolved: unresolvedViews,
|
|
35170
|
-
sweep:
|
|
35304
|
+
sweep: sweepSummary,
|
|
35171
35305
|
melt_sweep: summarizeMeltSweep(meltSweep),
|
|
35172
35306
|
display: railsSnapshot.length === 0 ? "Agent wallet is empty." : `${railsSnapshot.map((r) => r.json.display).join(" \u2014 ")} (~$${totalUsd.toFixed(2)} total)`,
|
|
35173
|
-
hint: [uncheckedHint, unresolvedHint, resumedHint, baseHint].filter(Boolean).join(" ")
|
|
35307
|
+
hint: [refusedHint, uncheckedHint, keptHint, unresolvedHint, resumedHint, baseHint].filter(Boolean).join(" ")
|
|
35174
35308
|
});
|
|
35175
35309
|
}
|
|
35176
35310
|
}
|
|
@@ -35477,10 +35611,25 @@ function formatFeePpk(fee) {
|
|
|
35477
35611
|
if (fee === null) return "- (mint unreachable)";
|
|
35478
35612
|
return `${fee} ppk`;
|
|
35479
35613
|
}
|
|
35480
|
-
function formatPending(p, unchecked) {
|
|
35614
|
+
function formatPending(p, unchecked, note) {
|
|
35481
35615
|
const row = `${p.amount_sats} sats at ${p.mint} (quote ${p.quote_id}, requested ${p.requested_at})`;
|
|
35482
|
-
|
|
35483
|
-
\u21B3 ${uncheckedPendingNote(unchecked)}
|
|
35616
|
+
if (unchecked) return `${row}
|
|
35617
|
+
\u21B3 ${uncheckedPendingNote(unchecked)}`;
|
|
35618
|
+
return note ? `${row}
|
|
35619
|
+
\u21B3 ${note}` : `${row} \u2014 not paid yet; awaiting payment`;
|
|
35620
|
+
}
|
|
35621
|
+
function collectDeadlineHint(expiresAt) {
|
|
35622
|
+
return expiresAt ? `Collect before ${expiresAt}: a mint can refuse to issue for a paid invoice once its quote has expired.` : "The mint named no expiry for this invoice; collect soon after payment.";
|
|
35623
|
+
}
|
|
35624
|
+
function describeDropReason(reason) {
|
|
35625
|
+
switch (reason) {
|
|
35626
|
+
case "mint_unknown":
|
|
35627
|
+
return "the mint no longer knows this quote";
|
|
35628
|
+
case "mint_expired":
|
|
35629
|
+
return "the mint reports it expired";
|
|
35630
|
+
case "grace_elapsed":
|
|
35631
|
+
return `the mint still reported it unpaid ${GRACE_HOURS} hours after it expired`;
|
|
35632
|
+
}
|
|
35484
35633
|
}
|
|
35485
35634
|
function reportUncheckedMints(unchecked) {
|
|
35486
35635
|
for (const entry of unchecked) {
|
|
@@ -35525,13 +35674,45 @@ function summarizeMeltSweep(sweep) {
|
|
|
35525
35674
|
unchecked: sweep.unchecked
|
|
35526
35675
|
};
|
|
35527
35676
|
}
|
|
35528
|
-
function summarizeSweep(sweep) {
|
|
35677
|
+
function summarizeSweep(sweep, nowMs = Date.now()) {
|
|
35678
|
+
const waiting = sweep.outcomes.filter((o) => o.kind === "still_pending");
|
|
35529
35679
|
return {
|
|
35530
|
-
pending:
|
|
35680
|
+
pending: waiting.filter((o) => o.past_expiry === void 0).map(({ entry }) => {
|
|
35681
|
+
const requestedAtMs = Date.parse(entry.requested_at);
|
|
35682
|
+
const forget = `dvm wallet forget-quote ${shellQuoteArg(entry.quote_id)}`;
|
|
35683
|
+
return {
|
|
35684
|
+
quote_id: entry.quote_id,
|
|
35685
|
+
mint: entry.mint,
|
|
35686
|
+
amount_sats: entry.amount_sats,
|
|
35687
|
+
requested_at: entry.requested_at,
|
|
35688
|
+
age_seconds: Number.isFinite(requestedAtMs) ? Math.max(0, Math.floor((nowMs - requestedAtMs) / 1e3)) : null,
|
|
35689
|
+
expires_at: entry.expires_at === void 0 ? null : new Date(entry.expires_at * 1e3).toISOString(),
|
|
35690
|
+
display: entry.expires_at === void 0 ? `Mint quote ${entry.quote_id} is not paid yet. The mint named no expiry, so it stays pending until it is paid or you forget it with \`${forget}\`.` : `Mint quote ${entry.quote_id} is not paid yet.`
|
|
35691
|
+
};
|
|
35692
|
+
}),
|
|
35693
|
+
// Unpaid quotes past their expiry. A late payment is still collected while
|
|
35694
|
+
// they are listed here.
|
|
35695
|
+
kept_past_expiry: waiting.flatMap(({ entry, past_expiry }) => {
|
|
35696
|
+
if (past_expiry === void 0) return [];
|
|
35697
|
+
const dropAfter = new Date(past_expiry.drop_after_ms).toISOString();
|
|
35698
|
+
return [{
|
|
35699
|
+
quote_id: entry.quote_id,
|
|
35700
|
+
mint: entry.mint,
|
|
35701
|
+
amount_sats: entry.amount_sats,
|
|
35702
|
+
expired_at: new Date(past_expiry.expired_at_ms).toISOString(),
|
|
35703
|
+
drop_after: dropAfter,
|
|
35704
|
+
display: `Mint quote ${entry.quote_id} expired unpaid. It is kept and checked for a late payment until ${dropAfter}.`,
|
|
35705
|
+
hint: `A payment that arrives late is collected by \`dvm wallet show\` if the mint credits it. Ask for a new invoice instead of paying this one; to stop tracking it now, run \`dvm wallet forget-quote ${shellQuoteArg(entry.quote_id)}\`.`
|
|
35706
|
+
}];
|
|
35707
|
+
}),
|
|
35708
|
+
// Paid, but the mint will not issue ecash for it. Never dropped by a sweep.
|
|
35709
|
+
paid_uncollected: sweep.refused.map((entry) => ({
|
|
35531
35710
|
quote_id: entry.quote_id,
|
|
35532
35711
|
mint: entry.mint,
|
|
35533
35712
|
amount_sats: entry.amount_sats,
|
|
35534
|
-
|
|
35713
|
+
reason: "quote_expired",
|
|
35714
|
+
display: `Mint quote ${entry.quote_id} was paid (${entry.amount_sats} sats at ${entry.mint}), but the mint refuses to issue the sats because the quote expired before they were collected.`,
|
|
35715
|
+
hint: `The payment is recorded and \`dvm wallet show\` asks the mint again on every run. Don't pay it again. If the mint keeps refusing, its operator is the one who can release the payment: give them the quote ID. To stop tracking it, run \`dvm wallet forget-quote ${shellQuoteArg(entry.quote_id)} --force --yes\`.`
|
|
35535
35716
|
})),
|
|
35536
35717
|
collected: sweep.outcomes.flatMap(
|
|
35537
35718
|
(outcome) => outcome.kind === "minted" || outcome.kind === "restored" ? [{
|
|
@@ -35550,12 +35731,17 @@ function summarizeSweep(sweep) {
|
|
|
35550
35731
|
unchecked: sweep.unchecked
|
|
35551
35732
|
};
|
|
35552
35733
|
}
|
|
35734
|
+
var GRACE_HOURS = MINT_QUOTE_EXPIRY_GRACE_MS / 36e5;
|
|
35553
35735
|
function describeExpiredMints(sweep) {
|
|
35554
|
-
return sweep.outcomes.
|
|
35555
|
-
|
|
35556
|
-
|
|
35557
|
-
|
|
35558
|
-
|
|
35736
|
+
return sweep.outcomes.flatMap(
|
|
35737
|
+
(outcome) => outcome.kind === "expired" ? [{
|
|
35738
|
+
quote_id: outcome.entry.quote_id,
|
|
35739
|
+
mint: outcome.entry.mint,
|
|
35740
|
+
amount_sats: outcome.entry.amount_sats,
|
|
35741
|
+
reason: outcome.reason,
|
|
35742
|
+
display: `Unpaid mint quote ${outcome.entry.quote_id} was removed: ${describeDropReason(outcome.reason)}. A payment made to it now cannot be collected.`
|
|
35743
|
+
}] : []
|
|
35744
|
+
);
|
|
35559
35745
|
}
|
|
35560
35746
|
async function writeInvoicePng(invoice, outPath) {
|
|
35561
35747
|
try {
|
|
@@ -39139,8 +39325,136 @@ async function walletSetDefaultRail(rail, opts) {
|
|
|
39139
39325
|
}
|
|
39140
39326
|
}
|
|
39141
39327
|
|
|
39142
|
-
// src/commands/wallet-
|
|
39328
|
+
// src/commands/wallet-forget-quote.ts
|
|
39143
39329
|
import { createInterface as createInterface4 } from "readline";
|
|
39330
|
+
async function walletForgetQuote(quoteId, opts) {
|
|
39331
|
+
const wallet = loadAgentWallet();
|
|
39332
|
+
if (!wallet) {
|
|
39333
|
+
throw new DvmError(
|
|
39334
|
+
"wallet_missing",
|
|
39335
|
+
"No agent wallet found.",
|
|
39336
|
+
"Run `dvm wallet init` first to generate a lock keypair."
|
|
39337
|
+
);
|
|
39338
|
+
}
|
|
39339
|
+
const entry = wallet.pending_mints.find((p) => p.quote_id === quoteId);
|
|
39340
|
+
if (!entry) {
|
|
39341
|
+
throw new DvmError(
|
|
39342
|
+
"mint_quote_not_found",
|
|
39343
|
+
`No pending mint quote with ID "${quoteId}".`,
|
|
39344
|
+
"List pending quotes with: dvm wallet show"
|
|
39345
|
+
);
|
|
39346
|
+
}
|
|
39347
|
+
const standing = await quoteStanding(entry);
|
|
39348
|
+
refuseIfCollectable(entry, standing, opts);
|
|
39349
|
+
await confirmForget(entry, standing, opts);
|
|
39350
|
+
await withWalletLock(() => {
|
|
39351
|
+
const fresh = loadAgentWallet() ?? wallet;
|
|
39352
|
+
saveAgentWallet(withoutPendingMint(fresh, quoteId));
|
|
39353
|
+
});
|
|
39354
|
+
const display = `Forgot mint quote ${quoteId} (${entry.amount_sats} sats at ${entry.mint}). ${forgottenConsequence(standing)}`;
|
|
39355
|
+
if (opts.human) {
|
|
39356
|
+
info(display);
|
|
39357
|
+
return;
|
|
39358
|
+
}
|
|
39359
|
+
json({
|
|
39360
|
+
status: "forgotten",
|
|
39361
|
+
quote_id: quoteId,
|
|
39362
|
+
mint: entry.mint,
|
|
39363
|
+
amount_sats: entry.amount_sats,
|
|
39364
|
+
mint_state: standing.state,
|
|
39365
|
+
display,
|
|
39366
|
+
hint: "The quote is gone from the wallet. This cannot be undone."
|
|
39367
|
+
});
|
|
39368
|
+
}
|
|
39369
|
+
async function quoteStanding(entry) {
|
|
39370
|
+
try {
|
|
39371
|
+
const cashuWallet = await getWallet(entry.mint);
|
|
39372
|
+
const quote2 = await cashuWallet.checkMintQuoteBolt11(entry.quote_id);
|
|
39373
|
+
if (quote2.state === sa.PAID) return { state: "paid" };
|
|
39374
|
+
if (quote2.state === sa.ISSUED) return { state: "issued" };
|
|
39375
|
+
if (quote2.state === sa.UNPAID) return { state: "unpaid" };
|
|
39376
|
+
if (quote2.state === "EXPIRED") return { state: "gone" };
|
|
39377
|
+
return { state: "unchecked", cause: "unexpected" };
|
|
39378
|
+
} catch (err) {
|
|
39379
|
+
if (mintQuoteRefusal(err) !== void 0) return { state: "gone" };
|
|
39380
|
+
return { state: "unchecked", cause: classifyMintError(err) };
|
|
39381
|
+
}
|
|
39382
|
+
}
|
|
39383
|
+
function refuseIfCollectable(entry, standing, opts) {
|
|
39384
|
+
if (opts.force) return;
|
|
39385
|
+
const forced = `dvm wallet forget-quote ${shellQuoteArg(entry.quote_id)} --yes --force`;
|
|
39386
|
+
const collectable = standing.state === "paid" || standing.state === "issued" && entry.minting !== void 0;
|
|
39387
|
+
if (collectable) {
|
|
39388
|
+
throw new DvmError(
|
|
39389
|
+
"mint_quote_collectable",
|
|
39390
|
+
`Mint quote ${entry.quote_id} is paid: ${entry.amount_sats} sats at ${entry.mint} are waiting to be collected.`,
|
|
39391
|
+
`Run \`dvm wallet show\` to collect them. Forgetting the quote gives up the only record that can; if the mint keeps refusing to issue and you accept that, add --force: ${forced}`
|
|
39392
|
+
);
|
|
39393
|
+
}
|
|
39394
|
+
if (standing.state === "unchecked") {
|
|
39395
|
+
throw new DvmError(
|
|
39396
|
+
"mint_quote_unchecked",
|
|
39397
|
+
`The mint did not say whether mint quote ${entry.quote_id} has been paid, so forgetting it could lose a payment.`,
|
|
39398
|
+
`Try again once the mint answers. To forget it without knowing, add --force: ${forced}`,
|
|
39399
|
+
{ cause: standing.cause, retryable: standing.cause !== "unexpected" }
|
|
39400
|
+
);
|
|
39401
|
+
}
|
|
39402
|
+
}
|
|
39403
|
+
async function confirmForget(entry, standing, opts) {
|
|
39404
|
+
if (opts.yes) return;
|
|
39405
|
+
const consequence = forgetConsequence(standing);
|
|
39406
|
+
if (opts.human && process.stdin.isTTY) {
|
|
39407
|
+
const rl = createInterface4({ input: process.stdin, output: process.stderr });
|
|
39408
|
+
const answer = await new Promise((resolve3) => {
|
|
39409
|
+
rl.question(
|
|
39410
|
+
`Forgetting mint quote ${entry.quote_id} ${consequence}. Type the quote ID to confirm: `,
|
|
39411
|
+
(a) => {
|
|
39412
|
+
rl.close();
|
|
39413
|
+
resolve3(a.trim());
|
|
39414
|
+
}
|
|
39415
|
+
);
|
|
39416
|
+
});
|
|
39417
|
+
if (answer !== entry.quote_id) {
|
|
39418
|
+
throw new DvmError("cancelled", "Forget cancelled.");
|
|
39419
|
+
}
|
|
39420
|
+
return;
|
|
39421
|
+
}
|
|
39422
|
+
throw new DvmError(
|
|
39423
|
+
"confirmation_required",
|
|
39424
|
+
"Pass --yes to forget in non-interactive mode.",
|
|
39425
|
+
`This ${consequence}. Use: dvm wallet forget-quote ${shellQuoteArg(entry.quote_id)} --yes${opts.force ? " --force" : ""}`
|
|
39426
|
+
);
|
|
39427
|
+
}
|
|
39428
|
+
function forgetConsequence(standing) {
|
|
39429
|
+
switch (standing.state) {
|
|
39430
|
+
case "paid":
|
|
39431
|
+
case "issued":
|
|
39432
|
+
return "gives up the only record that can collect a payment the mint has already taken, so this cannot be undone";
|
|
39433
|
+
case "unchecked":
|
|
39434
|
+
return "removes the only record that can collect its payment, without knowing whether it was paid, so this cannot be undone";
|
|
39435
|
+
case "gone":
|
|
39436
|
+
return "clears a quote the mint no longer honors, so nothing collectable is lost, but this cannot be undone";
|
|
39437
|
+
case "unpaid":
|
|
39438
|
+
return "means a payment made to its invoice afterwards cannot be collected, so this cannot be undone";
|
|
39439
|
+
}
|
|
39440
|
+
}
|
|
39441
|
+
function forgottenConsequence(standing) {
|
|
39442
|
+
switch (standing.state) {
|
|
39443
|
+
case "paid":
|
|
39444
|
+
return "The mint reported it as paid; that payment can no longer be collected by this wallet.";
|
|
39445
|
+
case "issued":
|
|
39446
|
+
return "The mint reported it as already issued.";
|
|
39447
|
+
case "unchecked":
|
|
39448
|
+
return "The mint did not say whether it was paid; a payment for it can no longer be collected by this wallet.";
|
|
39449
|
+
case "gone":
|
|
39450
|
+
return "The mint no longer honors it, so nothing collectable was given up.";
|
|
39451
|
+
case "unpaid":
|
|
39452
|
+
return "It was unpaid. Do not pay its invoice now: that payment could not be collected.";
|
|
39453
|
+
}
|
|
39454
|
+
}
|
|
39455
|
+
|
|
39456
|
+
// src/commands/wallet-submissions.ts
|
|
39457
|
+
import { createInterface as createInterface5 } from "readline";
|
|
39144
39458
|
async function walletSubmissions(opts) {
|
|
39145
39459
|
if (opts.forget !== void 0) {
|
|
39146
39460
|
await forgetSubmission(opts.forget, opts);
|
|
@@ -39239,7 +39553,7 @@ async function forgetSubmission(requestId, opts) {
|
|
|
39239
39553
|
}
|
|
39240
39554
|
refuseIfReclaimUnsaved(view, opts);
|
|
39241
39555
|
refuseIfSelfHealing(view, opts);
|
|
39242
|
-
await
|
|
39556
|
+
await confirmForget2(view, opts);
|
|
39243
39557
|
await abandonPendingSubmission({ requestId });
|
|
39244
39558
|
clearReclaimIntent(requestId);
|
|
39245
39559
|
const abandoned = view.at_risk ? view.amount_sats : 0;
|
|
@@ -39280,7 +39594,7 @@ function refuseIfSelfHealing(view, opts) {
|
|
|
39280
39594
|
`Forgetting it throws those sats away for good. Leave it alone and it resolves on its own; if you really want it gone, add --force: dvm wallet submissions --forget ${view.request_id} --yes --force`
|
|
39281
39595
|
);
|
|
39282
39596
|
}
|
|
39283
|
-
async function
|
|
39597
|
+
async function confirmForget2(view, opts) {
|
|
39284
39598
|
if (opts.yes) return;
|
|
39285
39599
|
const consequence = !view.at_risk ? `clears the journal entry for ${view.endpoint} (nothing was spent)` : view.state === "reclaimable" || view.state === "reclaim_failed" ? (
|
|
39286
39600
|
// Worth spelling out: this is the one case where forgetting *costs* the
|
|
@@ -39289,7 +39603,7 @@ async function confirmForget(view, opts) {
|
|
|
39289
39603
|
`throws away ${view.amount_sats} sats paid to ${view.endpoint} that the wallet can still reclaim by itself, so this cannot be undone`
|
|
39290
39604
|
) : view.state === "accepted_unresolved" ? `stops tracking ${view.amount_sats} sats paid to ${view.endpoint} for a call the provider accepted without a clear job ID${view.reclaim_at ? `, including the wallet's claim to take them back after ${view.reclaim_at} if the provider never redeems them` : ""}; the recorded evidence is kept, but this cannot be undone` : view.state === "unreclaimable" ? `clears ${view.amount_sats} sats paid to ${view.endpoint} that are too small to be worth taking back, so nothing recoverable is lost \u2014 but this cannot be undone` : `abandons ${view.amount_sats} sats paid to ${view.endpoint} \u2014 the proofs are locked to the provider with no refund, so this cannot be undone`;
|
|
39291
39605
|
if (opts.human && process.stdin.isTTY) {
|
|
39292
|
-
const rl =
|
|
39606
|
+
const rl = createInterface5({ input: process.stdin, output: process.stderr });
|
|
39293
39607
|
const answer = await new Promise((resolve3) => {
|
|
39294
39608
|
rl.question(
|
|
39295
39609
|
`Forgetting request ${view.request_id} ${consequence}. Type the request id to confirm: `,
|
|
@@ -40278,7 +40592,7 @@ function buildProgram() {
|
|
|
40278
40592
|
).option("--max-increment <amount>", "Max single payment (millisats or $USD)").option(
|
|
40279
40593
|
"--max-payments <n>",
|
|
40280
40594
|
"Max payments to honour per job (default: 5); 0 = free, 1 = typical, 3+ = multi-turn"
|
|
40281
|
-
).option("--output-type <mime>", "Desired output MIME type").option("--no-stream", "Submit and return immediately
|
|
40595
|
+
).option("--output-type <mime>", "Desired output MIME type").option("--no-stream", "Submit and return immediately; later asks need dvm messages <job> --wait or dvm pay <job>").option(
|
|
40282
40596
|
"--auto-pay",
|
|
40283
40597
|
"Pay without prompting, bounded by --auto-pay-below (else config autoPayThreshold, else 20% of --budget). Unnecessary when --auto-pay-below is set."
|
|
40284
40598
|
).option(
|
|
@@ -40396,8 +40710,8 @@ function buildProgram() {
|
|
|
40396
40710
|
`Choose reusable channel collateral or, only when the DVM explicitly allows its manual refund obligation, a one-shot stablecoin payment: ${creditFundingModes}. Stablecoin rails only`
|
|
40397
40711
|
).option(
|
|
40398
40712
|
"--spt <token>",
|
|
40399
|
-
"Pay by card: the shared payment token (spt_\u2026) your human approved in Stripe Link, or '-' to read it from stdin. Implies --rail stripe; without it, --rail stripe
|
|
40400
|
-
).option("--credit-id <id>", "Fund a specific credit id instead of the tracked one").option("--as <name>", "Caller signing identity to sign the funding as").option("--human", "Human-readable output instead of JSON").action((dvm, opts) => {
|
|
40713
|
+
"Pay by card: the shared payment token (spt_\u2026) your human approved in Stripe Link, or '-' to read it from stdin. Implies --rail stripe; without it, --rail stripe offers a card checkout link when supported, otherwise the link-cli approval steps"
|
|
40714
|
+
).option("--no-wait", "Print the card checkout link and exit; re-run to resume and confirm payment").option("--credit-id <id>", "Fund a specific credit id instead of the tracked one").option("--as <name>", "Caller signing identity to sign the funding as").option("--human", "Human-readable output instead of JSON").action((dvm, opts) => {
|
|
40401
40715
|
return catchErrors(() => creditFund(dvm, opts), opts.human);
|
|
40402
40716
|
});
|
|
40403
40717
|
credit.command("drain <dvm>").description(
|
|
@@ -40653,6 +40967,14 @@ Docs:
|
|
|
40653
40967
|
).option("--human", "Human-readable output instead of JSON").action((opts) => {
|
|
40654
40968
|
return catchErrors(() => walletSubmissions(opts), opts.human);
|
|
40655
40969
|
});
|
|
40970
|
+
wallet.command("forget-quote <quote-id>").description(
|
|
40971
|
+
"Stop tracking one pending funding invoice, named by its mint quote ID. Asks the mint first and refuses while the invoice is paid or its state is unknown. A payment made after forgetting cannot be collected"
|
|
40972
|
+
).option("--yes", "Skip the confirmation prompt (required to forget non-interactively)").option(
|
|
40973
|
+
"--force",
|
|
40974
|
+
"Forget a quote the mint reports as paid, or whose state could not be checked. This gives up the only record that can collect that payment"
|
|
40975
|
+
).option("--human", "Human-readable output instead of JSON").action((quoteId, opts) => {
|
|
40976
|
+
return catchErrors(() => walletForgetQuote(quoteId, opts), opts.human);
|
|
40977
|
+
});
|
|
40656
40978
|
wallet.command("recover-submission <request-id>").description(
|
|
40657
40979
|
"Recover one strict Cashu request by exact UUID and request-binding fingerprint. Holds the wallet lock and never sweeps unrelated pending state"
|
|
40658
40980
|
).requiredOption(
|