@dvmkit/dvm-cli 0.11.2 → 0.11.3

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.
@@ -180,6 +180,7 @@ import {
180
180
  microToSats,
181
181
  msatsToMicro,
182
182
  msatsToUsd,
183
+ redactUrl,
183
184
  redactUrlsInText,
184
185
  usdToMsats,
185
186
  x402NetworkToCaip2
@@ -2672,9 +2673,31 @@ async function prepareAgentSpend(args) {
2672
2673
  totalSats: inner.submission.amount_sats,
2673
2674
  endpoint: args.endpoint,
2674
2675
  intendedLockPubkey: args.cashuP2pk.lock_pubkey,
2676
+ ...attempts.length > 0 ? { attempts: successfulSpendAttempts(attempts) } : {},
2675
2677
  ...boundContext?.binding_fingerprint ? { submissionBindingFingerprint: boundContext.binding_fingerprint } : {}
2676
2678
  };
2677
2679
  }
2680
+ function successfulSpendAttempts(attempts) {
2681
+ const messages = {
2682
+ unreachable: "Mint could not be loaded.",
2683
+ keys_unavailable: "Mint did not provide an active keyset.",
2684
+ swap_disabled: "Mint advertises swaps switched off (NUT-3 disabled).",
2685
+ fee_cap_exceeded: "Mint swap fee exceeds the approved limit.",
2686
+ insufficient_balance: "Mint balance cannot cover the price and swap fee.",
2687
+ no_eligible_mint: "Mint no longer has eligible proofs for this payment.",
2688
+ swap_rejected: "Mint swap could not be prepared or was definitely refused."
2689
+ };
2690
+ return attempts.map(({ mint, reason }) => {
2691
+ let safeMint;
2692
+ try {
2693
+ new URL(mint);
2694
+ safeMint = redactUrl(mint).replace(/\/$/u, "").slice(0, 2048);
2695
+ } catch {
2696
+ safeMint = "[invalid mint URL]";
2697
+ }
2698
+ return { mint: safeMint, reason, message: messages[reason] };
2699
+ });
2700
+ }
2678
2701
  function principalCapFailure(principalSats, maxCashuPrincipalSats) {
2679
2702
  return {
2680
2703
  error: {
package/dist/dvm.js CHANGED
@@ -132,7 +132,7 @@ import {
132
132
  withIdentityRecovery,
133
133
  withJobTokenRedaction,
134
134
  withRequestResultRecovery
135
- } from "./chunk-GD2GEACU.js";
135
+ } from "./chunk-MIYOOJRL.js";
136
136
  import {
137
137
  connectedTempoAccount,
138
138
  generateTempoKey,
@@ -23471,7 +23471,7 @@ async function settleCreditAfterJob(args) {
23471
23471
  }
23472
23472
  }
23473
23473
  if (args.allowTopup !== false) {
23474
- const refill = args.refillPocket ?? (await import("./pocket-refill-CT2QWCRI.js")).refillPocketIfLow;
23474
+ const refill = args.refillPocket ?? (await import("./pocket-refill-JYYODE6X.js")).refillPocketIfLow;
23475
23475
  await refill({ human: args.human }).catch(() => void 0);
23476
23476
  }
23477
23477
  }
@@ -26529,6 +26529,7 @@ async function payWithAgentWallet(transport, ref, envelope, jobId, deadlineMs, c
26529
26529
  mint: prepared.mint,
26530
26530
  amountSats: prepared.totalSats,
26531
26531
  requestId: prepared.requestId,
26532
+ ...prepared.attempts?.length ? { mint_attempts: prepared.attempts } : {},
26532
26533
  ...prepared.submissionBindingFingerprint ? { submissionBindingFingerprint: prepared.submissionBindingFingerprint } : {},
26533
26534
  ...takeCreditNoticeFields(),
26534
26535
  ...takeFeedbackNoticeFields(),
@@ -26554,6 +26555,7 @@ async function payWithAgentWallet(transport, ref, envelope, jobId, deadlineMs, c
26554
26555
  mint: prepared.mint,
26555
26556
  amountSats: prepared.totalSats,
26556
26557
  requestId: prepared.requestId,
26558
+ ...prepared.attempts?.length ? { mint_attempts: prepared.attempts } : {},
26557
26559
  ...prepared.submissionBindingFingerprint ? { submissionBindingFingerprint: prepared.submissionBindingFingerprint } : {}
26558
26560
  },
26559
26561
  dvmFields,
@@ -13,7 +13,7 @@ import {
13
13
  recordFloatSpend,
14
14
  resolveFundMint,
15
15
  sweepPendingMints
16
- } from "./chunk-GD2GEACU.js";
16
+ } from "./chunk-MIYOOJRL.js";
17
17
  import "./chunk-7N3HQJKE.js";
18
18
  import {
19
19
  info,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvmkit/dvm-cli",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "Command-line client and agent skill for Digital Vending Machines: pay-per-use HTTPS services AI agents can find, pay, and call with no account or API key",
5
5
  "author": "DVM Technologies Ltd",
6
6
  "keywords": [
@@ -27,6 +27,8 @@ Check the existing mapping before replacing an alias. Reuse it with `dvm request
27
27
 
28
28
  Submit once with `dvm request`, preserving the approved input and spending limits. Save the returned request and job identifiers. A long job can use `--no-stream` and be followed through its recorded job.
29
29
 
30
+ Successful upfront Cashu fallback includes optional `mint_attempts`: an array of `{ mint, reason, message }` for earlier failed candidates in the order tried. Reasons are `unreachable`, `keys_unavailable`, `swap_disabled`, `fee_cap_exceeded`, `insufficient_balance`, `no_eligible_mint`, or `swap_rejected`. Messages are bounded CLI-authored explanations, never raw dependency errors; mint URLs are redacted and limited to 2,048 characters. These observations explain why the selected `mint` was used; they do not mark the request failed or represent extra payments. The field is omitted when no candidate failed, including reserve-direct success. Attempts are temporary diagnostics and are not persisted for later status or recovery commands. Existing failure diagnostics remain unchanged.
31
+
30
32
  For long jobs, run `dvm messages <job-id> --wait` in the background (default limit `12h`, override with `--until 30m`) and act on its `next_action`; it keeps paying charges authorised by the stored policy while attached. Silent stream reads reconnect after 60 seconds by default; use `--timeout <seconds>` to change that interval.
31
33
 
32
34
  Follow the returned action: respond to a provider question only with authorized information; pay an existing job only within consent; poll when still processing. After `dvm pay <job-id>`, continue with `dvm messages <job-id>`, not a new request. If a `pay` action warns that a payment may already have been sent, run `dvm pay <job-id>` to resolve it: the command checks fresh provider history before spending. A send has a 60-second client timeout. A lost send waits 45 seconds after its failure before a replacement payment is allowed, and then only if history still shows the same unanswered charge and the job is `awaiting-input`. Inside that window, `payment_settling` gives the retry time and command; `--wait` keeps checking automatically. Concurrent payment commands are serialized per job; another payer gets `payment_settling`, and `--wait` keeps watching. A later question does not invalidate a still-pending charge. Older local records without a send timestamp skip the delay but still require the same pending charge. Recovery reads time out after 60 seconds by default; a failed or timed-out history read never authorizes a payment. If history cannot be read, retry once the provider is reachable or enter [recovery](recovery.md).