@dvmkit/dvm-cli 0.20.0 → 0.21.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 (27) hide show
  1. package/dist/{chunk-MSQJWCPT.js → chunk-7UGJALAX.js} +3 -3
  2. package/dist/{chunk-EEQPFGPM.js → chunk-BU5E7IDF.js} +2 -2
  3. package/dist/{chunk-4RINUKY4.js → chunk-CMIEPFKP.js} +8326 -27312
  4. package/dist/{chunk-ZZCYSYXR.js → chunk-EA6RU4OR.js} +10 -10
  5. package/dist/{chunk-WCX4PNEF.js → chunk-GEG2YAIB.js} +19 -1
  6. package/dist/{chunk-4S6TNP4N.js → chunk-GWISSHP6.js} +221 -24
  7. package/dist/{chunk-2B2MCZ2I.js → chunk-L3PHIA5L.js} +4 -4
  8. package/dist/{chunk-2YPUKPJN.js → chunk-M4Q3DBQO.js} +3 -3
  9. package/dist/chunk-MP63OWTD.js +27343 -0
  10. package/dist/{chunk-W4ADV3HW.js → chunk-NSHMTEFJ.js} +27 -17
  11. package/dist/{chunk-DOAMK5C6.js → chunk-QVX7KPLS.js} +2 -2
  12. package/dist/{chunk-QXXPXQLM.js → chunk-YRLRHJ6O.js} +2 -2
  13. package/dist/{client-FKYQXFBN.js → client-MJZL7XTD.js} +6 -6
  14. package/dist/dvm.js +5441 -473
  15. package/dist/{internal-EQJXMIR2.js → internal-TUEXUURQ.js} +5 -5
  16. package/dist/{lifecycle-3IBVUCTB.js → lifecycle-7PSR5CYB.js} +6 -6
  17. package/dist/{payout-reporter-5PH53T44-7IA4NGIN.js → payout-reporter-O4OLJXKQ-7N2HPPPY.js} +2 -2
  18. package/dist/{pocket-refill-M65PPCN3.js → pocket-refill-OX3WXUZ4.js} +10 -10
  19. package/dist/{revenue-reporter-4XV3OO5O-RYHS3M34.js → revenue-reporter-RMK4HFEW-7HGJQOXL.js} +2 -2
  20. package/dist/{tempo-lifecycle-Q3N5GGIQ.js → tempo-lifecycle-BOW6OFSI.js} +8 -8
  21. package/dist/{tempo-wallet-AY6R3E4Z.js → tempo-wallet-D424H37T.js} +7 -7
  22. package/dist/{wallet-J7JCMFZ2.js → wallet-CZV4TOJ3.js} +7 -7
  23. package/dist/{x402-FHHB3V4V-CM6OMLHE.js → x402-JCKCGEM3-NFTGP54F.js} +2 -2
  24. package/package.json +2 -2
  25. package/skills/dvm/SKILL.md +1 -1
  26. package/skills/dvm/calling.md +21 -3
  27. package/dist/chunk-DF2OWCRY.js +0 -11127
@@ -6,9 +6,9 @@ import {
6
6
  } from "./chunk-R2DSAZBO.js";
7
7
  import {
8
8
  diagnosticConsole
9
- } from "./chunk-WCX4PNEF.js";
9
+ } from "./chunk-GEG2YAIB.js";
10
10
 
11
- // node_modules/@dvmkit/sdk/dist/chunk-CXPSMXNH.js
11
+ // node_modules/@dvmkit/sdk/dist/chunk-T6Q7BJDK.js
12
12
  import { AsyncLocalStorage } from "async_hooks";
13
13
  var postgresRecovery = new AsyncLocalStorage();
14
14
  var queryingPool = new AsyncLocalStorage();
@@ -364,7 +364,7 @@ function truncateUtf8(value, maxBytes) {
364
364
  return result;
365
365
  }
366
366
 
367
- // node_modules/@dvmkit/sdk/dist/chunk-NEM7HABE.js
367
+ // node_modules/@dvmkit/sdk/dist/chunk-OBIP7E2U.js
368
368
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
369
369
  var x402ShutdownClaimEnvironment = new AsyncLocalStorage2();
370
370
  var x402ShutdownClaimSignal = new AsyncLocalStorage2();
@@ -440,7 +440,7 @@ function poolForX402ShutdownClaim(pool) {
440
440
  });
441
441
  }
442
442
 
443
- // node_modules/@dvmkit/sdk/dist/chunk-3WKXNGXX.js
443
+ // node_modules/@dvmkit/sdk/dist/chunk-QDCIGBGQ.js
444
444
  import { createHash, randomUUID } from "crypto";
445
445
  async function x402EarnedCeiling(channel, earnedNative) {
446
446
  let earned;
@@ -597,9 +597,11 @@ var PayoutReporter = class {
597
597
  intervalMs;
598
598
  now;
599
599
  hostedObligations;
600
+ x402Obligations;
600
601
  lastX402SnapshotAt = 0;
601
602
  x402;
602
603
  tempo;
604
+ reportsTempo = true;
603
605
  timer = null;
604
606
  warmup = null;
605
607
  constructor(opts) {
@@ -612,6 +614,7 @@ var PayoutReporter = class {
612
614
  this.intervalMs = opts.snapshotIntervalMs ?? PAYOUT_SNAPSHOT_INTERVAL_MS;
613
615
  this.now = opts.now ?? Date.now;
614
616
  this.hostedObligations = opts.hostedObligations;
617
+ this.x402Obligations = opts.hostedX402 === false ? void 0 : opts.hostedObligations;
615
618
  }
616
619
  async init() {
617
620
  if (this.ownsBatchStore && this.batches instanceof PostgresX402BatchStore) {
@@ -662,7 +665,7 @@ var PayoutReporter = class {
662
665
  for (const candidate of await this.hostedObligations.recoveryCandidates()) {
663
666
  if (!candidate.blockHash || candidate.reportId) continue;
664
667
  try {
665
- if (candidate.rail === "tempo" && (candidate.operation === "settle" || candidate.operation === "close") && candidate.deltaNative !== null && BigInt(candidate.deltaNative) > 0n) {
668
+ if (candidate.rail === "tempo" && this.reportsTempo && (candidate.operation === "settle" || candidate.operation === "close") && candidate.deltaNative !== null && BigInt(candidate.deltaNative) > 0n) {
666
669
  await this.tempoSettled({
667
670
  txHash: candidate.txHash,
668
671
  channelId: candidate.channelId,
@@ -753,6 +756,13 @@ var PayoutReporter = class {
753
756
  attachTempo(reader) {
754
757
  this.tempo = reader;
755
758
  }
759
+ /**
760
+ * Leave recovered Tempo reports to the mount that owns the host's Tempo
761
+ * state: this reporter has no recipient to attribute them to.
762
+ */
763
+ withholdTempo() {
764
+ this.reportsTempo = false;
765
+ }
756
766
  /**
757
767
  * A Tempo channel settled or closed on chain. `delta` is what this
758
768
  * transaction newly paid the recipient; a transaction that paid nothing new
@@ -952,7 +962,7 @@ var PayoutReporter = class {
952
962
  const ctx = this.x402;
953
963
  const before = ctx ? await claimedByChannel(ctx.storage) : /* @__PURE__ */ new Map();
954
964
  const results = await manager.refund(channelIds);
955
- if (ctx && this.hostedObligations) {
965
+ if (ctx && this.x402Obligations) {
956
966
  for (const result of results) {
957
967
  const original = before.get(result.channel.toLowerCase());
958
968
  if (!original) throw new Error("Hosted x402 refund lost its original channel snapshot");
@@ -983,7 +993,7 @@ var PayoutReporter = class {
983
993
  try {
984
994
  const now = this.now();
985
995
  const existing = await this.batches.get(ctx.scope);
986
- if (this.hostedObligations && !existing) {
996
+ if (this.x402Obligations && !existing) {
987
997
  throw new Error("Hosted x402 claim lost its pre-effect payout batch");
988
998
  }
989
999
  const open = existing ?? {
@@ -1001,8 +1011,8 @@ var PayoutReporter = class {
1001
1011
  open.claimedNative += claim.delta;
1002
1012
  open.voucherCount += claim.vouchers;
1003
1013
  open.claims += 1;
1004
- if (this.hostedObligations) {
1005
- const ids = (await Promise.all(claim.transactions.map((txHash) => this.hostedObligations.submittedIds(
1014
+ if (this.x402Obligations) {
1015
+ const ids = (await Promise.all(claim.transactions.map((txHash) => this.x402Obligations.submittedIds(
1006
1016
  "x402",
1007
1017
  claim.operation ?? "claim",
1008
1018
  txHash,
@@ -1016,7 +1026,7 @@ var PayoutReporter = class {
1016
1026
  await this.batches.put(open);
1017
1027
  } catch (err) {
1018
1028
  warn("payout_batch_track_failed", { scope: ctx.scope, error: message(err) });
1019
- if (this.hostedObligations) throw err;
1029
+ if (this.x402Obligations) throw err;
1020
1030
  }
1021
1031
  }
1022
1032
  async recordX402Settle(ctx, transaction) {
@@ -1031,18 +1041,18 @@ var PayoutReporter = class {
1031
1041
  warn("payout_batch_empty", { scope: ctx.scope, transaction, batchId: open.batchId });
1032
1042
  return;
1033
1043
  }
1034
- if (this.hostedObligations) {
1044
+ if (this.x402Obligations) {
1035
1045
  if (!open.obligationIds?.length) {
1036
1046
  throw new Error("Hosted x402 payout has no original claim identities");
1037
1047
  }
1038
- const settleId = await this.hostedObligations.settlementId(open.batchId, transaction);
1039
- const settled = await this.hostedObligations.observeCanonical(settleId);
1048
+ const settleId = await this.x402Obligations.settlementId(open.batchId, transaction);
1049
+ const settled = await this.x402Obligations.observeCanonical(settleId);
1040
1050
  if (BigInt(settled.deltaNative) !== open.claimedNative) {
1041
1051
  throw new Error("Hosted x402 settled amount differs from its original batch");
1042
1052
  }
1043
1053
  let claimed = 0n;
1044
1054
  for (const id of open.obligationIds) {
1045
- claimed += BigInt((await this.hostedObligations.observeCanonical(id)).deltaNative);
1055
+ claimed += BigInt((await this.x402Obligations.observeCanonical(id)).deltaNative);
1046
1056
  }
1047
1057
  if (claimed !== open.claimedNative) {
1048
1058
  throw new Error("Hosted x402 batch amount differs from finalized original claims");
@@ -1066,11 +1076,11 @@ var PayoutReporter = class {
1066
1076
  landedAt: this.now()
1067
1077
  };
1068
1078
  const closed = await this.batches.settle(ctx.scope, open.batchId, async (tx) => {
1069
- if (!this.hostedObligations) return this.enqueuePayout(payload, tx);
1079
+ if (!this.x402Obligations) return this.enqueuePayout(payload, tx);
1070
1080
  if (!this.transport.enqueueHostedPayout || !open.obligationIds?.length) {
1071
1081
  throw new Error("Hosted x402 payout lacks its original claims or durable queue");
1072
1082
  }
1073
- const settleId = await this.hostedObligations.settlementId(open.batchId, transaction);
1083
+ const settleId = await this.x402Obligations.settlementId(open.batchId, transaction);
1074
1084
  await this.transport.enqueueHostedPayout(
1075
1085
  payload,
1076
1086
  [...open.obligationIds, settleId],
@@ -1083,7 +1093,7 @@ var PayoutReporter = class {
1083
1093
  }
1084
1094
  } catch (err) {
1085
1095
  warn("payout_report_failed", { rail: "x402", kind: "batch", error: message(err) });
1086
- if (this.hostedObligations) throw err;
1096
+ if (this.x402Obligations) throw err;
1087
1097
  return;
1088
1098
  }
1089
1099
  void this.flush();
@@ -5,10 +5,10 @@ import {
5
5
  formatUsdcMicrounits,
6
6
  listX402Channels,
7
7
  readX402ChannelGuardFacts
8
- } from "./chunk-4RINUKY4.js";
8
+ } from "./chunk-CMIEPFKP.js";
9
9
  import {
10
10
  DvmError
11
- } from "./chunk-DF2OWCRY.js";
11
+ } from "./chunk-MP63OWTD.js";
12
12
 
13
13
  // src/lib/x402/lifecycle.ts
14
14
  async function assertX402WalletIdle(wallet, intent) {
@@ -12,7 +12,7 @@ import {
12
12
  isSignableExactRequirement,
13
13
  maxAdvertisedMicro,
14
14
  withinAdvertisedTolerance
15
- } from "./chunk-4RINUKY4.js";
15
+ } from "./chunk-CMIEPFKP.js";
16
16
  import {
17
17
  DvmError,
18
18
  X402_V1_VERSION,
@@ -30,7 +30,7 @@ import {
30
30
  usdcToMsats,
31
31
  x402NetworkByCaip2,
32
32
  x402NetworkToCaip2
33
- } from "./chunk-DF2OWCRY.js";
33
+ } from "./chunk-MP63OWTD.js";
34
34
 
35
35
  // src/lib/x402/client.ts
36
36
  import { randomBytes } from "crypto";
@@ -3,8 +3,8 @@ import { createRequire as __dvmCreateRequire } from "node:module";
3
3
  const require = __dvmCreateRequire(import.meta.url);
4
4
  import {
5
5
  tryX402Payment
6
- } from "./chunk-QXXPXQLM.js";
7
- import "./chunk-4RINUKY4.js";
6
+ } from "./chunk-YRLRHJ6O.js";
7
+ import "./chunk-CMIEPFKP.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-DF2OWCRY.js";
17
- import "./chunk-ZZCYSYXR.js";
18
- import "./chunk-W4ADV3HW.js";
16
+ import "./chunk-MP63OWTD.js";
17
+ import "./chunk-EA6RU4OR.js";
18
+ import "./chunk-NSHMTEFJ.js";
19
19
  import "./chunk-R2DSAZBO.js";
20
- import "./chunk-WCX4PNEF.js";
20
+ import "./chunk-GEG2YAIB.js";
21
21
  import "./chunk-EVQERRCP.js";
22
22
  import "./chunk-RA24J4QM.js";
23
23
  import "./chunk-B4WHUMZM.js";