@dvmkit/dvm-cli 0.7.0 → 0.8.1
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-7674LYNL.js → chunk-AX6COXU3.js} +6 -6
- 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 +80 -28
- 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-YY55GISB.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/skills/dvm/credit.md +2 -0
|
@@ -4,7 +4,7 @@ const require = __dvmCreateRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
loadX402Wallet,
|
|
6
6
|
x402NetworkLabel
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4U43FVT4.js";
|
|
8
8
|
import {
|
|
9
9
|
costAnchor,
|
|
10
10
|
info,
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
resolveBtcUsdRate,
|
|
13
13
|
tryResolveBtcUsdRate,
|
|
14
14
|
tryX402Payment
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HY65VFLL.js";
|
|
16
16
|
import {
|
|
17
17
|
connectedTempoAccount
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-EDK4X4F3.js";
|
|
19
19
|
import {
|
|
20
20
|
isCreditPosture,
|
|
21
21
|
loadConfig
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-YJQNDNYK.js";
|
|
23
23
|
import {
|
|
24
24
|
BUDGET_FILE,
|
|
25
25
|
JOBS_FILE,
|
|
@@ -156,7 +156,7 @@ import {
|
|
|
156
156
|
x402PendingUnsettled,
|
|
157
157
|
x402RequiredFromError,
|
|
158
158
|
x402VoucherPendingState
|
|
159
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-AGGWYE3D.js";
|
|
160
160
|
import {
|
|
161
161
|
Challenge_exports,
|
|
162
162
|
Credential_exports
|
|
@@ -173,7 +173,7 @@ import {
|
|
|
173
173
|
redactUrlsInText,
|
|
174
174
|
usdToMsats,
|
|
175
175
|
x402NetworkToCaip2
|
|
176
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-QPT5KD7H.js";
|
|
177
177
|
import {
|
|
178
178
|
privateKeyToAccount
|
|
179
179
|
} from "./chunk-EVQERRCP.js";
|
|
@@ -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-DZQYQN2X.js
|
|
6
6
|
import { isIP } from "net";
|
|
7
7
|
var diagnostic_catalogue_v1_default = {
|
|
8
8
|
version: 1,
|
|
@@ -414,6 +414,7 @@ var diagnostic_catalogue_v1_default = {
|
|
|
414
414
|
"tempo_observer_health_unavailable",
|
|
415
415
|
"tempo_observer_scan_failed",
|
|
416
416
|
"tempo_refund_amount_unreported",
|
|
417
|
+
"tempo_replay_mark_failed",
|
|
417
418
|
"tempo_routine_sweep",
|
|
418
419
|
"tempo_routine_sweep_failed",
|
|
419
420
|
"tempo_session_advertised_refresh_failed",
|
|
@@ -421,6 +422,7 @@ var diagnostic_catalogue_v1_default = {
|
|
|
421
422
|
"tempo_session_close_failed",
|
|
422
423
|
"tempo_session_close_failure_reconcile_failed",
|
|
423
424
|
"tempo_session_close_recovery_failed",
|
|
425
|
+
"tempo_session_close_recovery_unmatched",
|
|
424
426
|
"tempo_session_open_refused",
|
|
425
427
|
"tempo_session_settled",
|
|
426
428
|
"tempo_session_withheld",
|
|
@@ -781,6 +783,7 @@ var diagnostic_catalogue_v1_default = {
|
|
|
781
783
|
"hardened",
|
|
782
784
|
"head_status",
|
|
783
785
|
"hint",
|
|
786
|
+
"hosting_identity_revoke_failed",
|
|
784
787
|
"ingest_concurrency",
|
|
785
788
|
"ingest_global_concurrency",
|
|
786
789
|
"ingest_ip_concurrency",
|
|
@@ -1069,6 +1072,25 @@ var diagnostic_catalogue_v1_default = {
|
|
|
1069
1072
|
"UA-14",
|
|
1070
1073
|
"UA-40",
|
|
1071
1074
|
"UA-43"
|
|
1075
|
+
],
|
|
1076
|
+
submitIdentitySources: [
|
|
1077
|
+
"header",
|
|
1078
|
+
"header_absent",
|
|
1079
|
+
"header_invalid",
|
|
1080
|
+
"not_extracted"
|
|
1081
|
+
],
|
|
1082
|
+
fundedRuntimeReclaims: [
|
|
1083
|
+
"closed"
|
|
1084
|
+
],
|
|
1085
|
+
suspensionReasons: [
|
|
1086
|
+
"request_limit",
|
|
1087
|
+
"dvm_limit",
|
|
1088
|
+
"behaviour",
|
|
1089
|
+
"free_tier_idle",
|
|
1090
|
+
"admin_org_suspend",
|
|
1091
|
+
"builder_pause",
|
|
1092
|
+
"withdrawn",
|
|
1093
|
+
"operator"
|
|
1072
1094
|
]
|
|
1073
1095
|
};
|
|
1074
1096
|
var DIAGNOSTIC_CATALOGUE_VERSION = diagnostic_catalogue_v1_default.version;
|
|
@@ -1080,6 +1102,12 @@ var PAYMENT_ENUMS = {
|
|
|
1080
1102
|
failure_stage: new Set(diagnostic_catalogue_v1_default.paymentFailureStages),
|
|
1081
1103
|
phase: new Set(diagnostic_catalogue_v1_default.paymentPhases)
|
|
1082
1104
|
};
|
|
1105
|
+
var ROUTER_ENUMS = {
|
|
1106
|
+
submit_identity_source: new Set(diagnostic_catalogue_v1_default.submitIdentitySources),
|
|
1107
|
+
funded_runtime_reclaim: new Set(diagnostic_catalogue_v1_default.fundedRuntimeReclaims),
|
|
1108
|
+
suspended_reclaim: new Set(diagnostic_catalogue_v1_default.suspensionReasons),
|
|
1109
|
+
suspended_admin: new Set(diagnostic_catalogue_v1_default.suspensionReasons)
|
|
1110
|
+
};
|
|
1083
1111
|
var EVENTS = new Set(diagnostic_catalogue_v1_default.events);
|
|
1084
1112
|
var ROUTE_TEMPLATES = [...diagnostic_catalogue_v1_default.routeTemplates].sort(
|
|
1085
1113
|
compareRouteTemplates
|
|
@@ -1120,7 +1148,6 @@ var REDACTED_SEGMENT_RE = /^:(?:uuid|hex|n|b58|token)$/;
|
|
|
1120
1148
|
var SERVICE_NAMES = /* @__PURE__ */ new Set([
|
|
1121
1149
|
"platform-api",
|
|
1122
1150
|
"router",
|
|
1123
|
-
"dvmadmin",
|
|
1124
1151
|
"admin",
|
|
1125
1152
|
"unknown"
|
|
1126
1153
|
]);
|
|
@@ -1280,9 +1307,9 @@ function projectFields(input, dataset, authority, identityAuthority) {
|
|
|
1280
1307
|
return output;
|
|
1281
1308
|
}
|
|
1282
1309
|
function projectField(key, value, dataset, authority, identityAuthority) {
|
|
1283
|
-
const
|
|
1284
|
-
if (
|
|
1285
|
-
return typeof value === "string" &&
|
|
1310
|
+
const closedEnum = Object.hasOwn(PAYMENT_ENUMS, key) ? PAYMENT_ENUMS[key] : Object.hasOwn(ROUTER_ENUMS, key) ? ROUTER_ENUMS[key] : void 0;
|
|
1311
|
+
if (closedEnum)
|
|
1312
|
+
return typeof value === "string" && closedEnum.has(value) ? value : void 0;
|
|
1286
1313
|
if (BOOLEAN_FIELDS.has(key))
|
|
1287
1314
|
return typeof value === "boolean" ? value : void 0;
|
|
1288
1315
|
if (INTEGER_FIELDS.has(key))
|
|
@@ -4,14 +4,14 @@ const require = __dvmCreateRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
loadConfig,
|
|
6
6
|
updateConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YJQNDNYK.js";
|
|
8
8
|
import {
|
|
9
9
|
tempoAccountFromConfig,
|
|
10
10
|
tryResolveTempoAsset
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-AGGWYE3D.js";
|
|
12
12
|
import {
|
|
13
13
|
DvmError
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QPT5KD7H.js";
|
|
15
15
|
|
|
16
16
|
// src/lib/payment-rails/tempo-wallet.ts
|
|
17
17
|
function tempoBalanceCheckHint(token) {
|
|
@@ -46,7 +46,7 @@ async function generateTempoKey(opts = {}) {
|
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
if (existing && opts.force) {
|
|
49
|
-
const { assertTempoWalletIdle } = await import("./tempo-lifecycle-
|
|
49
|
+
const { assertTempoWalletIdle } = await import("./tempo-lifecycle-L5C55URR.js");
|
|
50
50
|
await assertTempoWalletIdle("replace");
|
|
51
51
|
}
|
|
52
52
|
const { privateKeyToAccount, generatePrivateKey } = await import("./accounts-2WZE4N5F.js");
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
isSignableExactRequirement,
|
|
13
13
|
maxAdvertisedMicro,
|
|
14
14
|
withinAdvertisedTolerance
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-AGGWYE3D.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-
|
|
33
|
+
} from "./chunk-QPT5KD7H.js";
|
|
34
34
|
|
|
35
35
|
// src/lib/x402/client.ts
|
|
36
36
|
import { randomBytes } from "crypto";
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
formatUsdcMicrounits,
|
|
6
6
|
listX402Channels,
|
|
7
7
|
readX402ChannelGuardFacts
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AGGWYE3D.js";
|
|
9
9
|
import {
|
|
10
10
|
DvmError
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QPT5KD7H.js";
|
|
12
12
|
|
|
13
13
|
// src/lib/x402/lifecycle.ts
|
|
14
14
|
async function assertX402WalletIdle(wallet, intent) {
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
} from "./chunk-R2DSAZBO.js";
|
|
7
7
|
import {
|
|
8
8
|
diagnosticConsole
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DSNUC4J7.js";
|
|
10
10
|
|
|
11
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
11
|
+
// node_modules/@dvmkit/sdk/dist/chunk-X3JEME6P.js
|
|
12
12
|
import { createHash, randomUUID } from "crypto";
|
|
13
13
|
async function x402EarnedCeiling(channel, earnedNative) {
|
|
14
14
|
let earned;
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
} from "./chunk-R2DSAZBO.js";
|
|
7
7
|
import {
|
|
8
8
|
diagnosticConsole
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DSNUC4J7.js";
|
|
10
10
|
|
|
11
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
11
|
+
// node_modules/@dvmkit/sdk/dist/chunk-PRSKC7AD.js
|
|
12
12
|
import { randomUUID } from "crypto";
|
|
13
13
|
var ENDPOINTS = {
|
|
14
14
|
job_terminal: "/_internal/job-terminal",
|
|
@@ -3,7 +3,7 @@ import { createRequire as __dvmCreateRequire } from "node:module";
|
|
|
3
3
|
const require = __dvmCreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
diagnosticConsole
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DSNUC4J7.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
9
|
} from "./chunk-IYHTITNZ.js";
|
|
@@ -411,7 +411,7 @@ function resolveRpcHttpTransportOptions(source, envValue) {
|
|
|
411
411
|
return { fetchOptions: { headers } };
|
|
412
412
|
}
|
|
413
413
|
|
|
414
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
414
|
+
// node_modules/@dvmkit/sdk/dist/chunk-FUJ36YDV.js
|
|
415
415
|
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
416
416
|
var LONG_HEX_RE = /^[0-9a-f]{16,}$/i;
|
|
417
417
|
var NUMERIC_RE = /^\d{4,}$/;
|
|
@@ -457,25 +457,6 @@ function isOpaqueToken(segment) {
|
|
|
457
457
|
}
|
|
458
458
|
return false;
|
|
459
459
|
}
|
|
460
|
-
var callerLoggers = buildNoopLoggers();
|
|
461
|
-
function initCallerLoggers(nextLoggers) {
|
|
462
|
-
callerLoggers = nextLoggers;
|
|
463
|
-
}
|
|
464
|
-
function buildNoopLoggers() {
|
|
465
|
-
const noopLogger = {
|
|
466
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function -- standalone caller has no exporter
|
|
467
|
-
info() {
|
|
468
|
-
},
|
|
469
|
-
async span(_name, _attrs, fn) {
|
|
470
|
-
return fn();
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
return {
|
|
474
|
-
cashu: noopLogger,
|
|
475
|
-
lightning: noopLogger,
|
|
476
|
-
x402: noopLogger
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
460
|
|
|
480
461
|
// node_modules/@noble/hashes/utils.js
|
|
481
462
|
function isBytes(a) {
|
|
@@ -3011,7 +2992,7 @@ var schnorr = /* @__PURE__ */ (() => {
|
|
|
3011
2992
|
};
|
|
3012
2993
|
})();
|
|
3013
2994
|
|
|
3014
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
2995
|
+
// node_modules/@dvmkit/sdk/dist/chunk-WMGXJQI3.js
|
|
3015
2996
|
function resolveX402Asset(network = X402_DEFAULT_NETWORK) {
|
|
3016
2997
|
const spec = x402NetworkByCaip2(network);
|
|
3017
2998
|
if (!spec) return null;
|
|
@@ -3103,7 +3084,28 @@ async function getX402Balance(wallet) {
|
|
|
3103
3084
|
}
|
|
3104
3085
|
}
|
|
3105
3086
|
|
|
3106
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
3087
|
+
// node_modules/@dvmkit/sdk/dist/chunk-66HGCPBU.js
|
|
3088
|
+
var callerLoggers = buildNoopLoggers();
|
|
3089
|
+
function initCallerLoggers(nextLoggers) {
|
|
3090
|
+
callerLoggers = nextLoggers;
|
|
3091
|
+
}
|
|
3092
|
+
function buildNoopLoggers() {
|
|
3093
|
+
const noopLogger = {
|
|
3094
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function -- standalone caller has no exporter
|
|
3095
|
+
info() {
|
|
3096
|
+
},
|
|
3097
|
+
async span(_name, _attrs, fn) {
|
|
3098
|
+
return fn();
|
|
3099
|
+
}
|
|
3100
|
+
};
|
|
3101
|
+
return {
|
|
3102
|
+
cashu: noopLogger,
|
|
3103
|
+
lightning: noopLogger,
|
|
3104
|
+
x402: noopLogger
|
|
3105
|
+
};
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
// node_modules/@dvmkit/sdk/dist/chunk-ATXDKX6F.js
|
|
3107
3109
|
import { AsyncLocalStorage } from "async_hooks";
|
|
3108
3110
|
import { createPrivateKey, randomBytes as randomBytes2 } from "crypto";
|
|
3109
3111
|
|
|
@@ -10595,7 +10597,7 @@ var SignJWT = class {
|
|
|
10595
10597
|
}
|
|
10596
10598
|
};
|
|
10597
10599
|
|
|
10598
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
10600
|
+
// node_modules/@dvmkit/sdk/dist/chunk-ATXDKX6F.js
|
|
10599
10601
|
var scopes = new AsyncLocalStorage();
|
|
10600
10602
|
function withPaymentDiagnostics(fn) {
|
|
10601
10603
|
return scopes.run({}, fn);
|
|
@@ -10770,7 +10772,7 @@ function logRejected(stage) {
|
|
|
10770
10772
|
});
|
|
10771
10773
|
}
|
|
10772
10774
|
|
|
10773
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
10775
|
+
// node_modules/@dvmkit/sdk/dist/chunk-YPSJU3OH.js
|
|
10774
10776
|
async function verifyX402Payment(paymentHeader, config, requiredUsdcMicro, resource, btcUsdRate, exactVersions = { v1: true, v2: true }) {
|
|
10775
10777
|
return callerLoggers.x402.span(
|
|
10776
10778
|
"x402.verify_payment",
|
|
@@ -10891,8 +10893,6 @@ export {
|
|
|
10891
10893
|
resolveRpcHttpTransportOptions,
|
|
10892
10894
|
redactUrl,
|
|
10893
10895
|
redactUrlsInText,
|
|
10894
|
-
callerLoggers,
|
|
10895
|
-
initCallerLoggers,
|
|
10896
10896
|
anumber,
|
|
10897
10897
|
abytes,
|
|
10898
10898
|
ahash,
|
|
@@ -10914,6 +10914,8 @@ export {
|
|
|
10914
10914
|
ensureAddress,
|
|
10915
10915
|
generateX402PrivateKey,
|
|
10916
10916
|
getX402Balance,
|
|
10917
|
+
callerLoggers,
|
|
10918
|
+
initCallerLoggers,
|
|
10917
10919
|
x402Version,
|
|
10918
10920
|
numberToDecimalString,
|
|
10919
10921
|
parseMoneyString,
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
CONFIG_PINNED_FILE,
|
|
9
9
|
ensureConfigDir,
|
|
10
10
|
require_proper_lockfile
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-AGGWYE3D.js";
|
|
12
12
|
import {
|
|
13
13
|
DvmError
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QPT5KD7H.js";
|
|
15
15
|
import {
|
|
16
16
|
__toESM
|
|
17
17
|
} from "./chunk-IYHTITNZ.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
|
tryX402Payment
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-HY65VFLL.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";
|
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";
|
|
@@ -10973,8 +10973,8 @@ async function handlePaymentRequest(jobId, request2, policy, transport, provider
|
|
|
10973
10973
|
}
|
|
10974
10974
|
}
|
|
10975
10975
|
if ((opts?.rail === void 0 || opts.rail === "x402") && request2.x402) {
|
|
10976
|
-
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-
|
|
10977
|
-
const { tryX402Payment: tryX402Payment2 } = await import("./client-
|
|
10976
|
+
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-2XALZRFL.js");
|
|
10977
|
+
const { tryX402Payment: tryX402Payment2 } = await import("./client-65B5WQPC.js");
|
|
10978
10978
|
const wallet = loadX402Wallet2();
|
|
10979
10979
|
if (wallet) {
|
|
10980
10980
|
let proof;
|
|
@@ -12571,6 +12571,9 @@ var CREDIT_CONTEXT_FIELDS = [
|
|
|
12571
12571
|
];
|
|
12572
12572
|
function withCreditErrorContext(err, body) {
|
|
12573
12573
|
const extra = {};
|
|
12574
|
+
if (err.code === "tempo_channel_exit_required" && typeof body.status === "string") {
|
|
12575
|
+
extra.status = body.status;
|
|
12576
|
+
}
|
|
12574
12577
|
for (const key of CREDIT_CONTEXT_FIELDS) {
|
|
12575
12578
|
if (typeof body[key] === "number") extra[key] = body[key];
|
|
12576
12579
|
}
|
|
@@ -12585,6 +12588,7 @@ function withCreditErrorContext(err, body) {
|
|
|
12585
12588
|
"credit_rail",
|
|
12586
12589
|
"credit_instrument",
|
|
12587
12590
|
"credit_channel_id",
|
|
12591
|
+
"channel_id",
|
|
12588
12592
|
"bound_credit_id",
|
|
12589
12593
|
"rail",
|
|
12590
12594
|
"settlement_drain_id"
|
|
@@ -13318,14 +13322,14 @@ async function confirmRollback(stored, preview, opts) {
|
|
|
13318
13322
|
async function withStrandingChecked(removing, commit) {
|
|
13319
13323
|
const leaving = new Set(removing.map((target) => target.split(".")[0]));
|
|
13320
13324
|
if (leaving.has("tempo")) {
|
|
13321
|
-
const { assertTempoWalletIdle: assertTempoWalletIdle2 } = await import("./tempo-lifecycle-
|
|
13325
|
+
const { assertTempoWalletIdle: assertTempoWalletIdle2 } = await import("./tempo-lifecycle-L5C55URR.js");
|
|
13322
13326
|
await assertTempoWalletIdle2("disconnect");
|
|
13323
13327
|
}
|
|
13324
13328
|
if (!leaving.has("x402")) return commit();
|
|
13325
|
-
const { withX402ChannelLock: withX402ChannelLock2, listPendingX402Fundings: listPendingX402Fundings2, x402PendingUnsettled: x402PendingUnsettled2 } = await import("./internal-
|
|
13326
|
-
const { assertX402WalletIdle: assertX402WalletIdle2 } = await import("./lifecycle-
|
|
13327
|
-
const { ensureAddress: ensureAddress2 } = await import("./internal-
|
|
13328
|
-
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-
|
|
13329
|
+
const { withX402ChannelLock: withX402ChannelLock2, listPendingX402Fundings: listPendingX402Fundings2, x402PendingUnsettled: x402PendingUnsettled2 } = await import("./internal-BT3U2FFW.js");
|
|
13330
|
+
const { assertX402WalletIdle: assertX402WalletIdle2 } = await import("./lifecycle-2LISVEWB.js");
|
|
13331
|
+
const { ensureAddress: ensureAddress2 } = await import("./internal-BT3U2FFW.js");
|
|
13332
|
+
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-2XALZRFL.js");
|
|
13329
13333
|
return withX402ChannelLock2(async () => {
|
|
13330
13334
|
const unsettled = listPendingX402Fundings2().filter((entry) => x402PendingUnsettled2(entry));
|
|
13331
13335
|
if (unsettled.length > 0) {
|
|
@@ -15373,7 +15377,19 @@ async function runCreditDrain(dvm, opts) {
|
|
|
15373
15377
|
"Run 'dvm credit balance <dvm>' to check the server, or pass --credit-id explicitly."
|
|
15374
15378
|
);
|
|
15375
15379
|
}
|
|
15380
|
+
const exitCommand = [
|
|
15381
|
+
"dvm wallet tempo-exit",
|
|
15382
|
+
shellQuoteArg(endpoint),
|
|
15383
|
+
"--credit-id",
|
|
15384
|
+
shellQuoteArg(creditId),
|
|
15385
|
+
..."name" in signer.source ? ["--as", shellQuoteArg(signer.source.name)] : []
|
|
15386
|
+
].join(" ");
|
|
15376
15387
|
const tempoSession = !!loadTempoChannelAssociation(endpoint, signer.pubkey, creditId);
|
|
15388
|
+
const exitRecovery = {
|
|
15389
|
+
command: exitCommand,
|
|
15390
|
+
hasLocalChannel: tempoSession,
|
|
15391
|
+
envSigner: signer.source.kind === "env"
|
|
15392
|
+
};
|
|
15377
15393
|
const method = (opts.method ?? (stored?.creditId === creditId && stored.rail === "tempo" || tempoSession ? "tempo" : stored?.creditId === creditId && (stored.rail === "x402" || stored.x402Instrument !== void 0) ? "x402" : "cashu")).toLowerCase();
|
|
15378
15394
|
if (opts.recoverFromReceipts && (method !== "x402" || !opts.creditId || !opts.drainId || opts.address !== void 0)) {
|
|
15379
15395
|
throw new DvmError(
|
|
@@ -15666,6 +15682,8 @@ async function runCreditDrain(dvm, opts) {
|
|
|
15666
15682
|
anchorRead = await fetchTrustAnchor(transport, { endpoint });
|
|
15667
15683
|
}
|
|
15668
15684
|
} catch (err) {
|
|
15685
|
+
const originalDisplay = err instanceof DvmError ? typeof err.data?.display === "string" ? err.data.display : err.display : void 0;
|
|
15686
|
+
let retirement;
|
|
15669
15687
|
if (err instanceof DvmError && err.data?.drain_id_retired === true) {
|
|
15670
15688
|
clearPendingDrain(endpoint, signer.pubkey, drain, ...identityArg);
|
|
15671
15689
|
} else if (
|
|
@@ -15696,7 +15714,7 @@ async function runCreditDrain(dvm, opts) {
|
|
|
15696
15714
|
);
|
|
15697
15715
|
} else if (err instanceof DvmError && err.data?.drain_registered === false) {
|
|
15698
15716
|
clearPendingDrain(endpoint, signer.pubkey, drain, ...identityArg);
|
|
15699
|
-
|
|
15717
|
+
retirement = `The DVM confirmed drain ${drain.drainId} was never registered, so its stale local record was retired. No refund was created or paid.`;
|
|
15700
15718
|
const serverDisplay = typeof err.data.display === "string" ? err.data.display : err.display;
|
|
15701
15719
|
const displayWasProvider = err.proseSources?.display === "provider";
|
|
15702
15720
|
err.display = serverDisplay ? `${serverDisplay} ${retirement}` : retirement;
|
|
@@ -15714,6 +15732,21 @@ async function runCreditDrain(dvm, opts) {
|
|
|
15714
15732
|
if (!stored) forgetCredit(endpoint, signer.pubkey, ...identityArg);
|
|
15715
15733
|
else if (mintedThisRun) clearPendingDrain(endpoint, signer.pubkey, drain, ...identityArg);
|
|
15716
15734
|
}
|
|
15735
|
+
if (err instanceof DvmError && err.code === "tempo_channel_exit_required") {
|
|
15736
|
+
const local2 = tempoExitRequiredCopy(exitRecovery, err.data?.channel_id, err.data?.status);
|
|
15737
|
+
const display2 = retirement ? `${local2.display} ${retirement}` : local2.display;
|
|
15738
|
+
const providerDisplay2 = asProviderTextOpt(originalDisplay);
|
|
15739
|
+
const providerHint2 = asProviderTextOpt(err.hint);
|
|
15740
|
+
throw new DvmError(err.code, display2, local2.hint, {
|
|
15741
|
+
...err.data,
|
|
15742
|
+
credit_id: creditId,
|
|
15743
|
+
drain_id: drain.drainId,
|
|
15744
|
+
retryable: err.data?.status === "pending",
|
|
15745
|
+
...providerDisplay2 ? { provider_display: providerDisplay2 } : {},
|
|
15746
|
+
...providerHint2 ? { provider_hint: providerHint2 } : {},
|
|
15747
|
+
display: display2
|
|
15748
|
+
});
|
|
15749
|
+
}
|
|
15717
15750
|
throw err;
|
|
15718
15751
|
} finally {
|
|
15719
15752
|
transport.close();
|
|
@@ -15758,6 +15791,7 @@ async function runCreditDrain(dvm, opts) {
|
|
|
15758
15791
|
`Warning: a drain receipt did not verify. ${receiptFailureDetail(firstBroken.reason ?? "signature_invalid")}`
|
|
15759
15792
|
);
|
|
15760
15793
|
}
|
|
15794
|
+
const local = localDrainCopy(wireDrain, drain, exitRecovery);
|
|
15761
15795
|
let claimedSats;
|
|
15762
15796
|
if (wireDrain.token && drain.method === "cashu") {
|
|
15763
15797
|
try {
|
|
@@ -15798,7 +15832,6 @@ async function runCreditDrain(dvm, opts) {
|
|
|
15798
15832
|
const atRiskHint = x402AtRisk?.micro ? ` ${x402AtRiskInstruction(x402AtRisk.micro, x402AtRisk.pending)}` : mppAtRisk ? ` That authority outlives this released drain: the credit balance is spendable again, and the channel's collateral is only settled once the channel closes on-chain. 'dvm wallet tempo-exit ${dvm}' reads the chain and reports what the exit is guaranteed to return against what it likely returns.` : "";
|
|
15799
15833
|
const providerDisplay = asProviderTextOpt(result.display);
|
|
15800
15834
|
const providerHint = asProviderTextOpt(result.hint);
|
|
15801
|
-
const local = localDrainCopy(wireDrain, drain);
|
|
15802
15835
|
const channelExitHint = released && drain.method === "tempo" && channelBacked && !atRiskHint ? ` The channel itself is still open on-chain: 'dvm wallet tempo-exit ${dvm}' reads it and recovers the collateral.` : "";
|
|
15803
15836
|
const display = (claimedSats !== void 0 ? `Reclaimed $${formatUsd(wireDrain.amount_micro / 1e6)} \u2014 ${String(claimedSats)} sats received into the agent wallet.` : local.display) + atRiskNote + channelNote;
|
|
15804
15837
|
const hint = (claimedSats !== void 0 ? "The refund is in your wallet ('dvm wallet show'). The drain receipts are your signed evidence of the reclaim." : local.hint) + channelExitHint + atRiskHint + channelHint;
|
|
@@ -16088,7 +16121,7 @@ async function runCreditReceipts(dvm, opts) {
|
|
|
16088
16121
|
}
|
|
16089
16122
|
});
|
|
16090
16123
|
}
|
|
16091
|
-
function localDrainCopy(wire, requested) {
|
|
16124
|
+
function localDrainCopy(wire, requested, exitRecovery) {
|
|
16092
16125
|
const amount = formatFiat(wire.amount_micro / 1e6, wire.currency);
|
|
16093
16126
|
const poll = "Re-run this command to poll; the same drain id is request, poll, and pickup.";
|
|
16094
16127
|
switch (wire.status) {
|
|
@@ -16125,15 +16158,34 @@ function localDrainCopy(wire, requested) {
|
|
|
16125
16158
|
display: `The DVM reports ${amount} of refund was paid out to the destination this drain named.`,
|
|
16126
16159
|
hint: "The settlement reference is in drain.sent. The drain receipts are your signed evidence of the reclaim."
|
|
16127
16160
|
};
|
|
16161
|
+
case "exit_required":
|
|
16162
|
+
return tempoExitRequiredCopy(exitRecovery, "channel_id" in wire ? wire.channel_id : void 0);
|
|
16128
16163
|
case "released":
|
|
16129
16164
|
return {
|
|
16130
16165
|
display: `The refund could not complete, so the DVM restored ${amount} to the prepaid balance.`,
|
|
16131
16166
|
hint: "This released drain is terminal \u2014 do not poll it again. The balance is spendable, or reclaimable on a fresh drain."
|
|
16132
16167
|
};
|
|
16133
16168
|
default:
|
|
16134
|
-
|
|
16169
|
+
throw new DvmError(
|
|
16170
|
+
"unknown_drain_status",
|
|
16171
|
+
`The DVM reported an unknown drain status: ${wire.status}. The refund outcome is not understood by this version of dvm.`,
|
|
16172
|
+
"Upgrade dvm before continuing; do not poll this drain with this version. Keep the recovery records and signed receipts until the refund is confirmed.",
|
|
16173
|
+
{ status: wire.status, drain_id: wire.drain_id, credit_id: wire.credit_id },
|
|
16174
|
+
`Unknown drain status '${wire.status}'; this version of dvm cannot determine the refund outcome.`
|
|
16175
|
+
);
|
|
16135
16176
|
}
|
|
16136
16177
|
}
|
|
16178
|
+
function tempoExitRequiredCopy(recovery, channelId, status2) {
|
|
16179
|
+
const channel = typeof channelId === "string" ? ` Channel ID: ${channelId}.` : "";
|
|
16180
|
+
const pending4 = status2 === "pending";
|
|
16181
|
+
const nextStep = pending4 ? "A retry of the same drain with a valid close credential (approval to close this deposit) may still work. The timed exit is the fallback." : "Do not retry the direct refund; do not poll this drain again.";
|
|
16182
|
+
const command = recovery.hasLocalChannel ? `Run '${recovery.command}' to start or finish the timed exit. Keep the channel recovery record until the funds are returned.` : `Run '${recovery.command}' from the wallet and machine that opened the channel; this machine has no channel recovery record for this credit.`;
|
|
16183
|
+
const signer = recovery.envSigner ? " Set the same DVM_IDENTITY_KEY used for this credit when running that command." : "";
|
|
16184
|
+
return {
|
|
16185
|
+
display: pending4 ? "The service cannot return this money directly with the current approval. A valid approval may still let it return the money, or the remaining funds come back through a timed exit after a delay." : "The service cannot return this money directly. The remaining funds come back through a timed exit after a delay.",
|
|
16186
|
+
hint: `${nextStep} ${command}${signer} The timed exit returns the remaining funds after its delay. The service can still collect payments you already approved, and chain fees apply.${channel}`
|
|
16187
|
+
};
|
|
16188
|
+
}
|
|
16137
16189
|
function drainReceiptEvent(receipt) {
|
|
16138
16190
|
return isDrainReceipt(receipt) ? receipt.event : null;
|
|
16139
16191
|
}
|
|
@@ -18157,8 +18209,8 @@ async function probeX402(x402, timeoutMs) {
|
|
|
18157
18209
|
let network;
|
|
18158
18210
|
let address;
|
|
18159
18211
|
try {
|
|
18160
|
-
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-
|
|
18161
|
-
const { getX402Balance, ensureAddress: ensureAddress2, usdcContractByCaip2 } = await import("./internal-
|
|
18212
|
+
const { loadX402Wallet: loadX402Wallet2 } = await import("./wallet-2XALZRFL.js");
|
|
18213
|
+
const { getX402Balance, ensureAddress: ensureAddress2, usdcContractByCaip2 } = await import("./internal-BT3U2FFW.js");
|
|
18162
18214
|
const wallet = loadX402Wallet2();
|
|
18163
18215
|
if (!wallet) {
|
|
18164
18216
|
const storedKey = x402.privateKey;
|
|
@@ -18210,8 +18262,8 @@ async function probeMpp(mpp, timeoutMs) {
|
|
|
18210
18262
|
if (!mpp) return null;
|
|
18211
18263
|
if (mpp.method === "tempo") {
|
|
18212
18264
|
try {
|
|
18213
|
-
const { connectedTempoAccount: connectedTempoAccount2 } = await import("./tempo-wallet-
|
|
18214
|
-
const { getTempoUsdcBalance: getTempoUsdcBalance3, resolveTempoNetwork: resolveTempoNetwork2 } = await import("./internal-
|
|
18265
|
+
const { connectedTempoAccount: connectedTempoAccount2 } = await import("./tempo-wallet-XPXR3T3E.js");
|
|
18266
|
+
const { getTempoUsdcBalance: getTempoUsdcBalance3, resolveTempoNetwork: resolveTempoNetwork2 } = await import("./internal-BT3U2FFW.js");
|
|
18215
18267
|
const account = await connectedTempoAccount2();
|
|
18216
18268
|
if (!account) {
|
|
18217
18269
|
return {
|
|
@@ -22976,7 +23028,7 @@ async function settleCreditAfterJob(args) {
|
|
|
22976
23028
|
}
|
|
22977
23029
|
}
|
|
22978
23030
|
if (args.allowTopup !== false) {
|
|
22979
|
-
const refill = args.refillPocket ?? (await import("./pocket-refill-
|
|
23031
|
+
const refill = args.refillPocket ?? (await import("./pocket-refill-K24FKUXH.js")).refillPocketIfLow;
|
|
22980
23032
|
await refill({ human: args.human }).catch(() => void 0);
|
|
22981
23033
|
}
|
|
22982
23034
|
}
|