@dvmkit/dvm-cli 0.7.0-rc.3 → 0.8.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/NOTICE +1 -1
- package/README.md +35 -37
- package/dist/{chunk-2I5XAIQ4.js → chunk-4U43FVT4.js} +3 -3
- package/dist/{chunk-IERBEO4C.js → chunk-7ICHLPOY.js} +3 -3
- package/dist/{chunk-LIITTIEN.js → chunk-AGGWYE3D.js} +288 -71
- package/dist/{chunk-BHJLMVO2.js → chunk-AX6COXU3.js} +8 -7
- package/dist/{chunk-ZM5QFHEY.js → chunk-DSNUC4J7.js} +32 -5
- package/dist/{chunk-5QO3MGMH.js → chunk-EDK4X4F3.js} +4 -4
- package/dist/{chunk-3PV36227.js → chunk-HY65VFLL.js} +2 -2
- package/dist/{chunk-5VOAE2CL.js → chunk-JZPSF4C6.js} +2 -2
- package/dist/{chunk-C5XIOTRP.js → chunk-MULGWPBV.js} +2 -2
- package/dist/{chunk-EQXNDN5I.js → chunk-PKZUEXMJ.js} +2 -2
- package/dist/{chunk-6JP6ZBWW.js → chunk-QPT5KD7H.js} +29 -27
- package/dist/{chunk-7OA2XUM4.js → chunk-YJQNDNYK.js} +2 -2
- package/dist/{client-PGOH2ION.js → client-65B5WQPC.js} +6 -6
- package/dist/dvm.js +148 -59
- package/dist/{internal-VIAWW5ED.js → internal-BT3U2FFW.js} +5 -5
- package/dist/{lifecycle-VHGTNHHE.js → lifecycle-2LISVEWB.js} +6 -6
- package/dist/{payout-reporter-3UVWPGMO-WWZWXWCG.js → payout-reporter-HQSIIBFL-XHOVIA5Q.js} +2 -2
- package/dist/{pocket-refill-BHNKMENF.js → pocket-refill-K24FKUXH.js} +10 -10
- package/dist/{revenue-reporter-E56J3NZK-NZ5H27ZI.js → revenue-reporter-X52GPZ5U-JQKBYUBQ.js} +2 -2
- package/dist/{tempo-lifecycle-NDBO3V3A.js → tempo-lifecycle-L5C55URR.js} +8 -8
- package/dist/{tempo-wallet-BAU7ASWF.js → tempo-wallet-XPXR3T3E.js} +7 -7
- package/dist/{wallet-RB2RPWIN.js → wallet-2XALZRFL.js} +7 -7
- package/dist/{x402-BN26TQZ6-4MWLNZGT.js → x402-Q4S36NHQ-KWEN7KSE.js} +2 -2
- package/package.json +18 -4
package/dist/dvm.js
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
assertTempoWalletIdle,
|
|
6
6
|
findSigningIdentityByPubkey,
|
|
7
7
|
resolveSigningIdentity
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7ICHLPOY.js";
|
|
9
9
|
import {
|
|
10
10
|
assertX402WalletIdle
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JZPSF4C6.js";
|
|
12
12
|
import {
|
|
13
13
|
DEFAULT_CREDIT_POSTURE,
|
|
14
14
|
DEFAULT_RESERVE_LOCKTIME_SECONDS,
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
unrecordedFloatBudgetWarning,
|
|
89
89
|
updateJob,
|
|
90
90
|
withAcceptedUnresolved
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-AX6COXU3.js";
|
|
92
92
|
import {
|
|
93
93
|
assertSupportedX402Network,
|
|
94
94
|
connectedX402Payer,
|
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
repinX402WalletNetwork,
|
|
98
98
|
saveX402Wallet,
|
|
99
99
|
x402NetworkLabel
|
|
100
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-4U43FVT4.js";
|
|
101
101
|
import {
|
|
102
102
|
assertValidBudget,
|
|
103
103
|
costAnchor,
|
|
@@ -116,13 +116,13 @@ import {
|
|
|
116
116
|
staleRateNotice,
|
|
117
117
|
tryResolveBtcUsdRate,
|
|
118
118
|
tryX402Payment
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-HY65VFLL.js";
|
|
120
120
|
import {
|
|
121
121
|
connectedTempoAccount,
|
|
122
122
|
generateTempoKey,
|
|
123
123
|
tempoBalanceCheckHint,
|
|
124
124
|
tempoWrongAssetHint
|
|
125
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-EDK4X4F3.js";
|
|
126
126
|
import {
|
|
127
127
|
CREDIT_POSTURES,
|
|
128
128
|
FEEDBACK_POSTURES,
|
|
@@ -139,7 +139,7 @@ import {
|
|
|
139
139
|
retireConfigBackup,
|
|
140
140
|
rollbackConfig,
|
|
141
141
|
updateConfig
|
|
142
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-YJQNDNYK.js";
|
|
143
143
|
import {
|
|
144
144
|
A,
|
|
145
145
|
AGENT_MNEMONIC_FILE,
|
|
@@ -383,7 +383,7 @@ import {
|
|
|
383
383
|
x402PendingUnsettled,
|
|
384
384
|
x402RequiredFromError,
|
|
385
385
|
x402ReservationRelease
|
|
386
|
-
} from "./chunk-
|
|
386
|
+
} from "./chunk-AGGWYE3D.js";
|
|
387
387
|
import "./chunk-JBU7RKQ3.js";
|
|
388
388
|
import "./chunk-KDNFUDOG.js";
|
|
389
389
|
import "./chunk-IUTVV6N5.js";
|
|
@@ -424,11 +424,11 @@ import {
|
|
|
424
424
|
usdToMsats,
|
|
425
425
|
usdcToMsats,
|
|
426
426
|
x402NetworkByCaip2
|
|
427
|
-
} from "./chunk-
|
|
428
|
-
import "./chunk-
|
|
429
|
-
import "./chunk-
|
|
427
|
+
} from "./chunk-QPT5KD7H.js";
|
|
428
|
+
import "./chunk-PKZUEXMJ.js";
|
|
429
|
+
import "./chunk-MULGWPBV.js";
|
|
430
430
|
import "./chunk-R2DSAZBO.js";
|
|
431
|
-
import "./chunk-
|
|
431
|
+
import "./chunk-DSNUC4J7.js";
|
|
432
432
|
import {
|
|
433
433
|
privateKeyToAccount
|
|
434
434
|
} from "./chunk-EVQERRCP.js";
|
|
@@ -10363,6 +10363,7 @@ async function correctFundAmount(entry, body) {
|
|
|
10363
10363
|
const expected = valuation.micro;
|
|
10364
10364
|
if (expected === fund.amount_micro) return { kind: "hold" };
|
|
10365
10365
|
await correctPendingFundAmount({ requestId: entry.request_id, amountMicro: expected });
|
|
10366
|
+
const { request_id: _requestId, ...rest } = data;
|
|
10366
10367
|
return {
|
|
10367
10368
|
kind: "corrected",
|
|
10368
10369
|
entry: {
|
|
@@ -10371,7 +10372,7 @@ async function correctFundAmount(entry, body) {
|
|
|
10371
10372
|
...ctx,
|
|
10372
10373
|
submit_body: {
|
|
10373
10374
|
...ctx.submit_body,
|
|
10374
|
-
data: { ...
|
|
10375
|
+
data: { ...rest, fund: { ...fund, amount_micro: expected } }
|
|
10375
10376
|
}
|
|
10376
10377
|
}
|
|
10377
10378
|
}
|
|
@@ -10972,8 +10973,8 @@ async function handlePaymentRequest(jobId, request2, policy, transport, provider
|
|
|
10972
10973
|
}
|
|
10973
10974
|
}
|
|
10974
10975
|
if ((opts?.rail === void 0 || opts.rail === "x402") && request2.x402) {
|
|
10975
|
-
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-
|
|
10976
|
-
const { tryX402Payment: tryX402Payment2 } = await import("./client-
|
|
10976
|
+
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-2XALZRFL.js");
|
|
10977
|
+
const { tryX402Payment: tryX402Payment2 } = await import("./client-65B5WQPC.js");
|
|
10977
10978
|
const wallet = loadX402Wallet2();
|
|
10978
10979
|
if (wallet) {
|
|
10979
10980
|
let proof;
|
|
@@ -13317,14 +13318,14 @@ async function confirmRollback(stored, preview, opts) {
|
|
|
13317
13318
|
async function withStrandingChecked(removing, commit) {
|
|
13318
13319
|
const leaving = new Set(removing.map((target) => target.split(".")[0]));
|
|
13319
13320
|
if (leaving.has("tempo")) {
|
|
13320
|
-
const { assertTempoWalletIdle: assertTempoWalletIdle2 } = await import("./tempo-lifecycle-
|
|
13321
|
+
const { assertTempoWalletIdle: assertTempoWalletIdle2 } = await import("./tempo-lifecycle-L5C55URR.js");
|
|
13321
13322
|
await assertTempoWalletIdle2("disconnect");
|
|
13322
13323
|
}
|
|
13323
13324
|
if (!leaving.has("x402")) return commit();
|
|
13324
|
-
const { withX402ChannelLock: withX402ChannelLock2, listPendingX402Fundings: listPendingX402Fundings2, x402PendingUnsettled: x402PendingUnsettled2 } = await import("./internal-
|
|
13325
|
-
const { assertX402WalletIdle: assertX402WalletIdle2 } = await import("./lifecycle-
|
|
13326
|
-
const { ensureAddress: ensureAddress2 } = await import("./internal-
|
|
13327
|
-
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-
|
|
13325
|
+
const { withX402ChannelLock: withX402ChannelLock2, listPendingX402Fundings: listPendingX402Fundings2, x402PendingUnsettled: x402PendingUnsettled2 } = await import("./internal-BT3U2FFW.js");
|
|
13326
|
+
const { assertX402WalletIdle: assertX402WalletIdle2 } = await import("./lifecycle-2LISVEWB.js");
|
|
13327
|
+
const { ensureAddress: ensureAddress2 } = await import("./internal-BT3U2FFW.js");
|
|
13328
|
+
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-2XALZRFL.js");
|
|
13328
13329
|
return withX402ChannelLock2(async () => {
|
|
13329
13330
|
const unsettled = listPendingX402Fundings2().filter((entry) => x402PendingUnsettled2(entry));
|
|
13330
13331
|
if (unsettled.length > 0) {
|
|
@@ -18156,8 +18157,8 @@ async function probeX402(x402, timeoutMs) {
|
|
|
18156
18157
|
let network;
|
|
18157
18158
|
let address;
|
|
18158
18159
|
try {
|
|
18159
|
-
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-
|
|
18160
|
-
const { getX402Balance, ensureAddress: ensureAddress2, usdcContractByCaip2 } = await import("./internal-
|
|
18160
|
+
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-2XALZRFL.js");
|
|
18161
|
+
const { getX402Balance, ensureAddress: ensureAddress2, usdcContractByCaip2 } = await import("./internal-BT3U2FFW.js");
|
|
18161
18162
|
const wallet = loadX402Wallet2();
|
|
18162
18163
|
if (!wallet) {
|
|
18163
18164
|
const storedKey = x402.privateKey;
|
|
@@ -18209,8 +18210,8 @@ async function probeMpp(mpp, timeoutMs) {
|
|
|
18209
18210
|
if (!mpp) return null;
|
|
18210
18211
|
if (mpp.method === "tempo") {
|
|
18211
18212
|
try {
|
|
18212
|
-
const { connectedTempoAccount: connectedTempoAccount2 } = await import("./tempo-wallet-
|
|
18213
|
-
const { getTempoUsdcBalance: getTempoUsdcBalance3, resolveTempoNetwork: resolveTempoNetwork2 } = await import("./internal-
|
|
18213
|
+
const { connectedTempoAccount: connectedTempoAccount2 } = await import("./tempo-wallet-XPXR3T3E.js");
|
|
18214
|
+
const { getTempoUsdcBalance: getTempoUsdcBalance3, resolveTempoNetwork: resolveTempoNetwork2 } = await import("./internal-BT3U2FFW.js");
|
|
18214
18215
|
const account = await connectedTempoAccount2();
|
|
18215
18216
|
if (!account) {
|
|
18216
18217
|
return {
|
|
@@ -22975,7 +22976,7 @@ async function settleCreditAfterJob(args) {
|
|
|
22975
22976
|
}
|
|
22976
22977
|
}
|
|
22977
22978
|
if (args.allowTopup !== false) {
|
|
22978
|
-
const refill = args.refillPocket ?? (await import("./pocket-refill-
|
|
22979
|
+
const refill = args.refillPocket ?? (await import("./pocket-refill-K24FKUXH.js")).refillPocketIfLow;
|
|
22979
22980
|
await refill({ human: args.human }).catch(() => void 0);
|
|
22980
22981
|
}
|
|
22981
22982
|
}
|
|
@@ -24007,6 +24008,7 @@ async function request(opts) {
|
|
|
24007
24008
|
);
|
|
24008
24009
|
let signing;
|
|
24009
24010
|
let probePlan = { mode: "none" };
|
|
24011
|
+
let drawRequestId;
|
|
24010
24012
|
if (opts.requestId && !providerInfo.auth?.includes(SIGNED_REQUEST_AUTH_ID)) {
|
|
24011
24013
|
transport.close();
|
|
24012
24014
|
throw new DvmError(
|
|
@@ -24073,7 +24075,15 @@ async function request(opts) {
|
|
|
24073
24075
|
if (probePlan.mode === "draw" && opts.requestId) {
|
|
24074
24076
|
probePlan = { ...probePlan, drawId: opts.requestId };
|
|
24075
24077
|
}
|
|
24076
|
-
|
|
24078
|
+
if (probePlan.mode === "draw" && submitCanCarryGeneratedRequestId({ opts, providerInfo, signing })) {
|
|
24079
|
+
drawRequestId = randomUUID4();
|
|
24080
|
+
}
|
|
24081
|
+
const probeData = probePlan.mode === "draw" ? {
|
|
24082
|
+
...unsignedData,
|
|
24083
|
+
credit_id: probePlan.creditId,
|
|
24084
|
+
draw_id: probePlan.drawId,
|
|
24085
|
+
...drawRequestId ? { request_id: drawRequestId } : {}
|
|
24086
|
+
} : unsignedData;
|
|
24077
24087
|
data = signDvmRequestData(signer.privkey, probeData, authDomain);
|
|
24078
24088
|
if (opts.human) info(`Signed as ${signer.pubkey}.`);
|
|
24079
24089
|
if (opts.human && probePlan.mode === "draw") {
|
|
@@ -24101,9 +24111,10 @@ async function request(opts) {
|
|
|
24101
24111
|
outputType: opts.outputType,
|
|
24102
24112
|
bidMsats: budgetMsats
|
|
24103
24113
|
});
|
|
24104
|
-
|
|
24114
|
+
let jobRequestId = opts.requestId ?? drawRequestId;
|
|
24115
|
+
if (jobRequestId) {
|
|
24105
24116
|
persistRequestIntent({
|
|
24106
|
-
requestId:
|
|
24117
|
+
requestId: jobRequestId,
|
|
24107
24118
|
transport,
|
|
24108
24119
|
envelope,
|
|
24109
24120
|
signing,
|
|
@@ -24136,11 +24147,12 @@ async function request(opts) {
|
|
|
24136
24147
|
);
|
|
24137
24148
|
} catch (err) {
|
|
24138
24149
|
if (!isIdentityFailure(err)) throw err;
|
|
24150
|
+
const publicRequestId = opts.requestId ?? envelopeRequestId(env);
|
|
24139
24151
|
throw recordIdentityFailure(err, {
|
|
24140
24152
|
endpoint,
|
|
24141
24153
|
...dvmId ? { dvmId } : {},
|
|
24142
24154
|
capability,
|
|
24143
|
-
...
|
|
24155
|
+
...publicRequestId ? { publicRequestId } : {},
|
|
24144
24156
|
...probeRailEvidence(env)
|
|
24145
24157
|
}).error;
|
|
24146
24158
|
}
|
|
@@ -24153,6 +24165,10 @@ async function request(opts) {
|
|
|
24153
24165
|
transport.close();
|
|
24154
24166
|
throw requestOutcomeUnknown(opts.requestId, err);
|
|
24155
24167
|
}
|
|
24168
|
+
if (drawRequestId && outcomeUnknownAfterSubmit(err)) {
|
|
24169
|
+
transport.close();
|
|
24170
|
+
throw requestOutcomeUnknown(drawRequestId, err);
|
|
24171
|
+
}
|
|
24156
24172
|
if (opts.creditOnly) throw err;
|
|
24157
24173
|
if (probePlan.mode !== "draw" || !signing || !(err instanceof DvmError)) throw err;
|
|
24158
24174
|
const drawPlan = probePlan;
|
|
@@ -24179,6 +24195,7 @@ async function request(opts) {
|
|
|
24179
24195
|
receipt = recovered.receipt;
|
|
24180
24196
|
envelope = recovered.envelope;
|
|
24181
24197
|
probePlan = recovered.plan;
|
|
24198
|
+
jobRequestId = recovered.requestId;
|
|
24182
24199
|
}
|
|
24183
24200
|
if (receipt.status === "payment-required") {
|
|
24184
24201
|
const quotes = receipt.quotes ?? [];
|
|
@@ -24235,7 +24252,7 @@ async function request(opts) {
|
|
|
24235
24252
|
dvmId,
|
|
24236
24253
|
feedbackClaim: receipt.feedbackClaim,
|
|
24237
24254
|
capability,
|
|
24238
|
-
requestId:
|
|
24255
|
+
requestId: jobRequestId,
|
|
24239
24256
|
status: "submitted",
|
|
24240
24257
|
submittedAt: Date.now(),
|
|
24241
24258
|
policy,
|
|
@@ -24264,7 +24281,7 @@ async function request(opts) {
|
|
|
24264
24281
|
} else {
|
|
24265
24282
|
json({
|
|
24266
24283
|
jobId: receipt.jobId,
|
|
24267
|
-
...requestIdOutputFields(
|
|
24284
|
+
...requestIdOutputFields(jobRequestId),
|
|
24268
24285
|
...transactionOutputFields(receipt),
|
|
24269
24286
|
...dvmIdentity(dvmId, capability),
|
|
24270
24287
|
// mirror `dvm quote`'s post-defaults diagnostic on the
|
|
@@ -24318,7 +24335,7 @@ async function request(opts) {
|
|
|
24318
24335
|
} else {
|
|
24319
24336
|
json({
|
|
24320
24337
|
jobId: receipt.jobId,
|
|
24321
|
-
...requestIdOutputFields(
|
|
24338
|
+
...requestIdOutputFields(jobRequestId),
|
|
24322
24339
|
...transactionOutputFields(receipt),
|
|
24323
24340
|
...dvmIdentity(dvmId, capability),
|
|
24324
24341
|
summary: receipt.summary,
|
|
@@ -24393,7 +24410,7 @@ async function request(opts) {
|
|
|
24393
24410
|
} else {
|
|
24394
24411
|
json({
|
|
24395
24412
|
jobId: receipt.jobId,
|
|
24396
|
-
...requestIdOutputFields(
|
|
24413
|
+
...requestIdOutputFields(jobRequestId),
|
|
24397
24414
|
...transactionOutputFields(receipt),
|
|
24398
24415
|
...dvmIdentity(dvmId, capability),
|
|
24399
24416
|
messages: result.messages.map(serializeMessageForOutput),
|
|
@@ -24618,9 +24635,40 @@ async function recoverDrawProbe(err, args) {
|
|
|
24618
24635
|
drawId: randomUUID4(),
|
|
24619
24636
|
...args.probePlan.source ? { source: args.probePlan.source } : {}
|
|
24620
24637
|
};
|
|
24621
|
-
const
|
|
24622
|
-
|
|
24623
|
-
|
|
24638
|
+
const requestId = submitCanCarryGeneratedRequestId({
|
|
24639
|
+
opts: args.opts,
|
|
24640
|
+
providerInfo: args.providerInfo,
|
|
24641
|
+
signing
|
|
24642
|
+
}) ? randomUUID4() : void 0;
|
|
24643
|
+
const env = reSign({
|
|
24644
|
+
credit_id: plan.creditId,
|
|
24645
|
+
draw_id: plan.drawId,
|
|
24646
|
+
...requestId ? { request_id: requestId } : {}
|
|
24647
|
+
});
|
|
24648
|
+
if (requestId) {
|
|
24649
|
+
persistRequestIntent({
|
|
24650
|
+
requestId,
|
|
24651
|
+
transport: args.transport,
|
|
24652
|
+
envelope: env,
|
|
24653
|
+
signing,
|
|
24654
|
+
endpoint: args.endpoint,
|
|
24655
|
+
identity: args.identity,
|
|
24656
|
+
policy: args.policy,
|
|
24657
|
+
opts: args.opts,
|
|
24658
|
+
providerInfo: args.providerInfo
|
|
24659
|
+
});
|
|
24660
|
+
}
|
|
24661
|
+
let receipt;
|
|
24662
|
+
try {
|
|
24663
|
+
receipt = await args.submitProbe(env);
|
|
24664
|
+
} catch (retryErr) {
|
|
24665
|
+
if (requestId && outcomeUnknownAfterSubmit(retryErr)) {
|
|
24666
|
+
args.transport.close?.();
|
|
24667
|
+
throw requestOutcomeUnknown(requestId, retryErr);
|
|
24668
|
+
}
|
|
24669
|
+
throw retryErr;
|
|
24670
|
+
}
|
|
24671
|
+
return { done: false, receipt, envelope: env, plan, ...requestId ? { requestId } : {} };
|
|
24624
24672
|
}
|
|
24625
24673
|
if (err.code === "insufficient_credit") {
|
|
24626
24674
|
if (args.probePlan.source === "implicit") {
|
|
@@ -24899,7 +24947,7 @@ async function handleAutoPayQuotes(transport, ref, envelope, jobId, deadlineMs,
|
|
|
24899
24947
|
let railOpts = opts;
|
|
24900
24948
|
let railSigning = creditCtx?.signing;
|
|
24901
24949
|
let generatedRequestId;
|
|
24902
|
-
if (railSigning &&
|
|
24950
|
+
if (plan.mode === "none" && railSigning && submitCanCarryGeneratedRequestId({ opts, providerInfo, signing: railSigning })) {
|
|
24903
24951
|
generatedRequestId = randomUUID4();
|
|
24904
24952
|
railSigning = {
|
|
24905
24953
|
...railSigning,
|
|
@@ -25142,7 +25190,7 @@ async function payWithTempo(args, credential) {
|
|
|
25142
25190
|
} else {
|
|
25143
25191
|
json({
|
|
25144
25192
|
...dvmFields,
|
|
25145
|
-
...requestIdOutputFields(opts),
|
|
25193
|
+
...requestIdOutputFields(opts.requestId),
|
|
25146
25194
|
status: "paying",
|
|
25147
25195
|
rail: "tempo",
|
|
25148
25196
|
account: account.address,
|
|
@@ -25267,7 +25315,7 @@ async function payWithTempo(args, credential) {
|
|
|
25267
25315
|
} else {
|
|
25268
25316
|
json({
|
|
25269
25317
|
jobId: effectiveJobId,
|
|
25270
|
-
...requestIdOutputFields(opts),
|
|
25318
|
+
...requestIdOutputFields(opts.requestId),
|
|
25271
25319
|
...transactionOutputFields(receipt),
|
|
25272
25320
|
...dvmFields,
|
|
25273
25321
|
summary: receipt.summary,
|
|
@@ -25297,7 +25345,7 @@ async function payWithTempo(args, credential) {
|
|
|
25297
25345
|
paymentFields: {
|
|
25298
25346
|
paidWith: "tempo",
|
|
25299
25347
|
account: account.address,
|
|
25300
|
-
...requestIdOutputFields(opts),
|
|
25348
|
+
...requestIdOutputFields(opts.requestId),
|
|
25301
25349
|
...transactionOutputFields(receipt)
|
|
25302
25350
|
},
|
|
25303
25351
|
dvmFields,
|
|
@@ -25358,8 +25406,12 @@ function persistRequestIntent(args) {
|
|
|
25358
25406
|
);
|
|
25359
25407
|
}
|
|
25360
25408
|
}
|
|
25361
|
-
function
|
|
25362
|
-
return args.
|
|
25409
|
+
function submitCanCarryGeneratedRequestId(args) {
|
|
25410
|
+
return args.opts.requestId === void 0 && args.opts.creditOnly === void 0 && args.providerInfo.requestRecovery === true && args.providerInfo.auth?.includes(SIGNED_REQUEST_AUTH_ID) === true && args.signing !== void 0;
|
|
25411
|
+
}
|
|
25412
|
+
function outcomeUnknownAfterSubmit(err) {
|
|
25413
|
+
if (isIdentityFailure(err)) return true;
|
|
25414
|
+
return err instanceof DvmError && POST_PAYMENT_UNKNOWN_CODES.has(err.code);
|
|
25363
25415
|
}
|
|
25364
25416
|
function leavesOutcomeUnknown(err) {
|
|
25365
25417
|
if (isIdentityFailure(err)) return true;
|
|
@@ -25394,8 +25446,12 @@ function probeRailEvidence(env) {
|
|
|
25394
25446
|
railCorrelation: { credit_id: creditId, ...drawId ? { draw_id: drawId } : {} }
|
|
25395
25447
|
};
|
|
25396
25448
|
}
|
|
25397
|
-
function
|
|
25398
|
-
|
|
25449
|
+
function envelopeRequestId(env) {
|
|
25450
|
+
const requestId = unsignRequestData(env.data)?.body?.request_id;
|
|
25451
|
+
return typeof requestId === "string" ? requestId : void 0;
|
|
25452
|
+
}
|
|
25453
|
+
function requestIdOutputFields(requestId) {
|
|
25454
|
+
return requestId ? { request_id: requestId } : {};
|
|
25399
25455
|
}
|
|
25400
25456
|
function normalizedLocalCorrelationId(opts) {
|
|
25401
25457
|
return opts.localCorrelationId === void 0 ? void 0 : normalizeLocalCorrelationId(opts.localCorrelationId);
|
|
@@ -25479,10 +25535,20 @@ async function tryAgentWalletPayment(transport, ref, envelope, jobId, deadlineMs
|
|
|
25479
25535
|
builderHandle = void 0;
|
|
25480
25536
|
}
|
|
25481
25537
|
const spendStartedMs = Date.now();
|
|
25482
|
-
|
|
25538
|
+
const generatedRequestId = fundPlan && submitCanCarryGeneratedRequestId({ opts, providerInfo, signing }) ? randomUUID4() : void 0;
|
|
25539
|
+
const withGeneratedRequestId = (unsigned) => generatedRequestId ? { ...unsigned, request_id: generatedRequestId } : unsigned;
|
|
25540
|
+
const perCallEnvelope = generatedRequestId && signing ? {
|
|
25541
|
+
...envelope,
|
|
25542
|
+
data: signDvmRequestData(
|
|
25543
|
+
signing.privkey,
|
|
25544
|
+
withGeneratedRequestId(signing.unsignedData),
|
|
25545
|
+
signing.domain
|
|
25546
|
+
)
|
|
25547
|
+
} : envelope;
|
|
25548
|
+
let finalEnvelope = perCallEnvelope;
|
|
25483
25549
|
const buildPrepareArgs = () => {
|
|
25484
25550
|
const activeFund = fundPlan;
|
|
25485
|
-
const fundData = activeFund && signing ? {
|
|
25551
|
+
const fundData = activeFund && signing ? withGeneratedRequestId({
|
|
25486
25552
|
...signing.unsignedData,
|
|
25487
25553
|
credit_id: activeFund.creditId,
|
|
25488
25554
|
draw_id: activeFund.drawId,
|
|
@@ -25490,7 +25556,7 @@ async function tryAgentWalletPayment(transport, ref, envelope, jobId, deadlineMs
|
|
|
25490
25556
|
amount_micro: activeFund.wireAmountMicro ?? activeFund.fundMicro,
|
|
25491
25557
|
commitment: ""
|
|
25492
25558
|
}
|
|
25493
|
-
} : null;
|
|
25559
|
+
}) : null;
|
|
25494
25560
|
const payload = envelopeToPayload(envelope);
|
|
25495
25561
|
return {
|
|
25496
25562
|
amountSats: activeFund ? activeFund.fundSats : priceSats,
|
|
@@ -25513,14 +25579,14 @@ async function tryAgentWalletPayment(transport, ref, envelope, jobId, deadlineMs
|
|
|
25513
25579
|
submit_body: { ...payload, data: fundData },
|
|
25514
25580
|
signing_pubkey: signing.pubkey,
|
|
25515
25581
|
...baseContext
|
|
25516
|
-
} : { ...resumableSubmitBody(
|
|
25582
|
+
} : { ...resumableSubmitBody(perCallEnvelope, providerInfo), ...baseContext }
|
|
25517
25583
|
};
|
|
25518
25584
|
};
|
|
25519
25585
|
let prepared = await prepareAgentSpend(buildPrepareArgs());
|
|
25520
25586
|
if ("error" in prepared && fundPlan && prepared.error.code === "insufficient_balance" && fundPlan.fundSats > priceSats) {
|
|
25521
25587
|
info("Wallet balance can't cover the credit funding \u2014 paying this job per-call.");
|
|
25522
25588
|
fundPlan = void 0;
|
|
25523
|
-
finalEnvelope =
|
|
25589
|
+
finalEnvelope = perCallEnvelope;
|
|
25524
25590
|
prepared = await prepareAgentSpend(buildPrepareArgs());
|
|
25525
25591
|
}
|
|
25526
25592
|
if ("error" in prepared) {
|
|
@@ -25550,7 +25616,7 @@ async function tryAgentWalletPayment(transport, ref, envelope, jobId, deadlineMs
|
|
|
25550
25616
|
...envelope,
|
|
25551
25617
|
data: signDvmRequestData(
|
|
25552
25618
|
signing.privkey,
|
|
25553
|
-
{
|
|
25619
|
+
withGeneratedRequestId({
|
|
25554
25620
|
...signing.unsignedData,
|
|
25555
25621
|
credit_id: fundPlan.creditId,
|
|
25556
25622
|
draw_id: fundPlan.drawId,
|
|
@@ -25558,11 +25624,24 @@ async function tryAgentWalletPayment(transport, ref, envelope, jobId, deadlineMs
|
|
|
25558
25624
|
amount_micro: fundPlan.wireAmountMicro ?? fundPlan.fundMicro,
|
|
25559
25625
|
commitment: sha256Hex(prepared.cashuToken)
|
|
25560
25626
|
}
|
|
25561
|
-
},
|
|
25627
|
+
}),
|
|
25562
25628
|
signing.domain
|
|
25563
25629
|
)
|
|
25564
25630
|
};
|
|
25565
25631
|
}
|
|
25632
|
+
if (generatedRequestId) {
|
|
25633
|
+
persistRequestIntent({
|
|
25634
|
+
requestId: generatedRequestId,
|
|
25635
|
+
transport,
|
|
25636
|
+
envelope: finalEnvelope,
|
|
25637
|
+
signing,
|
|
25638
|
+
endpoint: ref.endpoint,
|
|
25639
|
+
identity,
|
|
25640
|
+
policy,
|
|
25641
|
+
opts,
|
|
25642
|
+
providerInfo
|
|
25643
|
+
});
|
|
25644
|
+
}
|
|
25566
25645
|
if (fundPlan && signing) {
|
|
25567
25646
|
ensureProvisionalCredit({
|
|
25568
25647
|
endpoint: ref.endpoint,
|
|
@@ -25603,7 +25682,8 @@ async function tryAgentWalletPayment(transport, ref, envelope, jobId, deadlineMs
|
|
|
25603
25682
|
providerInfo,
|
|
25604
25683
|
btcRate,
|
|
25605
25684
|
fundPlan,
|
|
25606
|
-
signing
|
|
25685
|
+
signing,
|
|
25686
|
+
generatedRequestId
|
|
25607
25687
|
);
|
|
25608
25688
|
return { handled: true };
|
|
25609
25689
|
}
|
|
@@ -25675,8 +25755,9 @@ async function submitAgentWalletWithRetry(transport, ref, envelope, prepared, de
|
|
|
25675
25755
|
retryTransportFailureOnce: true
|
|
25676
25756
|
});
|
|
25677
25757
|
}
|
|
25678
|
-
async function payWithAgentWallet(transport, ref, envelope, jobId, deadlineMs, chosen, prepared, opts, identity, policy, providerInfo, btcRate = 0, fundPlan, signing) {
|
|
25758
|
+
async function payWithAgentWallet(transport, ref, envelope, jobId, deadlineMs, chosen, prepared, opts, identity, policy, providerInfo, btcRate = 0, fundPlan, signing, generatedRequestId) {
|
|
25679
25759
|
const dvmFields = dvmIdentity(identity.dvmId, identity.capability);
|
|
25760
|
+
let publicRequestId = opts.requestId ?? generatedRequestId;
|
|
25680
25761
|
info(
|
|
25681
25762
|
`Paying ${quoteAmountLabel(chosen, { anchor: false })} via agent wallet (Cashu P2PK, mint: ${prepared.mint})...`
|
|
25682
25763
|
);
|
|
@@ -25700,7 +25781,7 @@ async function payWithAgentWallet(transport, ref, envelope, jobId, deadlineMs, c
|
|
|
25700
25781
|
endpoint: ref.endpoint,
|
|
25701
25782
|
...identity.dvmId ? { dvmId: identity.dvmId } : {},
|
|
25702
25783
|
capability: identity.capability,
|
|
25703
|
-
...
|
|
25784
|
+
...publicRequestId ? { publicRequestId } : {},
|
|
25704
25785
|
cashuRequestId: prepared.requestId,
|
|
25705
25786
|
rail: "cashu",
|
|
25706
25787
|
railCorrelation: {
|
|
@@ -25715,6 +25796,9 @@ async function payWithAgentWallet(transport, ref, envelope, jobId, deadlineMs, c
|
|
|
25715
25796
|
marker: journalMarkerFor(record)
|
|
25716
25797
|
});
|
|
25717
25798
|
}
|
|
25799
|
+
if (generatedRequestId && publicRequestId) {
|
|
25800
|
+
throw requestOutcomeUnknown(publicRequestId, error);
|
|
25801
|
+
}
|
|
25718
25802
|
throw error;
|
|
25719
25803
|
}
|
|
25720
25804
|
const signedMicro = fundPlan ? fundPlan.wireAmountMicro ?? fundPlan.fundMicro : void 0;
|
|
@@ -25728,6 +25812,7 @@ async function payWithAgentWallet(transport, ref, envelope, jobId, deadlineMs, c
|
|
|
25728
25812
|
requestId: prepared.requestId,
|
|
25729
25813
|
amountMicro: expected
|
|
25730
25814
|
});
|
|
25815
|
+
if (generatedRequestId) publicRequestId = void 0;
|
|
25731
25816
|
activeEnvelope = {
|
|
25732
25817
|
...envelope,
|
|
25733
25818
|
data: signDvmRequestData(
|
|
@@ -25747,7 +25832,11 @@ async function payWithAgentWallet(transport, ref, envelope, jobId, deadlineMs, c
|
|
|
25747
25832
|
await abandonPendingSubmission({ requestId: prepared.requestId });
|
|
25748
25833
|
}
|
|
25749
25834
|
transport.close?.();
|
|
25750
|
-
|
|
25835
|
+
const spent = withSpentSpendContext(err, prepared, publicRequestId);
|
|
25836
|
+
if (generatedRequestId && publicRequestId && leavesOutcomeUnknown(spent)) {
|
|
25837
|
+
throw requestOutcomeUnknown(publicRequestId, spent);
|
|
25838
|
+
}
|
|
25839
|
+
throw spent;
|
|
25751
25840
|
}
|
|
25752
25841
|
}
|
|
25753
25842
|
if (receipt.status === "payment-required") {
|
|
@@ -25795,7 +25884,7 @@ async function payWithAgentWallet(transport, ref, envelope, jobId, deadlineMs, c
|
|
|
25795
25884
|
dvmId: identity.dvmId,
|
|
25796
25885
|
feedbackClaim: receipt.feedbackClaim,
|
|
25797
25886
|
capability: identity.capability,
|
|
25798
|
-
requestId:
|
|
25887
|
+
requestId: publicRequestId,
|
|
25799
25888
|
status: "submitted",
|
|
25800
25889
|
submittedAt: Date.now(),
|
|
25801
25890
|
policy,
|
|
@@ -25961,7 +26050,7 @@ async function payWithX402(args, proof) {
|
|
|
25961
26050
|
} else {
|
|
25962
26051
|
json({
|
|
25963
26052
|
...dvmFields,
|
|
25964
|
-
...requestIdOutputFields(opts),
|
|
26053
|
+
...requestIdOutputFields(opts.requestId),
|
|
25965
26054
|
status: "paying",
|
|
25966
26055
|
rail: "x402",
|
|
25967
26056
|
account: wallet.address,
|
|
@@ -26074,7 +26163,7 @@ async function payWithX402(args, proof) {
|
|
|
26074
26163
|
} else {
|
|
26075
26164
|
json({
|
|
26076
26165
|
jobId: effectiveJobId,
|
|
26077
|
-
...requestIdOutputFields(opts),
|
|
26166
|
+
...requestIdOutputFields(opts.requestId),
|
|
26078
26167
|
...transactionOutputFields(receipt),
|
|
26079
26168
|
...dvmFields,
|
|
26080
26169
|
summary: receipt.summary,
|
|
@@ -26104,7 +26193,7 @@ async function payWithX402(args, proof) {
|
|
|
26104
26193
|
paymentFields: {
|
|
26105
26194
|
paidWith: "x402",
|
|
26106
26195
|
account: wallet.address,
|
|
26107
|
-
...requestIdOutputFields(opts),
|
|
26196
|
+
...requestIdOutputFields(opts.requestId),
|
|
26108
26197
|
...transactionOutputFields(receipt)
|
|
26109
26198
|
},
|
|
26110
26199
|
dvmFields,
|
|
@@ -464,7 +464,7 @@ import {
|
|
|
464
464
|
x402SettledShare,
|
|
465
465
|
x402VoucherPendingState,
|
|
466
466
|
x402WalletFromConfig
|
|
467
|
-
} from "./chunk-
|
|
467
|
+
} from "./chunk-AGGWYE3D.js";
|
|
468
468
|
import "./chunk-JBU7RKQ3.js";
|
|
469
469
|
import "./chunk-KDNFUDOG.js";
|
|
470
470
|
import "./chunk-IUTVV6N5.js";
|
|
@@ -526,13 +526,13 @@ import {
|
|
|
526
526
|
x402NetworkListForCopy,
|
|
527
527
|
x402NetworkToCaip2,
|
|
528
528
|
x402SupportedNetworksHint
|
|
529
|
-
} from "./chunk-
|
|
529
|
+
} from "./chunk-QPT5KD7H.js";
|
|
530
530
|
import {
|
|
531
531
|
RevenueReporter
|
|
532
|
-
} from "./chunk-
|
|
532
|
+
} from "./chunk-PKZUEXMJ.js";
|
|
533
533
|
import {
|
|
534
534
|
PayoutReporter
|
|
535
|
-
} from "./chunk-
|
|
535
|
+
} from "./chunk-MULGWPBV.js";
|
|
536
536
|
import "./chunk-R2DSAZBO.js";
|
|
537
537
|
import {
|
|
538
538
|
DIAGNOSTIC_CATALOGUE_VERSION,
|
|
@@ -543,7 +543,7 @@ import {
|
|
|
543
543
|
projectDiagnosticFields,
|
|
544
544
|
projectEventName,
|
|
545
545
|
projectSpanRow
|
|
546
|
-
} from "./chunk-
|
|
546
|
+
} from "./chunk-DSNUC4J7.js";
|
|
547
547
|
import "./chunk-EVQERRCP.js";
|
|
548
548
|
import "./chunk-RA24J4QM.js";
|
|
549
549
|
import "./chunk-B4WHUMZM.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
|
assertX402WalletIdle
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-JZPSF4C6.js";
|
|
7
|
+
import "./chunk-AGGWYE3D.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-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-QPT5KD7H.js";
|
|
17
|
+
import "./chunk-PKZUEXMJ.js";
|
|
18
|
+
import "./chunk-MULGWPBV.js";
|
|
19
19
|
import "./chunk-R2DSAZBO.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-DSNUC4J7.js";
|
|
21
21
|
import "./chunk-EVQERRCP.js";
|
|
22
22
|
import "./chunk-RA24J4QM.js";
|
|
23
23
|
import "./chunk-B4WHUMZM.js";
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
PayoutReporter,
|
|
8
8
|
PostgresX402BatchStore,
|
|
9
9
|
x402EarnedCeiling
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MULGWPBV.js";
|
|
11
11
|
import "./chunk-R2DSAZBO.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-DSNUC4J7.js";
|
|
13
13
|
import "./chunk-IYHTITNZ.js";
|
|
14
14
|
export {
|
|
15
15
|
MemoryX402BatchStore,
|
|
@@ -13,22 +13,22 @@ import {
|
|
|
13
13
|
recordFloatSpend,
|
|
14
14
|
resolveFundMint,
|
|
15
15
|
sweepPendingMints
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-AX6COXU3.js";
|
|
17
|
+
import "./chunk-4U43FVT4.js";
|
|
18
18
|
import {
|
|
19
19
|
info,
|
|
20
20
|
tryResolveBtcUsdRate
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-HY65VFLL.js";
|
|
22
|
+
import "./chunk-EDK4X4F3.js";
|
|
23
23
|
import {
|
|
24
24
|
loadConfig
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-YJQNDNYK.js";
|
|
26
26
|
import {
|
|
27
27
|
effectiveFundingMint,
|
|
28
28
|
effectiveMints,
|
|
29
29
|
formatUsd,
|
|
30
30
|
loadAgentWallet
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-AGGWYE3D.js";
|
|
32
32
|
import "./chunk-JBU7RKQ3.js";
|
|
33
33
|
import "./chunk-KDNFUDOG.js";
|
|
34
34
|
import "./chunk-IUTVV6N5.js";
|
|
@@ -40,11 +40,11 @@ import "./chunk-PUOXBKY2.js";
|
|
|
40
40
|
import {
|
|
41
41
|
microToSats,
|
|
42
42
|
msatsToMicro
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
43
|
+
} from "./chunk-QPT5KD7H.js";
|
|
44
|
+
import "./chunk-PKZUEXMJ.js";
|
|
45
|
+
import "./chunk-MULGWPBV.js";
|
|
46
46
|
import "./chunk-R2DSAZBO.js";
|
|
47
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-DSNUC4J7.js";
|
|
48
48
|
import "./chunk-EVQERRCP.js";
|
|
49
49
|
import "./chunk-RA24J4QM.js";
|
|
50
50
|
import "./chunk-B4WHUMZM.js";
|
package/dist/{revenue-reporter-E56J3NZK-NZ5H27ZI.js → revenue-reporter-X52GPZ5U-JQKBYUBQ.js}
RENAMED
|
@@ -3,9 +3,9 @@ import { createRequire as __dvmCreateRequire } from "node:module";
|
|
|
3
3
|
const require = __dvmCreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
RevenueReporter
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PKZUEXMJ.js";
|
|
7
7
|
import "./chunk-R2DSAZBO.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-DSNUC4J7.js";
|
|
9
9
|
import "./chunk-IYHTITNZ.js";
|
|
10
10
|
export {
|
|
11
11
|
RevenueReporter
|