@dvmkit/dvm-cli 0.4.1 → 0.4.2

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/dist/dvm.js CHANGED
@@ -205,8 +205,8 @@ import {
205
205
  x402FlavourForInstrument,
206
206
  x402RequiredFromError,
207
207
  x402ReservationRelease
208
- } from "./chunk-Z75N4GTG.js";
209
- import "./chunk-V2BE4E5V.js";
208
+ } from "./chunk-KBFK5MM5.js";
209
+ import "./chunk-6KEZKHN7.js";
210
210
  import {
211
211
  DvmX402ChannelStorage,
212
212
  X402_BATCH_SETTLEMENT_SCHEME,
@@ -245,9 +245,9 @@ import {
245
245
  x402PendingStale,
246
246
  x402PendingUnsettled,
247
247
  x402WrongAssetHint
248
- } from "./chunk-R4MSO2GX.js";
249
- import "./chunk-XN4YSEO6.js";
250
- import "./chunk-3SWX5BQP.js";
248
+ } from "./chunk-OOA6X5MI.js";
249
+ import "./chunk-CSRGRJB6.js";
250
+ import "./chunk-PRN4FHDY.js";
251
251
  import {
252
252
  IDENTITIES_VERSION,
253
253
  TEMPO_EXIT_KEY_MISSING_HINT,
@@ -284,7 +284,7 @@ import {
284
284
  unreachableRailHint,
285
285
  withIdentitiesLock,
286
286
  withTempoChannelLock
287
- } from "./chunk-YLWATJ7F.js";
287
+ } from "./chunk-KUBOPQ3N.js";
288
288
  import "./chunk-ECEM3ZAS.js";
289
289
  import "./chunk-4NWEJTAW.js";
290
290
  import {
@@ -350,7 +350,7 @@ import {
350
350
  settleDrainEvidence,
351
351
  usdToMsats,
352
352
  usdcToMsats
353
- } from "./chunk-VY277ROG.js";
353
+ } from "./chunk-DRO3JP42.js";
354
354
  import {
355
355
  TEMPO_MODERATO_RPC,
356
356
  connectedTempoAccount,
@@ -363,7 +363,7 @@ import {
363
363
  tempoTokenReference,
364
364
  tempoWrongAssetHint,
365
365
  tryResolveTempoAsset
366
- } from "./chunk-24VB7FR7.js";
366
+ } from "./chunk-JVQFBKDX.js";
367
367
  import {
368
368
  AGENT_MNEMONIC_FILE,
369
369
  BTC_RATE_FILE,
@@ -420,7 +420,7 @@ import {
420
420
  sha256,
421
421
  transportErrorCode,
422
422
  updateConfig
423
- } from "./chunk-SKKZ4OAA.js";
423
+ } from "./chunk-2TKOJBBB.js";
424
424
  import {
425
425
  privateKeyToAccount
426
426
  } from "./chunk-EVQERRCP.js";
@@ -9152,7 +9152,7 @@ async function handlePaymentRequest(jobId, request2, policy, transport, provider
9152
9152
  }
9153
9153
  }
9154
9154
  if ((opts?.rail === void 0 || opts.rail === "x402") && request2.x402) {
9155
- const { loadX402Wallet: loadX402Wallet2, tryX402Payment: tryX402Payment2 } = await import("./internal-OBEYRHMV.js");
9155
+ const { loadX402Wallet: loadX402Wallet2, tryX402Payment: tryX402Payment2 } = await import("./internal-DS42OMXR.js");
9156
9156
  const wallet = loadX402Wallet2();
9157
9157
  if (wallet) {
9158
9158
  let proof;
@@ -11700,13 +11700,13 @@ async function confirmRollback(stored, preview, opts) {
11700
11700
  async function withStrandingChecked(removing, commit) {
11701
11701
  const leaving = new Set(removing.map((target) => target.split(".")[0]));
11702
11702
  if (leaving.has("tempo")) {
11703
- const { assertTempoWalletIdle: assertTempoWalletIdle2 } = await import("./internal-OBEYRHMV.js");
11703
+ const { assertTempoWalletIdle: assertTempoWalletIdle2 } = await import("./internal-DS42OMXR.js");
11704
11704
  await assertTempoWalletIdle2("disconnect");
11705
11705
  }
11706
11706
  if (!leaving.has("x402")) return commit();
11707
- const { withX402ChannelLock: withX402ChannelLock2, listPendingX402Fundings: listPendingX402Fundings2, x402PendingUnsettled: x402PendingUnsettled2 } = await import("./internal-OBEYRHMV.js");
11708
- const { assertX402WalletIdle: assertX402WalletIdle2 } = await import("./internal-OBEYRHMV.js");
11709
- const { ensureAddress: ensureAddress2, loadX402Wallet: loadX402Wallet2 } = await import("./internal-OBEYRHMV.js");
11707
+ const { withX402ChannelLock: withX402ChannelLock2, listPendingX402Fundings: listPendingX402Fundings2, x402PendingUnsettled: x402PendingUnsettled2 } = await import("./internal-DS42OMXR.js");
11708
+ const { assertX402WalletIdle: assertX402WalletIdle2 } = await import("./internal-DS42OMXR.js");
11709
+ const { ensureAddress: ensureAddress2, loadX402Wallet: loadX402Wallet2 } = await import("./internal-DS42OMXR.js");
11710
11710
  return withX402ChannelLock2(async () => {
11711
11711
  const unsettled = listPendingX402Fundings2().filter((entry) => x402PendingUnsettled2(entry));
11712
11712
  if (unsettled.length > 0) {
@@ -12077,6 +12077,20 @@ function routeDisplay(h) {
12077
12077
  }
12078
12078
 
12079
12079
  // src/lib/credit-notice.ts
12080
+ function buildCreditFundingSkipped(args) {
12081
+ return {
12082
+ code: "credit_funding_skipped",
12083
+ dvm: args.dvm,
12084
+ endpoint: args.endpoint,
12085
+ ...args.skipped,
12086
+ display: `Prepaid credit not ${args.skipped.operation === "open" ? "opened" : "refilled"} at ${args.dvm}: BTC/USD rate unavailable. This request uses the ordinary per-call payment path.`,
12087
+ hint: "Retry automatic credit funding on a later request when BTC/USD pricing is available. Posture auto remains enabled."
12088
+ };
12089
+ }
12090
+ function noteCreditFundingSkipped(skipped, human) {
12091
+ info(`${skipped.display} ${skipped.hint}`);
12092
+ if (!human) pending.credit_funding_skipped = skipped;
12093
+ }
12080
12094
  function buildCreditSuggestion(args) {
12081
12095
  const { dvm, suppressed } = args;
12082
12096
  const amount = `$${formatUsd(suppressed.fundMicro / 1e6)}`;
@@ -20304,7 +20318,7 @@ async function settleCreditAfterJob(args) {
20304
20318
  }
20305
20319
  }
20306
20320
  if (args.allowTopup !== false) {
20307
- const refill = args.refillPocket ?? (await import("./pocket-refill-NXTJIVB5.js")).refillPocketIfLow;
20321
+ const refill = args.refillPocket ?? (await import("./pocket-refill-3WMWHMOT.js")).refillPocketIfLow;
20308
20322
  await refill({ human: args.human }).catch(() => void 0);
20309
20323
  }
20310
20324
  }
@@ -22135,6 +22149,16 @@ async function handleAutoPayQuotes(transport, ref, envelope, jobId, deadlineMs,
22135
22149
  };
22136
22150
  }
22137
22151
  if (plan.mode === "none" && plan.deferred) noteDeferredFunding(plan.deferred);
22152
+ if (plan.mode === "none" && plan.fundingSkipped) {
22153
+ noteCreditFundingSkipped(
22154
+ buildCreditFundingSkipped({
22155
+ dvm: identity.dvmId ?? ref.endpoint,
22156
+ endpoint: ref.endpoint,
22157
+ skipped: plan.fundingSkipped
22158
+ }),
22159
+ opts.human
22160
+ );
22161
+ }
22138
22162
  if (plan.mode === "none" && plan.suppressed) {
22139
22163
  const posture = effectiveCreditPosture(loadConfig()?.credit, ref.endpoint, attestedIdentity);
22140
22164
  const priceMicro = planRate > 0 ? msatsToMicro(chosen.priceMsats, planRate) : 0;
@@ -365,10 +365,10 @@ import {
365
365
  x402ReservationRelease,
366
366
  x402SettledShare,
367
367
  x402VoucherPendingRefusal
368
- } from "./chunk-Z75N4GTG.js";
368
+ } from "./chunk-KBFK5MM5.js";
369
369
  import {
370
370
  PayoutReporter
371
- } from "./chunk-V2BE4E5V.js";
371
+ } from "./chunk-6KEZKHN7.js";
372
372
  import {
373
373
  DvmX402ChannelStorage,
374
374
  X402_BATCH_SETTLEMENT_SCHEME,
@@ -444,11 +444,16 @@ import {
444
444
  x402PendingUnsettled,
445
445
  x402SupportedNetworksHint,
446
446
  x402WrongAssetHint
447
- } from "./chunk-R4MSO2GX.js";
447
+ } from "./chunk-OOA6X5MI.js";
448
448
  import {
449
449
  RevenueReporter
450
- } from "./chunk-XN4YSEO6.js";
451
- import "./chunk-3SWX5BQP.js";
450
+ } from "./chunk-CSRGRJB6.js";
451
+ import {
452
+ DIAGNOSTIC_CATALOGUE_VERSION,
453
+ projectDiagnosticFields,
454
+ projectEventName,
455
+ projectSpanRow
456
+ } from "./chunk-PRN4FHDY.js";
452
457
  import {
453
458
  IDENTITIES_VERSION,
454
459
  TEMPO_EXIT_KEY_MISSING_HINT,
@@ -486,7 +491,7 @@ import {
486
491
  unreachableRailHint,
487
492
  withIdentitiesLock,
488
493
  withTempoChannelLock
489
- } from "./chunk-YLWATJ7F.js";
494
+ } from "./chunk-KUBOPQ3N.js";
490
495
  import "./chunk-ECEM3ZAS.js";
491
496
  import "./chunk-4NWEJTAW.js";
492
497
  import "./chunk-BECPI5H5.js";
@@ -556,7 +561,7 @@ import {
556
561
  settleDrainEvidence,
557
562
  usdToMsats,
558
563
  usdcToMsats
559
- } from "./chunk-VY277ROG.js";
564
+ } from "./chunk-DRO3JP42.js";
560
565
  import {
561
566
  TEMPO_CHAIN_ID,
562
567
  TEMPO_MODERATO_CHAIN_ID,
@@ -572,7 +577,7 @@ import {
572
577
  tempoTokenReference,
573
578
  tempoWrongAssetHint,
574
579
  tryResolveTempoAsset
575
- } from "./chunk-24VB7FR7.js";
580
+ } from "./chunk-JVQFBKDX.js";
576
581
  import {
577
582
  AGENT_MNEMONIC_FILE,
578
583
  BTC_RATE_FILE,
@@ -622,7 +627,7 @@ import {
622
627
  rollbackConfig,
623
628
  transportErrorCode,
624
629
  updateConfig
625
- } from "./chunk-SKKZ4OAA.js";
630
+ } from "./chunk-2TKOJBBB.js";
626
631
  import "./chunk-EVQERRCP.js";
627
632
  import "./chunk-RA24J4QM.js";
628
633
  import "./chunk-CJTE5TS3.js";
@@ -655,6 +660,7 @@ export {
655
660
  DEFAULT_CREDIT_POSTURE,
656
661
  DEFAULT_LOCK_PUBKEY_GRACE_SECONDS,
657
662
  DEFAULT_RESERVE_LOCKTIME_SECONDS,
663
+ DIAGNOSTIC_CATALOGUE_VERSION,
658
664
  DbTransport,
659
665
  DvmError,
660
666
  DvmX402ChannelStorage,
@@ -1050,6 +1056,9 @@ export {
1050
1056
  processX402BatchCorrection,
1051
1057
  processX402BatchResponse,
1052
1058
  processX402BatchResponseForWallet,
1059
+ projectDiagnosticFields,
1060
+ projectEventName,
1061
+ projectSpanRow,
1053
1062
  providerMessage,
1054
1063
  providerProseSources,
1055
1064
  providerTextToString,
@@ -6,8 +6,8 @@ import {
6
6
  PAYOUT_SNAPSHOT_INTERVAL_MS,
7
7
  PayoutReporter,
8
8
  PostgresX402BatchStore
9
- } from "./chunk-V2BE4E5V.js";
10
- import "./chunk-3SWX5BQP.js";
9
+ } from "./chunk-6KEZKHN7.js";
10
+ import "./chunk-PRN4FHDY.js";
11
11
  import "./chunk-IYHTITNZ.js";
12
12
  export {
13
13
  MemoryX402BatchStore,
@@ -18,14 +18,14 @@ import {
18
18
  recordFloatSpend,
19
19
  resolveFundMint,
20
20
  sweepPendingMints
21
- } from "./chunk-Z75N4GTG.js";
22
- import "./chunk-V2BE4E5V.js";
21
+ } from "./chunk-KBFK5MM5.js";
22
+ import "./chunk-6KEZKHN7.js";
23
23
  import {
24
24
  tryResolveBtcUsdRate
25
- } from "./chunk-R4MSO2GX.js";
26
- import "./chunk-XN4YSEO6.js";
27
- import "./chunk-3SWX5BQP.js";
28
- import "./chunk-YLWATJ7F.js";
25
+ } from "./chunk-OOA6X5MI.js";
26
+ import "./chunk-CSRGRJB6.js";
27
+ import "./chunk-PRN4FHDY.js";
28
+ import "./chunk-KUBOPQ3N.js";
29
29
  import "./chunk-ECEM3ZAS.js";
30
30
  import "./chunk-4NWEJTAW.js";
31
31
  import "./chunk-BECPI5H5.js";
@@ -35,11 +35,11 @@ import "./chunk-EZHT2RLJ.js";
35
35
  import {
36
36
  formatUsd,
37
37
  info
38
- } from "./chunk-VY277ROG.js";
39
- import "./chunk-24VB7FR7.js";
38
+ } from "./chunk-DRO3JP42.js";
39
+ import "./chunk-JVQFBKDX.js";
40
40
  import {
41
41
  loadConfig
42
- } from "./chunk-SKKZ4OAA.js";
42
+ } from "./chunk-2TKOJBBB.js";
43
43
  import "./chunk-EVQERRCP.js";
44
44
  import "./chunk-RA24J4QM.js";
45
45
  import "./chunk-CJTE5TS3.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
  RevenueReporter
6
- } from "./chunk-XN4YSEO6.js";
7
- import "./chunk-3SWX5BQP.js";
6
+ } from "./chunk-CSRGRJB6.js";
7
+ import "./chunk-PRN4FHDY.js";
8
8
  import "./chunk-IYHTITNZ.js";
9
9
  export {
10
10
  RevenueReporter
@@ -3,16 +3,16 @@ import { createRequire as __dvmCreateRequire } from "node:module";
3
3
  const require = __dvmCreateRequire(import.meta.url);
4
4
  import {
5
5
  assertTempoWalletIdle
6
- } from "./chunk-YLWATJ7F.js";
6
+ } from "./chunk-KUBOPQ3N.js";
7
7
  import "./chunk-ECEM3ZAS.js";
8
8
  import "./chunk-4NWEJTAW.js";
9
9
  import "./chunk-BECPI5H5.js";
10
10
  import "./chunk-N3UJT2NJ.js";
11
11
  import "./chunk-2VVVWBQA.js";
12
12
  import "./chunk-EZHT2RLJ.js";
13
- import "./chunk-VY277ROG.js";
14
- import "./chunk-24VB7FR7.js";
15
- import "./chunk-SKKZ4OAA.js";
13
+ import "./chunk-DRO3JP42.js";
14
+ import "./chunk-JVQFBKDX.js";
15
+ import "./chunk-2TKOJBBB.js";
16
16
  import "./chunk-EVQERRCP.js";
17
17
  import "./chunk-CJTE5TS3.js";
18
18
  import "./chunk-GZWKCIYN.js";
@@ -18,8 +18,8 @@ import {
18
18
  tempoTokenReference,
19
19
  tempoWrongAssetHint,
20
20
  tryResolveTempoAsset
21
- } from "./chunk-24VB7FR7.js";
22
- import "./chunk-SKKZ4OAA.js";
21
+ } from "./chunk-JVQFBKDX.js";
22
+ import "./chunk-2TKOJBBB.js";
23
23
  import "./chunk-IYHTITNZ.js";
24
24
  export {
25
25
  TEMPO_CHAIN_ID,
@@ -37,9 +37,9 @@ import {
37
37
  x402NetworkToCaip2,
38
38
  x402SupportedNetworksHint,
39
39
  x402WrongAssetHint
40
- } from "./chunk-R4MSO2GX.js";
41
- import "./chunk-VY277ROG.js";
42
- import "./chunk-SKKZ4OAA.js";
40
+ } from "./chunk-OOA6X5MI.js";
41
+ import "./chunk-DRO3JP42.js";
42
+ import "./chunk-2TKOJBBB.js";
43
43
  import "./chunk-IYHTITNZ.js";
44
44
  export {
45
45
  X402_DEFAULT_FACILITATOR,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvmkit/dvm-cli",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "CLI for Digital Vending Machines — discover, pay, and use DVMs from the terminal",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@cashu/cashu-ts": "4.10.2",
53
- "@dvmkit/sdk": "0.1.5-rc.7",
53
+ "@dvmkit/sdk": "0.3.2-rc.10",
54
54
  "@x402/evm": "2.21.0",
55
55
  "commander": "14.0.3",
56
56
  "mppx": "0.8.15",
@@ -16,6 +16,8 @@ Use only a funding route offered by the provider and supported by the wallet. Li
16
16
 
17
17
  After funding or an automatic refill, inspect every funding result, not just the first. One command may produce more than one purchase. Report the actual completed spend and anything incomplete separately. An unknown or pending settlement must go through [recovery](recovery.md), not another funding command.
18
18
 
19
+ When `credit_funding_skipped` reports unavailable BTC/USD pricing, relay its `display` and `hint`. Automatic funding remains enabled, and this request follows the ordinary per-call payment path; the notice does not report a prepaid purchase or authorize another one.
20
+
19
21
  ## Draw and reclaim
20
22
 
21
23
  Return to [calling](calling.md) for jobs. Keep the same signing identity. If the CLI reconciles funding onto another credit ID, inspect that named balance and follow its selection guidance before the next job; do not buy again to make the balance appear.
@@ -1,66 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __dvmCreateRequire } from "node:module";
3
- const require = __dvmCreateRequire(import.meta.url);
4
-
5
- // node_modules/@dvmkit/sdk/dist/chunk-S3XAHZQY.js
6
- var SDK_INIT_ADVISORY_LOCK = 17320927;
7
- async function withSdkInitLock(db, fn) {
8
- assertPoolFitsLock(db);
9
- let holder = holders.get(db);
10
- if (holder) {
11
- holder.refs += 1;
12
- } else {
13
- holder = { refs: 1, acquired: acquire(db) };
14
- holders.set(db, holder);
15
- }
16
- let guardedFailed = false;
17
- try {
18
- await holder.acquired;
19
- return await fn();
20
- } catch (err) {
21
- guardedFailed = true;
22
- throw err;
23
- } finally {
24
- await releaseHolder(db, holder, guardedFailed);
25
- }
26
- }
27
- var holders = /* @__PURE__ */ new WeakMap();
28
- function assertPoolFitsLock(db) {
29
- const max = db.options?.max;
30
- if (max === void 0 || max >= 2) return;
31
- throw new Error(
32
- `withSdkInitLock: the SDK boot lock needs a pool that allows at least 2 connections (got max=${max}). The lock is held on one pinned client while the guarded DDL runs on another, so boot would hang forever.`
33
- );
34
- }
35
- async function acquire(db) {
36
- const client = await db.connect();
37
- try {
38
- await client.query(`SELECT pg_advisory_lock(${SDK_INIT_ADVISORY_LOCK})`);
39
- } catch (err) {
40
- client.release();
41
- throw err;
42
- }
43
- return client;
44
- }
45
- async function releaseHolder(db, holder, guardedFailed) {
46
- holder.refs -= 1;
47
- if (holder.refs > 0) return;
48
- holders.delete(db);
49
- let client;
50
- try {
51
- client = await holder.acquired;
52
- } catch {
53
- return;
54
- }
55
- try {
56
- await client.query(`SELECT pg_advisory_unlock(${SDK_INIT_ADVISORY_LOCK})`);
57
- client.release();
58
- } catch (err) {
59
- client.release(err instanceof Error ? err : new Error(String(err)));
60
- if (!guardedFailed) throw err;
61
- }
62
- }
63
-
64
- export {
65
- withSdkInitLock
66
- };