@dvmkit/dvm-cli 0.4.2 → 0.6.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/README.md +18 -0
- package/dist/{chunk-JVQFBKDX.js → chunk-3YE43JJR.js} +3 -3
- package/dist/{chunk-2TKOJBBB.js → chunk-4KINCBHL.js} +53 -51
- package/dist/{chunk-CSRGRJB6.js → chunk-EE2MREOM.js} +68 -4
- package/dist/chunk-ERJFRCJO.js +150 -0
- package/dist/chunk-FL2ICZW5.js +383 -0
- package/dist/chunk-FSYEZERJ.js +1667 -0
- package/dist/{chunk-6KEZKHN7.js → chunk-ID5G54HJ.js} +211 -35
- package/dist/{chunk-4NWEJTAW.js → chunk-MJ4X4BEW.js} +7953 -8036
- package/dist/{chunk-KBFK5MM5.js → chunk-QICJRKB7.js} +6972 -1321
- package/dist/{chunk-ECEM3ZAS.js → chunk-R55XNXAR.js} +53 -185
- package/dist/{chunk-OOA6X5MI.js → chunk-SHZMNEXE.js} +58 -17
- package/dist/{chunk-PRN4FHDY.js → chunk-TZWZTS37.js} +38 -23
- package/dist/{chunk-DRO3JP42.js → chunk-VOO5IAK7.js} +582 -83
- package/dist/{chunk-2VVVWBQA.js → chunk-WTM2EICO.js} +2 -352
- package/dist/chunk-XHOFQ3OS.js +717 -0
- package/dist/{chunk-KUBOPQ3N.js → chunk-Z4CZUMUT.js} +937 -1599
- package/dist/{client-OWIOFBKS.js → client-RYDA62DU.js} +11 -8
- package/dist/{dist-2G3QBGID.js → dist-GKCEIY2A.js} +7 -4
- package/dist/dvm.js +866 -121
- package/dist/{internal-DS42OMXR.js → internal-INUTGTXQ.js} +52 -38
- package/dist/{payout-reporter-TQ3YIFLZ-64RGUGTA.js → payout-reporter-3Y2U55ZX-CMKACKA3.js} +2 -2
- package/dist/{pocket-refill-3WMWHMOT.js → pocket-refill-K5T4LZF6.js} +18 -14
- package/dist/{revenue-reporter-VN4WYN74-T7HYTIDM.js → revenue-reporter-MAERPYGK-CCPZXGFA.js} +2 -2
- package/dist/tempo-AXTE4ZEA.js +34 -0
- package/dist/{tempo-lifecycle-TJ62A7UX-OLLWSS3I.js → tempo-lifecycle-ZBBLFBMH-HWI4PLYP.js} +11 -7
- package/dist/{tempo-wallet-RCGBBAJH-TSTQAZKT.js → tempo-wallet-B5XXV3YH-SRQBMYFV.js} +2 -2
- package/dist/{x402-S47Q77UE-33J7AIH3.js → x402-R6HPBY5D-VMSW7Z32.js} +3 -3
- package/package.json +2 -2
- package/skills/dvm/calling.md +2 -0
- package/skills/dvm/credit.md +4 -0
- package/skills/dvm/wallets.md +4 -0
|
@@ -2,175 +2,35 @@
|
|
|
2
2
|
import { createRequire as __dvmCreateRequire } from "node:module";
|
|
3
3
|
const require = __dvmCreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
|
-
Assets_exports,
|
|
6
|
-
Assets_exports2,
|
|
7
|
-
AuthorizationConfigSchema,
|
|
8
|
-
AuthorizationPayloadSchema,
|
|
9
|
-
Chains_exports,
|
|
10
|
-
ChargePayloadSchema,
|
|
11
|
-
ChargeRequestInputSchema,
|
|
12
|
-
ChargeRequestSchema,
|
|
13
|
-
ExactEip3009PayloadSchema,
|
|
14
|
-
ExactPayloadSchema,
|
|
15
|
-
ExactPermit2PayloadSchema,
|
|
16
|
-
ExactTransferSchema,
|
|
17
|
-
ExtensionSchema,
|
|
18
|
-
ExtensionsSchema,
|
|
19
|
-
Header_exports,
|
|
20
5
|
Headers,
|
|
21
|
-
MethodDetailsSchema,
|
|
22
|
-
Methods_exports,
|
|
23
|
-
PaymentPayloadSchema,
|
|
24
|
-
PaymentRequiredSchema,
|
|
25
|
-
PaymentRequirementsSchema,
|
|
26
|
-
ResourceInfoSchema,
|
|
27
|
-
SettleResponseSchema,
|
|
28
|
-
Types_exports,
|
|
29
|
-
Types_exports2,
|
|
30
|
-
VerifyResponseSchema,
|
|
31
|
-
assetTransferMethods,
|
|
32
|
-
authorizationDomain,
|
|
33
|
-
authorizationTypes,
|
|
34
|
-
challengeHash,
|
|
35
|
-
charge,
|
|
36
|
-
chargeIntent,
|
|
37
|
-
constantTimeEqual,
|
|
38
|
-
credentialTypes,
|
|
39
6
|
datetime,
|
|
40
|
-
eip3009,
|
|
41
|
-
evmNetworkPrefix,
|
|
42
|
-
evmNetworkPrefix2,
|
|
43
|
-
exactIntent,
|
|
44
7
|
literal,
|
|
45
8
|
looseObject,
|
|
46
|
-
networkOf,
|
|
47
9
|
object,
|
|
48
10
|
optional,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
paymentRequiredHeader,
|
|
52
|
-
paymentResponseHeader,
|
|
53
|
-
paymentSignatureHeader,
|
|
54
|
-
schemes,
|
|
55
|
-
string,
|
|
56
|
-
syntheticChallengeIdPrefix,
|
|
57
|
-
toPaymentRequirements,
|
|
58
|
-
toSource,
|
|
59
|
-
versions
|
|
60
|
-
} from "./chunk-2VVVWBQA.js";
|
|
11
|
+
string
|
|
12
|
+
} from "./chunk-WTM2EICO.js";
|
|
61
13
|
import {
|
|
62
14
|
Base64_exports
|
|
63
15
|
} from "./chunk-EZHT2RLJ.js";
|
|
64
16
|
import {
|
|
65
|
-
Hash_exports
|
|
66
|
-
} from "./chunk-LH3QPVN6.js";
|
|
67
|
-
import {
|
|
68
|
-
Bytes_exports,
|
|
69
17
|
Json_exports
|
|
70
18
|
} from "./chunk-F55NNH2F.js";
|
|
71
19
|
import {
|
|
72
20
|
__export
|
|
73
21
|
} from "./chunk-IYHTITNZ.js";
|
|
74
22
|
|
|
75
|
-
// node_modules/mppx/dist/BodyDigest.js
|
|
76
|
-
var BodyDigest_exports = {};
|
|
77
|
-
__export(BodyDigest_exports, {
|
|
78
|
-
compute: () => compute,
|
|
79
|
-
verify: () => verify
|
|
80
|
-
});
|
|
81
|
-
function compute(body) {
|
|
82
|
-
const str = typeof body === "object" ? JSON.stringify(body) : body;
|
|
83
|
-
const bytes = Bytes_exports.fromString(str);
|
|
84
|
-
const hash = Hash_exports.sha256(bytes, { as: "Bytes" });
|
|
85
|
-
const base64 = Base64_exports.fromBytes(hash);
|
|
86
|
-
return `sha-256=${base64}`;
|
|
87
|
-
}
|
|
88
|
-
function verify(digest, body) {
|
|
89
|
-
return constantTimeEqual(compute(body), digest);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// node_modules/mppx/dist/evm/index.js
|
|
93
|
-
var evm_exports = {};
|
|
94
|
-
__export(evm_exports, {
|
|
95
|
-
Assets: () => Assets_exports2,
|
|
96
|
-
AuthorizationConfigSchema: () => AuthorizationConfigSchema,
|
|
97
|
-
AuthorizationPayloadSchema: () => AuthorizationPayloadSchema,
|
|
98
|
-
Chains: () => Chains_exports,
|
|
99
|
-
ChargePayloadSchema: () => ChargePayloadSchema,
|
|
100
|
-
ChargeRequestInputSchema: () => ChargeRequestInputSchema,
|
|
101
|
-
ChargeRequestSchema: () => ChargeRequestSchema,
|
|
102
|
-
MethodDetailsSchema: () => MethodDetailsSchema,
|
|
103
|
-
Methods: () => Methods_exports,
|
|
104
|
-
Types: () => Types_exports2,
|
|
105
|
-
assets: () => Assets_exports2,
|
|
106
|
-
authorizationDomain: () => authorizationDomain,
|
|
107
|
-
authorizationTypes: () => authorizationTypes,
|
|
108
|
-
chains: () => Chains_exports,
|
|
109
|
-
challengeHash: () => challengeHash,
|
|
110
|
-
charge: () => charge,
|
|
111
|
-
chargeIntent: () => chargeIntent,
|
|
112
|
-
credentialTypes: () => credentialTypes,
|
|
113
|
-
eip3009: () => eip3009,
|
|
114
|
-
evmNetworkPrefix: () => evmNetworkPrefix2,
|
|
115
|
-
networkOf: () => networkOf,
|
|
116
|
-
paymentMethod: () => paymentMethod2,
|
|
117
|
-
toSource: () => toSource
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
// node_modules/mppx/dist/Receipt.js
|
|
121
|
-
var Receipt_exports = {};
|
|
122
|
-
__export(Receipt_exports, {
|
|
123
|
-
Schema: () => Schema,
|
|
124
|
-
deserialize: () => deserialize,
|
|
125
|
-
from: () => from,
|
|
126
|
-
fromResponse: () => fromResponse,
|
|
127
|
-
serialize: () => serialize
|
|
128
|
-
});
|
|
129
|
-
var shape = {
|
|
130
|
-
/** Payment method used (e.g., "tempo", "stripe"). */
|
|
131
|
-
method: string(),
|
|
132
|
-
/** Method-specific reference (e.g., transaction hash). */
|
|
133
|
-
reference: string(),
|
|
134
|
-
/** Optional external reference ID echoed from the credential payload. */
|
|
135
|
-
externalId: optional(string()),
|
|
136
|
-
/** Optional server-issued subscription identifier for recurring payments. */
|
|
137
|
-
subscriptionId: optional(string()),
|
|
138
|
-
/** Payment status. Always "success" — failures use 402 + Problem Details. */
|
|
139
|
-
status: literal("success"),
|
|
140
|
-
/** RFC 3339 settlement timestamp. */
|
|
141
|
-
timestamp: datetime()
|
|
142
|
-
};
|
|
143
|
-
var BaseSchema = object(shape);
|
|
144
|
-
var Schema = looseObject(shape);
|
|
145
|
-
function deserialize(encoded) {
|
|
146
|
-
const json = Base64_exports.toString(encoded);
|
|
147
|
-
return from(JSON.parse(json));
|
|
148
|
-
}
|
|
149
|
-
function from(parameters) {
|
|
150
|
-
return Schema.parse(parameters);
|
|
151
|
-
}
|
|
152
|
-
function serialize(receipt) {
|
|
153
|
-
const json = JSON.stringify(receipt);
|
|
154
|
-
return Base64_exports.fromString(json, { pad: false, url: true });
|
|
155
|
-
}
|
|
156
|
-
function fromResponse(response) {
|
|
157
|
-
const header = response.headers.get(Headers.paymentReceipt);
|
|
158
|
-
if (!header)
|
|
159
|
-
throw new Error(`Missing ${Headers.paymentReceipt} header.`);
|
|
160
|
-
return deserialize(header);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
23
|
// node_modules/mppx/dist/Store.js
|
|
164
24
|
var Store_exports = {};
|
|
165
25
|
__export(Store_exports, {
|
|
166
26
|
cloudflare: () => cloudflare,
|
|
167
|
-
from: () =>
|
|
27
|
+
from: () => from,
|
|
168
28
|
memory: () => memory,
|
|
169
29
|
redis: () => redis,
|
|
170
30
|
upstash: () => upstash
|
|
171
31
|
});
|
|
172
32
|
var keyPrefixCache = /* @__PURE__ */ new WeakMap();
|
|
173
|
-
function
|
|
33
|
+
function from(store, options) {
|
|
174
34
|
return withKeyPrefix(store, options?.keyPrefix);
|
|
175
35
|
}
|
|
176
36
|
function withKeyPrefix(store, keyPrefix = "") {
|
|
@@ -181,7 +41,7 @@ function withKeyPrefix(store, keyPrefix = "") {
|
|
|
181
41
|
return cached;
|
|
182
42
|
const backing = store;
|
|
183
43
|
const prefixedKey = (key) => `${keyPrefix}${key}`;
|
|
184
|
-
const prefixed =
|
|
44
|
+
const prefixed = from({
|
|
185
45
|
async get(key) {
|
|
186
46
|
return backing.get(prefixedKey(key));
|
|
187
47
|
},
|
|
@@ -218,7 +78,7 @@ function wrapJsonUpdate(update) {
|
|
|
218
78
|
};
|
|
219
79
|
}
|
|
220
80
|
function cloudflare(kv, options) {
|
|
221
|
-
return
|
|
81
|
+
return from({
|
|
222
82
|
async get(key) {
|
|
223
83
|
const raw = await kv.get(key);
|
|
224
84
|
if (raw == null)
|
|
@@ -236,7 +96,7 @@ function cloudflare(kv, options) {
|
|
|
236
96
|
}
|
|
237
97
|
function memory(options) {
|
|
238
98
|
const store = /* @__PURE__ */ new Map();
|
|
239
|
-
return
|
|
99
|
+
return from({
|
|
240
100
|
async get(key) {
|
|
241
101
|
const raw = store.get(key);
|
|
242
102
|
if (raw === void 0)
|
|
@@ -261,7 +121,7 @@ function memory(options) {
|
|
|
261
121
|
}, options);
|
|
262
122
|
}
|
|
263
123
|
function redis(client, options) {
|
|
264
|
-
return
|
|
124
|
+
return from({
|
|
265
125
|
async get(key) {
|
|
266
126
|
const raw = await client.get(key);
|
|
267
127
|
if (raw == null)
|
|
@@ -278,7 +138,7 @@ function redis(client, options) {
|
|
|
278
138
|
}, options);
|
|
279
139
|
}
|
|
280
140
|
function upstash(redis2, options) {
|
|
281
|
-
return
|
|
141
|
+
return from({
|
|
282
142
|
async get(key) {
|
|
283
143
|
return await redis2.get(key);
|
|
284
144
|
},
|
|
@@ -294,46 +154,54 @@ function upstash(redis2, options) {
|
|
|
294
154
|
}, options);
|
|
295
155
|
}
|
|
296
156
|
|
|
297
|
-
// node_modules/mppx/dist/
|
|
298
|
-
var
|
|
299
|
-
__export(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
ExtensionSchema: () => ExtensionSchema,
|
|
306
|
-
ExtensionsSchema: () => ExtensionsSchema,
|
|
307
|
-
Header: () => Header_exports,
|
|
308
|
-
PaymentPayloadSchema: () => PaymentPayloadSchema,
|
|
309
|
-
PaymentRequiredSchema: () => PaymentRequiredSchema,
|
|
310
|
-
PaymentRequirementsSchema: () => PaymentRequirementsSchema,
|
|
311
|
-
ResourceInfoSchema: () => ResourceInfoSchema,
|
|
312
|
-
SettleResponseSchema: () => SettleResponseSchema,
|
|
313
|
-
Types: () => Types_exports,
|
|
314
|
-
VerifyResponseSchema: () => VerifyResponseSchema,
|
|
315
|
-
assetTransferMethods: () => assetTransferMethods,
|
|
316
|
-
assets: () => Assets_exports,
|
|
317
|
-
evmNetworkPrefix: () => evmNetworkPrefix,
|
|
318
|
-
exactIntent: () => exactIntent,
|
|
319
|
-
paymentMethod: () => paymentMethod,
|
|
320
|
-
paymentRequiredHeader: () => paymentRequiredHeader,
|
|
321
|
-
paymentResponseHeader: () => paymentResponseHeader,
|
|
322
|
-
paymentSignatureHeader: () => paymentSignatureHeader,
|
|
323
|
-
schemes: () => schemes,
|
|
324
|
-
syntheticChallengeIdPrefix: () => syntheticChallengeIdPrefix,
|
|
325
|
-
toPaymentRequirements: () => toPaymentRequirements,
|
|
326
|
-
versions: () => versions
|
|
157
|
+
// node_modules/mppx/dist/Receipt.js
|
|
158
|
+
var Receipt_exports = {};
|
|
159
|
+
__export(Receipt_exports, {
|
|
160
|
+
Schema: () => Schema,
|
|
161
|
+
deserialize: () => deserialize,
|
|
162
|
+
from: () => from2,
|
|
163
|
+
fromResponse: () => fromResponse,
|
|
164
|
+
serialize: () => serialize
|
|
327
165
|
});
|
|
166
|
+
var shape = {
|
|
167
|
+
/** Payment method used (e.g., "tempo", "stripe"). */
|
|
168
|
+
method: string(),
|
|
169
|
+
/** Method-specific reference (e.g., transaction hash). */
|
|
170
|
+
reference: string(),
|
|
171
|
+
/** Optional external reference ID echoed from the credential payload. */
|
|
172
|
+
externalId: optional(string()),
|
|
173
|
+
/** Optional server-issued subscription identifier for recurring payments. */
|
|
174
|
+
subscriptionId: optional(string()),
|
|
175
|
+
/** Payment status. Always "success" — failures use 402 + Problem Details. */
|
|
176
|
+
status: literal("success"),
|
|
177
|
+
/** RFC 3339 settlement timestamp. */
|
|
178
|
+
timestamp: datetime()
|
|
179
|
+
};
|
|
180
|
+
var BaseSchema = object(shape);
|
|
181
|
+
var Schema = looseObject(shape);
|
|
182
|
+
function deserialize(encoded) {
|
|
183
|
+
const json = Base64_exports.toString(encoded);
|
|
184
|
+
return from2(JSON.parse(json));
|
|
185
|
+
}
|
|
186
|
+
function from2(parameters) {
|
|
187
|
+
return Schema.parse(parameters);
|
|
188
|
+
}
|
|
189
|
+
function serialize(receipt) {
|
|
190
|
+
const json = JSON.stringify(receipt);
|
|
191
|
+
return Base64_exports.fromString(json, { pad: false, url: true });
|
|
192
|
+
}
|
|
193
|
+
function fromResponse(response) {
|
|
194
|
+
const header = response.headers.get(Headers.paymentReceipt);
|
|
195
|
+
if (!header)
|
|
196
|
+
throw new Error(`Missing ${Headers.paymentReceipt} header.`);
|
|
197
|
+
return deserialize(header);
|
|
198
|
+
}
|
|
328
199
|
|
|
329
200
|
export {
|
|
330
|
-
|
|
201
|
+
from,
|
|
331
202
|
memory,
|
|
332
203
|
Store_exports,
|
|
333
|
-
|
|
204
|
+
from2,
|
|
334
205
|
serialize,
|
|
335
|
-
Receipt_exports
|
|
336
|
-
BodyDigest_exports,
|
|
337
|
-
evm_exports,
|
|
338
|
-
x402_exports
|
|
206
|
+
Receipt_exports
|
|
339
207
|
};
|
|
@@ -8,13 +8,12 @@ import {
|
|
|
8
8
|
formatUsd,
|
|
9
9
|
fundingReachableAt,
|
|
10
10
|
getLastKnownBtcRate,
|
|
11
|
-
info,
|
|
12
11
|
listCredits,
|
|
13
12
|
maxAdvertisedMicro,
|
|
14
13
|
msatsToUsdc,
|
|
15
14
|
usdcToMsats,
|
|
16
15
|
withinAdvertisedTolerance
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VOO5IAK7.js";
|
|
18
17
|
import {
|
|
19
18
|
DvmError,
|
|
20
19
|
X402_CHANNELS_FILE,
|
|
@@ -28,14 +27,13 @@ import {
|
|
|
28
27
|
resolveRpcHttpTransportOptions,
|
|
29
28
|
resolveRpcOverride,
|
|
30
29
|
updateConfig
|
|
31
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-4KINCBHL.js";
|
|
32
31
|
import {
|
|
33
32
|
__export,
|
|
34
33
|
__toESM
|
|
35
34
|
} from "./chunk-IYHTITNZ.js";
|
|
36
35
|
|
|
37
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
38
|
-
var X402_DEFAULT_FACILITATOR = "https://x402.org/facilitator";
|
|
36
|
+
// node_modules/@dvmkit/sdk/dist/chunk-RLTSCKRI.js
|
|
39
37
|
var X402_NETWORKS = [
|
|
40
38
|
{
|
|
41
39
|
caip2: "eip155:8453",
|
|
@@ -130,6 +128,9 @@ function x402SupportedNetworksHint() {
|
|
|
130
128
|
}
|
|
131
129
|
var BY_CAIP2 = new Map(X402_NETWORKS.map((n) => [n.caip2, n]));
|
|
132
130
|
var BY_SLUG = new Map(X402_NETWORKS.map((n) => [n.slug, n]));
|
|
131
|
+
|
|
132
|
+
// node_modules/@dvmkit/sdk/dist/chunk-IWQHUSMO.js
|
|
133
|
+
var X402_DEFAULT_FACILITATOR = "https://x402.org/facilitator";
|
|
133
134
|
var X402_VERSION = 2;
|
|
134
135
|
var X402_V1_VERSION = 1;
|
|
135
136
|
var X402_DEFAULT_NETWORK = "eip155:8453";
|
|
@@ -327,8 +328,9 @@ function isOptionalRecord(value) {
|
|
|
327
328
|
return value === void 0 || value === null || isRecord(value);
|
|
328
329
|
}
|
|
329
330
|
|
|
330
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
331
|
+
// node_modules/@dvmkit/sdk/dist/chunk-LE74UEV7.js
|
|
331
332
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
333
|
+
import { writeSync } from "fs";
|
|
332
334
|
import { AsyncLocalStorage } from "async_hooks";
|
|
333
335
|
import { existsSync, readFileSync, renameSync, writeFileSync } from "fs";
|
|
334
336
|
import { randomBytes } from "crypto";
|
|
@@ -351,6 +353,39 @@ function x402WrongAssetHint(asset) {
|
|
|
351
353
|
const wrongToken = asset.confusable ? `Another dollar on ${asset.networkLabel} \u2014 ${asset.confusable}, the legacy bridged dollar, or any other stablecoin \u2014 is a different contract and will never show up here, however much of it your wallet says you hold.` : `Another dollar on ${asset.networkLabel} is a different contract and will never show up here, however much of it your wallet says you hold.`;
|
|
352
354
|
return `This rail reads only ${asset.label} (${asset.address}) on ${asset.networkLabel}. ${wrongToken} USDC on a different chain is invisible here too \u2014 this wallet reads ${asset.networkLabel} alone. If you funded the wrong one, swap it to ${asset.label} on ${asset.networkLabel}, or bridge the funds across to ${asset.networkLabel}; either way they land where this rail can spend them.`;
|
|
353
355
|
}
|
|
356
|
+
var _traceId = null;
|
|
357
|
+
function setOutputTraceId(id) {
|
|
358
|
+
_traceId = id;
|
|
359
|
+
}
|
|
360
|
+
function getOutputTraceId() {
|
|
361
|
+
return _traceId;
|
|
362
|
+
}
|
|
363
|
+
function json(data) {
|
|
364
|
+
const out = _traceId !== null && typeof data === "object" && data !== null && !Array.isArray(data) && !("trace_id" in data) ? { trace_id: _traceId, ...data } : data;
|
|
365
|
+
writeAllSync(1, JSON.stringify(out) + "\n");
|
|
366
|
+
}
|
|
367
|
+
function info(msg) {
|
|
368
|
+
writeAllSync(2, msg + "\n");
|
|
369
|
+
}
|
|
370
|
+
function raw(msg) {
|
|
371
|
+
writeAllSync(1, msg + "\n");
|
|
372
|
+
}
|
|
373
|
+
function progress(event) {
|
|
374
|
+
writeAllSync(2, JSON.stringify(event) + "\n");
|
|
375
|
+
}
|
|
376
|
+
function writeAllSync(fd, text) {
|
|
377
|
+
const buf = Buffer.from(text, "utf8");
|
|
378
|
+
let offset = 0;
|
|
379
|
+
while (offset < buf.length) {
|
|
380
|
+
try {
|
|
381
|
+
offset += writeSync(fd, buf, offset, buf.length - offset);
|
|
382
|
+
} catch (err) {
|
|
383
|
+
const code = err.code;
|
|
384
|
+
if (code === "EAGAIN" || code === "EINTR") continue;
|
|
385
|
+
throw err;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
354
389
|
async function resolveBtcUsdRate(purpose) {
|
|
355
390
|
try {
|
|
356
391
|
return { rate: await fetchBtcUsdRate(), stale: false };
|
|
@@ -871,18 +906,18 @@ function ensureX402ChannelFile() {
|
|
|
871
906
|
function loadFile() {
|
|
872
907
|
if (!existsSync(X402_CHANNELS_FILE)) return { ...EMPTY, channels: {}, pending: [], exact: [] };
|
|
873
908
|
try {
|
|
874
|
-
const
|
|
875
|
-
if (
|
|
909
|
+
const raw2 = JSON.parse(readFileSync(X402_CHANNELS_FILE, "utf8"));
|
|
910
|
+
if (raw2.version !== 1 || !raw2.channels || typeof raw2.channels !== "object" || Array.isArray(raw2.channels) || !Array.isArray(raw2.pending)) {
|
|
876
911
|
throw new Error("unsupported x402 channel store shape");
|
|
877
912
|
}
|
|
878
913
|
return {
|
|
879
914
|
version: 1,
|
|
880
|
-
channels:
|
|
881
|
-
pending:
|
|
915
|
+
channels: raw2.channels,
|
|
916
|
+
pending: raw2.pending,
|
|
882
917
|
// Tolerated rather than required, unlike its two siblings: every file
|
|
883
918
|
// written before lacks the key, and failing closed on it would
|
|
884
919
|
// read as a corrupt journal on a store that is perfectly intact.
|
|
885
|
-
exact: Array.isArray(
|
|
920
|
+
exact: Array.isArray(raw2.exact) ? raw2.exact : []
|
|
886
921
|
};
|
|
887
922
|
} catch (cause) {
|
|
888
923
|
throw new DvmError(
|
|
@@ -1270,7 +1305,7 @@ function buildNoopLoggers() {
|
|
|
1270
1305
|
};
|
|
1271
1306
|
}
|
|
1272
1307
|
|
|
1273
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
1308
|
+
// node_modules/@dvmkit/sdk/dist/chunk-PLG4XER6.js
|
|
1274
1309
|
import { createPrivateKey, randomBytes as randomBytes2 } from "crypto";
|
|
1275
1310
|
|
|
1276
1311
|
// node_modules/@x402/core/node_modules/zod/v3/external.js
|
|
@@ -1539,8 +1574,8 @@ var ZodIssueCode = util.arrayToEnum([
|
|
|
1539
1574
|
"not_finite"
|
|
1540
1575
|
]);
|
|
1541
1576
|
var quotelessJson = (obj) => {
|
|
1542
|
-
const
|
|
1543
|
-
return
|
|
1577
|
+
const json2 = JSON.stringify(obj, null, 2);
|
|
1578
|
+
return json2.replace(/"([^"]+)":/g, "$1:");
|
|
1544
1579
|
};
|
|
1545
1580
|
var ZodError = class _ZodError extends Error {
|
|
1546
1581
|
get errors() {
|
|
@@ -8761,7 +8796,7 @@ var SignJWT = class {
|
|
|
8761
8796
|
}
|
|
8762
8797
|
};
|
|
8763
8798
|
|
|
8764
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
8799
|
+
// node_modules/@dvmkit/sdk/dist/chunk-PLG4XER6.js
|
|
8765
8800
|
var AUTH_HEADER_TTL_MS = 6e4;
|
|
8766
8801
|
var AUTH_TOKEN_TTL_SECONDS = 120;
|
|
8767
8802
|
var FACILITATOR_PATHS = {
|
|
@@ -8903,7 +8938,7 @@ function isRecord2(value) {
|
|
|
8903
8938
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
8904
8939
|
}
|
|
8905
8940
|
|
|
8906
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
8941
|
+
// node_modules/@dvmkit/sdk/dist/chunk-7ZUKL4IV.js
|
|
8907
8942
|
async function verifyX402Payment(paymentHeader, config, requiredUsdcMicro, resource, btcUsdRate, exactVersions = { v1: true, v2: true }) {
|
|
8908
8943
|
return callerLoggers.x402.span(
|
|
8909
8944
|
"x402.verify_payment",
|
|
@@ -8970,7 +9005,6 @@ async function verifyX402Payment(paymentHeader, config, requiredUsdcMicro, resou
|
|
|
8970
9005
|
}
|
|
8971
9006
|
|
|
8972
9007
|
export {
|
|
8973
|
-
X402_DEFAULT_FACILITATOR,
|
|
8974
9008
|
X402_NETWORKS,
|
|
8975
9009
|
x402NetworkByCaip2,
|
|
8976
9010
|
x402NetworkBySlug,
|
|
@@ -8978,6 +9012,7 @@ export {
|
|
|
8978
9012
|
x402NetworkListForCopy,
|
|
8979
9013
|
assertSupportedX402Network,
|
|
8980
9014
|
x402SupportedNetworksHint,
|
|
9015
|
+
X402_DEFAULT_FACILITATOR,
|
|
8981
9016
|
X402_VERSION,
|
|
8982
9017
|
X402_V1_VERSION,
|
|
8983
9018
|
X402_DEFAULT_NETWORK,
|
|
@@ -9001,6 +9036,12 @@ export {
|
|
|
9001
9036
|
encodeSettleResponseHeader,
|
|
9002
9037
|
resolveX402Asset,
|
|
9003
9038
|
x402WrongAssetHint,
|
|
9039
|
+
setOutputTraceId,
|
|
9040
|
+
getOutputTraceId,
|
|
9041
|
+
json,
|
|
9042
|
+
info,
|
|
9043
|
+
raw,
|
|
9044
|
+
progress,
|
|
9004
9045
|
resolveBtcUsdRate,
|
|
9005
9046
|
tryResolveBtcUsdRate,
|
|
9006
9047
|
staleRateNotice,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createRequire as __dvmCreateRequire } from "node:module";
|
|
3
3
|
const require = __dvmCreateRequire(import.meta.url);
|
|
4
4
|
|
|
5
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
5
|
+
// node_modules/@dvmkit/sdk/dist/chunk-ETXDTUJO.js
|
|
6
6
|
import { isIP } from "net";
|
|
7
7
|
var diagnostic_catalogue_v1_default = {
|
|
8
8
|
version: 1,
|
|
@@ -1004,7 +1004,9 @@ var diagnostic_catalogue_v1_default = {
|
|
|
1004
1004
|
};
|
|
1005
1005
|
var DIAGNOSTIC_CATALOGUE_VERSION = diagnostic_catalogue_v1_default.version;
|
|
1006
1006
|
var EVENTS = new Set(diagnostic_catalogue_v1_default.events);
|
|
1007
|
-
var ROUTE_TEMPLATES =
|
|
1007
|
+
var ROUTE_TEMPLATES = [...diagnostic_catalogue_v1_default.routeTemplates].sort(
|
|
1008
|
+
compareRouteTemplates
|
|
1009
|
+
);
|
|
1008
1010
|
var ERROR_CODES = new Set(diagnostic_catalogue_v1_default.errorCodes);
|
|
1009
1011
|
var DATASETS = new Set(diagnostic_catalogue_v1_default.datasets);
|
|
1010
1012
|
var LEVELS = new Set(diagnostic_catalogue_v1_default.levels);
|
|
@@ -1036,6 +1038,7 @@ var CLIENT_VERSION_RE = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-rc\.
|
|
|
1036
1038
|
var HASH_RE = /^(?:[0-9a-f]{16}|[0-9a-f]{64})$/i;
|
|
1037
1039
|
var DECIMAL_RE = /^(?:0|[1-9]\d{0,77})$/;
|
|
1038
1040
|
var STRIPE_EVENT_RE = /^evt_[A-Za-z0-9]{1,64}$/;
|
|
1041
|
+
var REDACTED_SEGMENT_RE = /^:(?:uuid|hex|n|b58|token)$/;
|
|
1039
1042
|
var SERVICE_NAMES = /* @__PURE__ */ new Set([
|
|
1040
1043
|
"platform-api",
|
|
1041
1044
|
"router",
|
|
@@ -1212,8 +1215,9 @@ function projectField(key, value, dataset, authority, identityAuthority) {
|
|
|
1212
1215
|
if (CLIENT_VERSION_FIELDS.has(key)) return projectClientVersion(value);
|
|
1213
1216
|
if (key === "client.protocol_version")
|
|
1214
1217
|
return typeof value === "number" && CLIENT_PROTOCOL_VERSIONS.has(value) ? value : void 0;
|
|
1215
|
-
if (key === "route"
|
|
1216
|
-
|
|
1218
|
+
if (key === "route") return projectQualifiedRoute(value);
|
|
1219
|
+
if (key === "http.route" || key === "resource_path")
|
|
1220
|
+
return projectRouteTemplate(value);
|
|
1217
1221
|
if (key === "status_code" || key === "http.status_code") {
|
|
1218
1222
|
return Number.isInteger(value) && value >= 100 && value <= 599 ? value : void 0;
|
|
1219
1223
|
}
|
|
@@ -1290,34 +1294,45 @@ function projectOrigin(value) {
|
|
|
1290
1294
|
if (typeof value !== "string" || value.length > 2048) return void 0;
|
|
1291
1295
|
try {
|
|
1292
1296
|
const parsed = new URL(value);
|
|
1293
|
-
if (parsed.protocol !== "http:" && parsed.protocol !== "https:" || parsed.username || parsed.password)
|
|
1294
|
-
return void 0;
|
|
1295
1297
|
const hostname = parsed.hostname.toLowerCase();
|
|
1296
|
-
if (isIP(hostname) !== 0 || !isDnsName(hostname))
|
|
1298
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:" || hostname === "localhost" || isIP(hostname) !== 0 || !isDnsName(hostname)) {
|
|
1299
|
+
return void 0;
|
|
1300
|
+
}
|
|
1297
1301
|
return `${parsed.protocol}//${hostname}`;
|
|
1298
1302
|
} catch {
|
|
1299
1303
|
return void 0;
|
|
1300
1304
|
}
|
|
1301
1305
|
}
|
|
1302
|
-
function
|
|
1303
|
-
if (typeof value !== "string" || value.length >
|
|
1306
|
+
function projectQualifiedRoute(value) {
|
|
1307
|
+
if (typeof value !== "string" || value.length > 320) return void 0;
|
|
1308
|
+
const separator = value.indexOf(" ");
|
|
1309
|
+
if (separator <= 0) return void 0;
|
|
1310
|
+
const method = value.slice(0, separator);
|
|
1311
|
+
const template = projectRouteTemplate(value.slice(separator + 1));
|
|
1312
|
+
return METHODS.has(method) && template ? `${method} ${template}` : void 0;
|
|
1313
|
+
}
|
|
1314
|
+
function projectRouteTemplate(value) {
|
|
1315
|
+
if (typeof value !== "string" || value.length > 263 || !value.startsWith("/") || value.includes("?") || value.includes("#") || value.includes("@")) {
|
|
1304
1316
|
return void 0;
|
|
1305
|
-
const normalized = value.length > 1 ? value.replace(/\/+$/, "") : value;
|
|
1306
|
-
if (ROUTE_TEMPLATES.has(normalized)) return normalized;
|
|
1307
|
-
const candidateSegments = normalized.split("/");
|
|
1308
|
-
for (const template of ROUTE_TEMPLATES) {
|
|
1309
|
-
const templateSegments = template.split("/");
|
|
1310
|
-
if (candidateSegments.length !== templateSegments.length) continue;
|
|
1311
|
-
if (templateSegments.every(
|
|
1312
|
-
(part, index) => part.startsWith(":") ? validRouteSegment(candidateSegments[index]) : part === candidateSegments[index]
|
|
1313
|
-
)) {
|
|
1314
|
-
return template;
|
|
1315
|
-
}
|
|
1316
1317
|
}
|
|
1317
|
-
return
|
|
1318
|
+
return ROUTE_TEMPLATES.find((template) => routeMatches(template, value));
|
|
1319
|
+
}
|
|
1320
|
+
function routeMatches(template, value) {
|
|
1321
|
+
if (template === value) return true;
|
|
1322
|
+
const expected = template.split("/");
|
|
1323
|
+
const actual = value.split("/");
|
|
1324
|
+
if (expected.length !== actual.length) return false;
|
|
1325
|
+
return expected.every((segment, index) => {
|
|
1326
|
+
if (segment.startsWith(":")) {
|
|
1327
|
+
return actual[index].length > 0 && (REDACTED_SEGMENT_RE.test(actual[index]) || !actual[index].startsWith(":"));
|
|
1328
|
+
}
|
|
1329
|
+
return segment === actual[index];
|
|
1330
|
+
});
|
|
1318
1331
|
}
|
|
1319
|
-
function
|
|
1320
|
-
|
|
1332
|
+
function compareRouteTemplates(left, right) {
|
|
1333
|
+
const leftParams = left.split("/").filter((segment) => segment.startsWith(":")).length;
|
|
1334
|
+
const rightParams = right.split("/").filter((segment) => segment.startsWith(":")).length;
|
|
1335
|
+
return leftParams - rightParams || right.length - left.length || left.localeCompare(right);
|
|
1321
1336
|
}
|
|
1322
1337
|
function isDnsName(value) {
|
|
1323
1338
|
return value.length <= 253 && value.split(".").every((label) => SLUG_RE.test(label));
|