@dvmkit/dvm-cli 0.20.0 → 0.22.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.
- package/dist/{chunk-QXXPXQLM.js → chunk-23FGJKIX.js} +2 -2
- package/dist/{chunk-2B2MCZ2I.js → chunk-AFR5KKJX.js} +4 -4
- package/dist/{chunk-DOAMK5C6.js → chunk-AWK22TUP.js} +2 -2
- package/dist/{chunk-4RINUKY4.js → chunk-AWWLO2WW.js} +8330 -27312
- package/dist/{chunk-ZZCYSYXR.js → chunk-EA6RU4OR.js} +10 -10
- package/dist/{chunk-WCX4PNEF.js → chunk-GEG2YAIB.js} +19 -1
- package/dist/{chunk-2YPUKPJN.js → chunk-ITESN5XP.js} +3 -3
- package/dist/chunk-MP63OWTD.js +27343 -0
- package/dist/{chunk-W4ADV3HW.js → chunk-NSHMTEFJ.js} +27 -17
- package/dist/{chunk-4S6TNP4N.js → chunk-WGZ3HBST.js} +388 -92
- package/dist/{chunk-MSQJWCPT.js → chunk-X2CKIG2D.js} +3 -3
- package/dist/{chunk-EEQPFGPM.js → chunk-YSALCR5X.js} +3 -5
- package/dist/{client-FKYQXFBN.js → client-5SB2HSH5.js} +6 -6
- package/dist/dvm.js +5969 -772
- package/dist/{internal-EQJXMIR2.js → internal-EVD5WVAK.js} +5 -5
- package/dist/{lifecycle-3IBVUCTB.js → lifecycle-GR7WGYVQ.js} +6 -6
- package/dist/{payout-reporter-5PH53T44-7IA4NGIN.js → payout-reporter-O4OLJXKQ-7N2HPPPY.js} +2 -2
- package/dist/{pocket-refill-M65PPCN3.js → pocket-refill-TF7M2XCZ.js} +10 -10
- package/dist/{revenue-reporter-4XV3OO5O-RYHS3M34.js → revenue-reporter-RMK4HFEW-7HGJQOXL.js} +2 -2
- package/dist/{tempo-lifecycle-Q3N5GGIQ.js → tempo-lifecycle-7EYW5W5Z.js} +8 -8
- package/dist/{tempo-wallet-AY6R3E4Z.js → tempo-wallet-QOC3BHVE.js} +7 -7
- package/dist/{wallet-J7JCMFZ2.js → wallet-RIHHIQRK.js} +7 -7
- package/dist/{x402-FHHB3V4V-CM6OMLHE.js → x402-JCKCGEM3-NFTGP54F.js} +2 -2
- package/package.json +2 -2
- package/skills/dvm/SKILL.md +1 -1
- package/skills/dvm/calling.md +22 -4
- package/skills/dvm/credit.md +2 -0
- package/skills/dvm/wallets.md +3 -1
- 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-
|
|
9
|
+
} from "./chunk-GEG2YAIB.js";
|
|
10
10
|
|
|
11
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
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-
|
|
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-
|
|
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.
|
|
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.
|
|
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.
|
|
1005
|
-
const ids = (await Promise.all(claim.transactions.map((txHash) => this.
|
|
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.
|
|
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.
|
|
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.
|
|
1039
|
-
const settled = await this.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
1096
|
+
if (this.x402Obligations) throw err;
|
|
1087
1097
|
return;
|
|
1088
1098
|
}
|
|
1089
1099
|
void this.flush();
|