@dvmkit/dvm-cli 0.15.2 → 0.16.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.
Files changed (26) hide show
  1. package/dist/{chunk-I7ZBID4L.js → chunk-2TNH4ME5.js} +2 -2
  2. package/dist/{chunk-HXTASGHL.js → chunk-A2B7QDMS.js} +2 -2
  3. package/dist/{chunk-EZL4IVCU.js → chunk-CEBEPXQ7.js} +3 -3
  4. package/dist/{chunk-57PXJ56K.js → chunk-DGA5EFKU.js} +354 -186
  5. package/dist/{chunk-UWVMG4VG.js → chunk-H6WQ4S6K.js} +3 -3
  6. package/dist/{chunk-D5CGDS3V.js → chunk-IK7RI645.js} +2 -2
  7. package/dist/{chunk-ECJO73RZ.js → chunk-LDYMUQZE.js} +2795 -2549
  8. package/dist/{chunk-5SHB3MZ7.js → chunk-NSA2RJ2T.js} +37 -7
  9. package/dist/{chunk-YQJRKWNT.js → chunk-U2PODYIS.js} +24487 -22833
  10. package/dist/{chunk-UCCT5IKU.js → chunk-UFMAHF6T.js} +63 -1
  11. package/dist/{chunk-2MCZ4QOK.js → chunk-WRIXUSMR.js} +2 -2
  12. package/dist/{chunk-HJ2JYBTT.js → chunk-WSLZBJ52.js} +4 -4
  13. package/dist/{client-YIHI4AIC.js → client-S5PTHG25.js} +6 -6
  14. package/dist/dvm.js +483 -197
  15. package/dist/{internal-O7IQD6EQ.js → internal-3SIUYRWP.js} +5 -5
  16. package/dist/{lifecycle-MIJH3JE4.js → lifecycle-7NHL5ATK.js} +6 -6
  17. package/dist/{payout-reporter-Y6OW3FYD-K6MRWQXK.js → payout-reporter-F5LFV5W4-EJ7E5ALO.js} +2 -2
  18. package/dist/{pocket-refill-XZTMPTP6.js → pocket-refill-3CA4PFXG.js} +10 -10
  19. package/dist/{revenue-reporter-CIG2MEDN-ZXMO6NWG.js → revenue-reporter-2U55YH2I-EUB6PBRN.js} +2 -2
  20. package/dist/{tempo-lifecycle-FMBCHD2M.js → tempo-lifecycle-GAM3DJ63.js} +8 -8
  21. package/dist/{tempo-wallet-U3WBWIIH.js → tempo-wallet-JTARPYLN.js} +7 -7
  22. package/dist/{wallet-Z3FDX43V.js → wallet-QKAKRLPI.js} +7 -7
  23. package/dist/{x402-ARXZQ5BD-H6PNJYYT.js → x402-G6C4N2BN-TAJEBQGU.js} +2 -2
  24. package/package.json +2 -2
  25. package/skills/dvm/calling.md +1 -1
  26. package/skills/dvm/wallets.md +9 -1
@@ -12,7 +12,7 @@ import {
12
12
  isSignableExactRequirement,
13
13
  maxAdvertisedMicro,
14
14
  withinAdvertisedTolerance
15
- } from "./chunk-YQJRKWNT.js";
15
+ } from "./chunk-U2PODYIS.js";
16
16
  import {
17
17
  DvmError,
18
18
  X402_V1_VERSION,
@@ -30,19 +30,40 @@ import {
30
30
  usdcToMsats,
31
31
  x402NetworkByCaip2,
32
32
  x402NetworkToCaip2
33
- } from "./chunk-57PXJ56K.js";
33
+ } from "./chunk-DGA5EFKU.js";
34
34
 
35
35
  // src/lib/x402/client.ts
36
36
  import { randomBytes } from "crypto";
37
37
 
38
38
  // src/lib/output.ts
39
- import { AsyncLocalStorage } from "async_hooks";
39
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
40
40
  import { writeSync } from "fs";
41
- var warnings = new AsyncLocalStorage();
42
- function withOutputWarnings(run) {
43
- return warnings.run([], run);
41
+
42
+ // src/lib/job-persistence.ts
43
+ import { AsyncLocalStorage } from "async_hooks";
44
+ var jobPersistence = new AsyncLocalStorage();
45
+ function hasUnsavedJobState() {
46
+ return jobPersistence.getStore()?.unsaved !== void 0;
47
+ }
48
+ function withJobPersistence(run, warn) {
49
+ if (jobPersistence.getStore()) return run();
50
+ return jobPersistence.run({ warn }, run);
51
+ }
52
+
53
+ // src/lib/output.ts
54
+ var warnings = new AsyncLocalStorage2();
55
+ function withOutputWarnings(run, human) {
56
+ return warnings.run([], () => withJobPersistence(run, ({ accessPreserved, accessUnpreserved }) => {
57
+ const hint = accessUnpreserved ? "Job access was not preserved. Supply --endpoint <url> and --job-token <hex>, or DVM_JOB_ENDPOINT and DVM_JOB_TOKEN, to read this job; do not submit or pay again." : "Refresh the job with dvm status <job_id> --messages before paying or submitting a replacement.";
58
+ addOutputWarnings([{
59
+ code: "local_job_state_unsaved",
60
+ display: "The provider's outcome is unchanged, but local job state could not be saved and may lag. Automatic payments are paused for this command." + (accessUnpreserved ? ` ${hint}` : accessPreserved ? ` Job access is preserved privately. ${hint}` : ""),
61
+ hint
62
+ }], human);
63
+ }));
44
64
  }
45
65
  function sameWarning(prior, entry) {
66
+ if (prior.code === "local_job_state_unsaved" && entry.code === "local_job_state_unsaved") return true;
46
67
  if (prior.code === "auto_pay_bound_exceeded" && entry.code === "auto_pay_bound_exceeded") {
47
68
  return prior.auto_pay_below === entry.auto_pay_below && prior.source === entry.source;
48
69
  }
@@ -55,7 +76,14 @@ function addOutputWarnings(entries, human) {
55
76
  const pending = warnings.getStore();
56
77
  const added = [];
57
78
  for (const entry of entries) {
58
- if (pending?.some((prior) => sameWarning(prior, entry))) continue;
79
+ const index = pending?.findIndex((prior) => sameWarning(prior, entry)) ?? -1;
80
+ if (index !== -1) {
81
+ const prior = pending[index];
82
+ if (entry.code !== "local_job_state_unsaved" || JSON.stringify(prior) === JSON.stringify(entry)) continue;
83
+ pending[index] = entry;
84
+ if (human) info(`Warning: ${entry.display}`);
85
+ continue;
86
+ }
59
87
  pending?.push(entry);
60
88
  added.push(entry);
61
89
  if (human) info(`Warning: ${entry.display}`);
@@ -419,6 +447,8 @@ async function priceableRate(btcRate) {
419
447
  }
420
448
 
421
449
  export {
450
+ jobPersistence,
451
+ hasUnsavedJobState,
422
452
  withOutputWarnings,
423
453
  addOutputWarnings,
424
454
  setOutputTraceId,