@dvmkit/dvm-cli 0.11.3 → 0.12.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/dist/{chunk-BPWZNIMS.js → chunk-RMYEB2WG.js} +21 -0
- package/dist/{chunk-MIYOOJRL.js → chunk-WPTJM5A7.js} +720 -42
- package/dist/{client-DS4QJ346.js → client-V7KAPCAG.js} +1 -1
- package/dist/dvm.js +769 -876
- package/dist/{pocket-refill-JYYODE6X.js → pocket-refill-Z4YT7CHW.js} +2 -2
- package/package.json +1 -1
- package/skills/dvm/calling.md +5 -1
|
@@ -36,7 +36,20 @@ import {
|
|
|
36
36
|
import { randomBytes } from "crypto";
|
|
37
37
|
|
|
38
38
|
// src/lib/output.ts
|
|
39
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
39
40
|
import { writeSync } from "fs";
|
|
41
|
+
var warnings = new AsyncLocalStorage();
|
|
42
|
+
function withOutputWarnings(run) {
|
|
43
|
+
return warnings.run([], run);
|
|
44
|
+
}
|
|
45
|
+
function addOutputWarnings(entries, human) {
|
|
46
|
+
const pending = warnings.getStore();
|
|
47
|
+
for (const entry of entries) {
|
|
48
|
+
if (pending?.some((prior) => prior.auto_pay_below === entry.auto_pay_below && prior.source === entry.source)) continue;
|
|
49
|
+
pending?.push(entry);
|
|
50
|
+
if (human) info(`Warning: ${entry.display}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
40
53
|
var _traceId = null;
|
|
41
54
|
function setOutputTraceId(id) {
|
|
42
55
|
_traceId = id;
|
|
@@ -45,6 +58,11 @@ function getOutputTraceId() {
|
|
|
45
58
|
return _traceId;
|
|
46
59
|
}
|
|
47
60
|
function json(data) {
|
|
61
|
+
const pending = warnings.getStore();
|
|
62
|
+
if (pending?.length && data && typeof data === "object" && !Array.isArray(data)) {
|
|
63
|
+
const existing = data.warnings ?? [];
|
|
64
|
+
data = { ...data, warnings: [...existing, ...pending] };
|
|
65
|
+
}
|
|
48
66
|
const out = _traceId !== null && typeof data === "object" && data !== null && !Array.isArray(data) && !("trace_id" in data) ? { trace_id: _traceId, ...data } : data;
|
|
49
67
|
writeAllSync(1, JSON.stringify(out) + "\n");
|
|
50
68
|
}
|
|
@@ -389,12 +407,15 @@ async function priceableRate(btcRate) {
|
|
|
389
407
|
}
|
|
390
408
|
|
|
391
409
|
export {
|
|
410
|
+
withOutputWarnings,
|
|
411
|
+
addOutputWarnings,
|
|
392
412
|
setOutputTraceId,
|
|
393
413
|
getOutputTraceId,
|
|
394
414
|
json,
|
|
395
415
|
info,
|
|
396
416
|
raw,
|
|
397
417
|
progress,
|
|
418
|
+
formatSats,
|
|
398
419
|
formatAmount,
|
|
399
420
|
formatPaymentAmount,
|
|
400
421
|
costAnchor,
|