@dvmkit/sdk 0.1.5-rc.9 → 0.2.0-rc.9
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 +12 -0
- package/dist/{chunk-BIP6G74V.js → chunk-2ATUAUAO.js} +8 -8
- package/dist/{chunk-27V2ILSR.js → chunk-4A2RAKCW.js} +2 -2
- package/dist/{chunk-EVBK675R.js → chunk-6GRIKOFB.js} +28 -23
- package/dist/{chunk-CEOAHV2I.js → chunk-FDKRXOZO.js} +0 -5
- package/dist/{chunk-L4OYF4DQ.js → chunk-FT6HTUM4.js} +1 -1
- package/dist/{chunk-BTZY7VPH.js → chunk-GAIPXGM3.js} +1 -1
- package/dist/{chunk-U6M3ATSG.js → chunk-JDT5LCJC.js} +40 -6
- package/dist/{chunk-FROTD5XQ.js → chunk-JLXYOV4Y.js} +1 -2
- package/dist/{chunk-M7LHFJ5K.js → chunk-KMZXTBLA.js} +2 -2
- package/dist/{chunk-6BQM7TOW.js → chunk-L67WTZX2.js} +3 -7
- package/dist/{chunk-CGKZDODG.js → chunk-MG67KXU7.js} +0 -5
- package/dist/{chunk-JZWELPFH.js → chunk-MRAGS5VP.js} +1 -1
- package/dist/{chunk-2UUXIIOC.js → chunk-O2X2CCKH.js} +3 -3
- package/dist/{chunk-TQWGQCNV.js → chunk-OMIQMMME.js} +3 -3
- package/dist/{chunk-5PBOA25N.js → chunk-PCUQZDZA.js} +436 -355
- package/dist/{chunk-KVEHHC7W.js → chunk-PHHAYRQV.js} +7 -9
- package/dist/{chunk-SSSZUVWM.js → chunk-QP53RWAD.js} +88 -38
- package/dist/{chunk-DMNLFNTW.js → chunk-QT4ONTST.js} +1 -1
- package/dist/{chunk-RW5LP57K.js → chunk-SDK6KDJN.js} +0 -1
- package/dist/{chunk-MLRCSJYX.js → chunk-V7EVFLAK.js} +87 -90
- package/dist/{chunk-E4EVGPDX.js → chunk-XQXJKJ3P.js} +0 -2
- package/dist/{credit-ledger-2DFQHNLB.js → credit-ledger-5ZEJRI46.js} +1 -1
- package/dist/{credit-menu-enwMbn55.d.ts → credit-menu-D4Gcdgc4.d.ts} +487 -643
- package/dist/{fx-D860pZvP.d.ts → fx-B0SLBe5x.d.ts} +38 -82
- package/dist/index.d.ts +11 -14
- package/dist/index.js +2 -2
- package/dist/internal/caller.d.ts +618 -1525
- package/dist/internal/caller.js +28 -60
- package/dist/internal/server.d.ts +36 -61
- package/dist/internal/server.js +11 -11
- package/dist/{job-store-BUGqvCfL.d.ts → job-store-B2uZvga4.d.ts} +70 -59
- package/dist/{lightning-backend-BozcevPZ.d.ts → lightning-backend-CQBnQgsT.d.ts} +19 -27
- package/dist/{memory-credit-ledger-MNUOTQO5.js → memory-credit-ledger-ZOH6C3N4.js} +2 -2
- package/dist/{mpp-setup-4FJD6ZHV.js → mpp-setup-IOJBF7DB.js} +1 -1
- package/dist/{payout-reporter-RG6XNGPI.js → payout-reporter-5PIRYFVQ.js} +1 -1
- package/dist/{postgres-consumed-credential-store-VHBT4KEA.js → postgres-consumed-credential-store-ISRHBMOU.js} +1 -1
- package/dist/{postgres-job-store-3RAXMNSY.js → postgres-job-store-OGQ6IT4U.js} +1 -1
- package/dist/{postgres-kv-store-JFBDP5IP.js → postgres-kv-store-D5E2EZ24.js} +1 -1
- package/dist/{postgres-replay-store-UJXRT6VO.js → postgres-replay-store-IZFLTTAC.js} +1 -1
- package/dist/{pricing-4CEB34RM.js → pricing-MU5GNUJZ.js} +1 -1
- package/dist/{processed-payment-store-HAA4SFNK.js → processed-payment-store-FIDI3RNH.js} +1 -1
- package/dist/{revenue-reporter-ASZ7SHHH.js → revenue-reporter-NNCNRY4C.js} +1 -1
- package/dist/server/index.d.ts +53 -59
- package/dist/server/index.js +38 -37
- package/dist/{ssrf-DbFkpDv0.d.ts → ssrf-dMooihtY.d.ts} +1 -2
- package/dist/{step-cache-5dljDqrQ.d.ts → step-cache-CXg7ziML.d.ts} +389 -551
- package/dist/{tempo-charge-store-RIFTALZK.js → tempo-charge-store-76TDAF34.js} +1 -1
- package/dist/{tempo-lifecycle-DFIXQ54Q.js → tempo-lifecycle-DXM7QXJQ.js} +3 -3
- package/dist/{tempo-wallet-4QKSV65O.js → tempo-wallet-O67H5M4N.js} +2 -2
- package/dist/testing/index.d.ts +5 -15
- package/dist/testing/index.js +4 -11
- package/dist/{usd-DoRuAckA.d.ts → usd-BNDg1715.d.ts} +14 -16
- package/dist/{wallet-CJC8lwxx.d.ts → wallet-Dwjs5n_M.d.ts} +1 -1
- package/dist/{x402-5H27DCBE.js → x402-7S2EFINY.js} +2 -2
- package/package.json +2 -1
package/dist/internal/caller.js
CHANGED
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
withIdentitiesLock,
|
|
56
56
|
withTempoChannelLock,
|
|
57
57
|
withholdsTempoCreditSession
|
|
58
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-OMIQMMME.js";
|
|
59
59
|
import {
|
|
60
60
|
TEMPO_CHAIN_ID,
|
|
61
61
|
TEMPO_MODERATO_CHAIN_ID,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
tempoTokenReference,
|
|
72
72
|
tempoWrongAssetHint,
|
|
73
73
|
tryResolveTempoAsset
|
|
74
|
-
} from "../chunk-
|
|
74
|
+
} from "../chunk-O2X2CCKH.js";
|
|
75
75
|
import {
|
|
76
76
|
DvmX402ChannelStorage,
|
|
77
77
|
X402_EXACT_AUTHORIZATION_TTL_SECONDS,
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
x402PendingStale,
|
|
117
117
|
x402PendingUnsettled,
|
|
118
118
|
x402WrongAssetHint
|
|
119
|
-
} from "../chunk-
|
|
119
|
+
} from "../chunk-2ATUAUAO.js";
|
|
120
120
|
import {
|
|
121
121
|
RAIL_FLAGS,
|
|
122
122
|
SUPPORTED_PROTOCOL_VERSION,
|
|
@@ -181,10 +181,10 @@ import {
|
|
|
181
181
|
retireConfigBackup,
|
|
182
182
|
rollbackConfig,
|
|
183
183
|
updateConfig
|
|
184
|
-
} from "../chunk-
|
|
184
|
+
} from "../chunk-MG67KXU7.js";
|
|
185
185
|
import {
|
|
186
186
|
CAPABILITY_NAME_RE
|
|
187
|
-
} from "../chunk-
|
|
187
|
+
} from "../chunk-GAIPXGM3.js";
|
|
188
188
|
import {
|
|
189
189
|
DbTransport,
|
|
190
190
|
NwcBackend,
|
|
@@ -209,10 +209,10 @@ import {
|
|
|
209
209
|
sha256hex,
|
|
210
210
|
validateX402Env,
|
|
211
211
|
withNwcPool
|
|
212
|
-
} from "../chunk-
|
|
212
|
+
} from "../chunk-FDKRXOZO.js";
|
|
213
213
|
import {
|
|
214
214
|
MemoryKVStore
|
|
215
|
-
} from "../chunk-
|
|
215
|
+
} from "../chunk-SDK6KDJN.js";
|
|
216
216
|
import {
|
|
217
217
|
ADMIN_STATE_UNAVAILABLE,
|
|
218
218
|
DEFAULT_AGENT_MINT_URL,
|
|
@@ -398,7 +398,7 @@ import {
|
|
|
398
398
|
randomTraceId,
|
|
399
399
|
setEmitter,
|
|
400
400
|
withTraceContext
|
|
401
|
-
} from "../chunk-
|
|
401
|
+
} from "../chunk-XQXJKJ3P.js";
|
|
402
402
|
import "../chunk-66HGCPBU.js";
|
|
403
403
|
import {
|
|
404
404
|
redactUrl,
|
|
@@ -408,7 +408,7 @@ import {
|
|
|
408
408
|
FX_CACHE_TTL_MS,
|
|
409
409
|
FX_RETRY_COUNT,
|
|
410
410
|
warmFxSnapshot
|
|
411
|
-
} from "../chunk-
|
|
411
|
+
} from "../chunk-4A2RAKCW.js";
|
|
412
412
|
import {
|
|
413
413
|
InvalidUsdPriceError,
|
|
414
414
|
parseUsdPrice
|
|
@@ -503,7 +503,7 @@ async function enforceGlobalBudget(opts) {
|
|
|
503
503
|
window: check.window,
|
|
504
504
|
spent: {
|
|
505
505
|
display: `$${formatUsd(check.spentUsd)}`,
|
|
506
|
-
//
|
|
506
|
+
// the cap counts both what the agent paid DVMs and what it
|
|
507
507
|
// moved out of the Lightning float, so name the split rather than
|
|
508
508
|
// leaving the user to wonder why the number is higher than their jobs.
|
|
509
509
|
jobs: `$${formatUsd(check.breakdown.jobsUsd)}`,
|
|
@@ -1154,11 +1154,6 @@ function toFloatError(err) {
|
|
|
1154
1154
|
next_step: "Add funds to the wallet, or ask for a smaller amount."
|
|
1155
1155
|
}
|
|
1156
1156
|
);
|
|
1157
|
-
// NIP-47 draws a line here that the remedy depends on entirely (internal-review).
|
|
1158
|
-
// `UNAUTHORIZED` is the wallet saying it has never heard of this
|
|
1159
|
-
// connection; `RESTRICTED` is the wallet saying it knows the connection
|
|
1160
|
-
// perfectly well and will not let it do *this*. Recreating the connection
|
|
1161
|
-
// fixes the first and reproduces the second, verbatim, forever.
|
|
1162
1157
|
case "UNAUTHORIZED":
|
|
1163
1158
|
return new DvmError(
|
|
1164
1159
|
"float_unauthorized",
|
|
@@ -1189,11 +1184,6 @@ function toFloatError(err) {
|
|
|
1189
1184
|
next_step: "Switch to a wallet that can pay invoices over a connection, such as Alby Hub."
|
|
1190
1185
|
}
|
|
1191
1186
|
);
|
|
1192
|
-
// The wallet's own reason is the payload here (internal-review): a routing-floor
|
|
1193
|
-
// failure and a transient liquidity blip look identical without it, and
|
|
1194
|
-
// the drill lost two round trips to an unconditional "retry" hint that a
|
|
1195
|
-
// floor failure can never satisfy. Surface the reason and let the caller
|
|
1196
|
-
// that knows an advertised floor (credit-fund.ts) sharpen the hint.
|
|
1197
1187
|
case "PAYMENT_FAILED":
|
|
1198
1188
|
return new DvmError(
|
|
1199
1189
|
"float_payment_failed",
|
|
@@ -4291,7 +4281,7 @@ async function prepareAgentSpend(args) {
|
|
|
4291
4281
|
swapping: void 0,
|
|
4292
4282
|
cashu_token: cashuToken,
|
|
4293
4283
|
...boundContext ? { context: boundContext } : {},
|
|
4294
|
-
// What a later reclaim needs
|
|
4284
|
+
// What a later reclaim needs. Only the swap path
|
|
4295
4285
|
// writes these: reserve-direct entries ship proofs that still
|
|
4296
4286
|
// live in `wallet.proofs[]`, and `release` / the in-flight
|
|
4297
4287
|
// revert already own their recovery.
|
|
@@ -4968,7 +4958,7 @@ async function shipEntry(entry, httpPost) {
|
|
|
4968
4958
|
}
|
|
4969
4959
|
return { kind: "still_pending", entry, reason: errCode };
|
|
4970
4960
|
}
|
|
4971
|
-
if (errCode === "wrong_lock_pubkey" || errCode === "not_p2pk_locked" || errCode === "payment_invalid" || errCode === "proof_not_unspent" || // Credit-route permanent refusals
|
|
4961
|
+
if (errCode === "wrong_lock_pubkey" || errCode === "not_p2pk_locked" || errCode === "payment_invalid" || errCode === "proof_not_unspent" || // Credit-route permanent refusals: the fund can never land
|
|
4972
4962
|
// under this signed body.
|
|
4973
4963
|
errCode === "credit_id_unavailable" || errCode === "caller_mismatch" || errCode === "credit_not_supported") {
|
|
4974
4964
|
return { kind: "abandoned", entry, reason: errCode };
|
|
@@ -5152,7 +5142,7 @@ function jobRecordFromEntry(entry, jobId, body, feedbackClaim) {
|
|
|
5152
5142
|
...ctx?.policy ? { policy: ctx.policy } : {},
|
|
5153
5143
|
...ctx?.strict_per_call ? { strictPerCall: true } : {},
|
|
5154
5144
|
...ctx?.max_cashu_fee_sats !== void 0 ? { maxCashuFeeSats: ctx.max_cashu_fee_sats } : {},
|
|
5155
|
-
//
|
|
5145
|
+
// the per-job token an anonymous caller needs on every later read.
|
|
5156
5146
|
...typeof body?.job_token === "string" ? { jobToken: body.job_token } : {}
|
|
5157
5147
|
};
|
|
5158
5148
|
}
|
|
@@ -5309,7 +5299,7 @@ async function releaseAgentReserve(opts) {
|
|
|
5309
5299
|
throw new DvmError(
|
|
5310
5300
|
"missing_canonical_id",
|
|
5311
5301
|
"DVM advertises no `cashu.canonical_id` on /v1/info.",
|
|
5312
|
-
"Release needs canonical_id so the agent can derive the matching per-DVM refund subkey. Upgrade the builder SDK
|
|
5302
|
+
"Release needs canonical_id so the agent can derive the matching per-DVM refund subkey. Upgrade the builder SDK."
|
|
5313
5303
|
);
|
|
5314
5304
|
}
|
|
5315
5305
|
const outputMode = opts.outputMode ?? "locked";
|
|
@@ -5475,7 +5465,7 @@ async function reserveAgentWallet(amountSats, opts) {
|
|
|
5475
5465
|
throw new DvmError(
|
|
5476
5466
|
"missing_cashu_info",
|
|
5477
5467
|
"DVM does not advertise a `cashu` object on /v1/info.",
|
|
5478
|
-
"Reserve requires the builder to expose lock_pubkeys, mints, and canonical_id. Check the builder is running an SDK that supports pre-fund
|
|
5468
|
+
"Reserve requires the builder to expose lock_pubkeys, mints, and canonical_id. Check the builder is running an SDK that supports pre-fund."
|
|
5479
5469
|
);
|
|
5480
5470
|
}
|
|
5481
5471
|
const lockPubkey = cashu.lock_pubkeys[0];
|
|
@@ -5497,7 +5487,7 @@ async function reserveAgentWallet(amountSats, opts) {
|
|
|
5497
5487
|
throw new DvmError(
|
|
5498
5488
|
"missing_canonical_id",
|
|
5499
5489
|
"DVM advertises no `cashu.canonical_id` on /v1/info.",
|
|
5500
|
-
"Pre-fund requires canonical_id so the agent can derive a per-DVM refund subkey. Upgrade the builder SDK to one that advertises it
|
|
5490
|
+
"Pre-fund requires canonical_id so the agent can derive a per-DVM refund subkey. Upgrade the builder SDK to one that advertises it."
|
|
5501
5491
|
);
|
|
5502
5492
|
}
|
|
5503
5493
|
if (!cashu.mints.includes(opts.mintUrl)) {
|
|
@@ -6154,7 +6144,7 @@ async function refundX402BatchChannelLocked(args) {
|
|
|
6154
6144
|
// own `balance <= charged` guard lets the request out. How much comes
|
|
6155
6145
|
// back is the DVM's to decide: it settles against a base derived from
|
|
6156
6146
|
// the credit it owes, and corrects this one over a 402 when they differ
|
|
6157
|
-
//
|
|
6147
|
+
// Deliberately no `amount` below, for the same reason.
|
|
6158
6148
|
//
|
|
6159
6149
|
// The exposure above deliberately does *not* raise this seed. The
|
|
6160
6150
|
// voucher signed here is fresh claim authority handed to the DVM, and
|
|
@@ -7342,7 +7332,7 @@ async function fundOverX402(args, fundId, resumed, corrected = false, locked = f
|
|
|
7342
7332
|
channelId: payment.channelId,
|
|
7343
7333
|
requestedAt: Date.now(),
|
|
7344
7334
|
// What the signature covers, not what the funding asked for. The exit's
|
|
7345
|
-
// exposure report uses this, and the two figures differ
|
|
7335
|
+
// exposure report uses this, and the two figures differ.
|
|
7346
7336
|
maxClaimableMicro: payment.maxClaimableMicro,
|
|
7347
7337
|
...payment.depositMicro !== void 0 ? { depositMicro: payment.depositMicro } : {},
|
|
7348
7338
|
...payment.authorizationValidBefore !== void 0 ? { authorizationValidBefore: payment.authorizationValidBefore } : {}
|
|
@@ -7386,13 +7376,8 @@ async function fundOverX402(args, fundId, resumed, corrected = false, locked = f
|
|
|
7386
7376
|
base,
|
|
7387
7377
|
result,
|
|
7388
7378
|
void 0,
|
|
7389
|
-
//
|
|
7390
|
-
//
|
|
7391
|
-
// requirement's own `accepted.network`. Keyed by channel id, so it is the
|
|
7392
|
-
// chain *this* funding rode rather than the wallet's pin — which is what
|
|
7393
|
-
// makes it survive a resume that crosses an `x402-network` re-pin, and
|
|
7394
|
-
// what keeps a re-pinned wallet from re-stating the credit's chain as
|
|
7395
|
-
// wherever it points today.
|
|
7379
|
+
// Record the accepted channel's chain, rather than a wallet pin that may have changed
|
|
7380
|
+
// during a replay.
|
|
7396
7381
|
findX402Channel({ channelId: pending.channelId })?.network
|
|
7397
7382
|
);
|
|
7398
7383
|
recordSpendOnce({
|
|
@@ -7544,7 +7529,7 @@ function x402BindingRefusalCopy(err, creditId) {
|
|
|
7544
7529
|
return {
|
|
7545
7530
|
display: "This prepaid balance was opened by a one-off x402 payment, so x402's reusable channel can't top it up. Nothing was credited.",
|
|
7546
7531
|
// The flavour is not the caller's to pick, but it is no longer the live
|
|
7547
|
-
// menu's either:
|
|
7532
|
+
// menu's either: records the binding this refusal just named, so
|
|
7548
7533
|
// the next top-up of this credit signs a one-off payment rather than
|
|
7549
7534
|
// another channel deposit. That makes the retry the fix wherever this DVM
|
|
7550
7535
|
// still takes one — and where it doesn't, the answer is refused locally
|
|
@@ -7628,7 +7613,7 @@ async function fundOverCashu(args, fundId) {
|
|
|
7628
7613
|
cashuP2pk: {
|
|
7629
7614
|
mints: args.cashuMint ? [args.cashuMint] : [...cashu.mints],
|
|
7630
7615
|
lock_pubkey: lockPubkey,
|
|
7631
|
-
//
|
|
7616
|
+
// refund clause on the funding outputs too — a top-up the DVM
|
|
7632
7617
|
// never confirms is the same stranded capital a per-call spend would be.
|
|
7633
7618
|
canonical_id: cashu.canonical_id,
|
|
7634
7619
|
min_locktime: cashu.min_locktime
|
|
@@ -7852,7 +7837,7 @@ async function fundOverMppCharge(args, fundId, resumed, locked = false) {
|
|
|
7852
7837
|
privateKey: account.privateKey,
|
|
7853
7838
|
// This funding's own intent is the basis the ceiling is measured against:
|
|
7854
7839
|
// the DVM authors the figure that gets signed, and a challenge more than
|
|
7855
|
-
// the shared tolerance above the ask is refused unsigned
|
|
7840
|
+
// the shared tolerance above the ask is refused unsigned.
|
|
7856
7841
|
basisMicro: args.amountMicro,
|
|
7857
7842
|
onError: "throw"
|
|
7858
7843
|
});
|
|
@@ -8493,7 +8478,7 @@ async function fundOverLightning(args, fundId, resumed) {
|
|
|
8493
8478
|
// it wrote none, its message appended to ours. A wallet that said "no
|
|
8494
8479
|
// route to the destination" is telling the caller something a generic
|
|
8495
8480
|
// "didn't go through" throws away, and this is the one funding failure a
|
|
8496
|
-
// human has to act on themselves
|
|
8481
|
+
// human has to act on themselves.
|
|
8497
8482
|
display: typeof mapped?.data?.display === "string" ? mapped.data.display : `The Lightning payment for this credit didn't go through${mapped ? ` (${mapped.code})` : ""}. The credit was not funded.${mapped?.message ? ` ${mapped.message}` : ""}`,
|
|
8498
8483
|
hint: belowKnownFloor ? `This amount is below the $${formatUsd((args.menu?.lightning_min_micro ?? 0) / 1e6)} minimum this DVM sets for Lightning, so no retry can pay it. Refill the agent's ecash pocket with 'dvm wallet fund' and fund with ecash instead.` : mapped?.hint
|
|
8499
8484
|
};
|
|
@@ -8594,13 +8579,13 @@ function settled(args, base, result, spentSats, x402ChannelNetwork) {
|
|
|
8594
8579
|
targetMicro: args.targetMicro ?? result.credit.remaining_micro,
|
|
8595
8580
|
// The rail is a pin, not a preference: every later top-up of this credit
|
|
8596
8581
|
// has to arrive on it or the DVM refuses. Within x402 the instrument is
|
|
8597
|
-
// pinned the same way and for the same reason
|
|
8582
|
+
// pinned the same way and for the same reason.
|
|
8598
8583
|
rail: base.rail,
|
|
8599
8584
|
...base.x402Flavour ? { x402Instrument: x402InstrumentForFlavour(base.x402Flavour) } : {},
|
|
8600
8585
|
...x402ChannelNetwork ? { x402ChannelNetwork } : {},
|
|
8601
8586
|
...args.menu ? { menu: args.menu } : {},
|
|
8602
8587
|
// Identity, so the offline headroom view can match a `trustOverrides`
|
|
8603
|
-
// pre-grant without re-describing the DVM
|
|
8588
|
+
// pre-grant without re-describing the DVM.
|
|
8604
8589
|
...args.providerInfo?.builder?.pubkey ? { builderPubkey: args.providerInfo.builder.pubkey } : {},
|
|
8605
8590
|
sequenced: result.replayed !== true
|
|
8606
8591
|
});
|
|
@@ -9322,9 +9307,6 @@ async function probeLightning(timeoutMs) {
|
|
|
9322
9307
|
error: {
|
|
9323
9308
|
code: mapped.code,
|
|
9324
9309
|
message: mapped.message,
|
|
9325
|
-
// The same drop fixed one branch down: `float_invalid_uri` knows to say
|
|
9326
|
-
// "reconnect with a URI copied whole", and the row was rendering the
|
|
9327
|
-
// generic rail hint over the top of it (internal-review).
|
|
9328
9310
|
...mapped.hint ? { hint: mapped.hint } : {},
|
|
9329
9311
|
...refusalFields(mapped.data)
|
|
9330
9312
|
}
|
|
@@ -9363,10 +9345,6 @@ async function probeLightning(timeoutMs) {
|
|
|
9363
9345
|
error: {
|
|
9364
9346
|
code: probe.error?.code ?? "float_wallet_offline",
|
|
9365
9347
|
message: probe.error?.message ?? "The Lightning wallet did not respond.",
|
|
9366
|
-
// Lightning was the one rail dropping the probe's own diagnosis here,
|
|
9367
|
-
// so every float failure rendered as the generic "re-connect" remedy —
|
|
9368
|
-
// the wrong move for a connection the wallet refused on a permission
|
|
9369
|
-
// (internal-review). x402 and Tempo already forward theirs via `classifyError`.
|
|
9370
9348
|
...probe.error?.hint ? { hint: probe.error.hint } : {},
|
|
9371
9349
|
...refusalFields(probe.error?.data)
|
|
9372
9350
|
}
|
|
@@ -9376,7 +9354,6 @@ async function probeLightning(timeoutMs) {
|
|
|
9376
9354
|
rail: "lightning",
|
|
9377
9355
|
configured: true,
|
|
9378
9356
|
reachable: true,
|
|
9379
|
-
// Left absent, never coerced to 0 — see `details.balance_unknown` above.
|
|
9380
9357
|
...probe.balanceMsats === void 0 ? {} : { balanceMsats: probe.balanceMsats },
|
|
9381
9358
|
details
|
|
9382
9359
|
};
|
|
@@ -9420,7 +9397,7 @@ async function probeX402(x402, timeoutMs) {
|
|
|
9420
9397
|
let network;
|
|
9421
9398
|
let address;
|
|
9422
9399
|
try {
|
|
9423
|
-
const { loadX402Wallet: loadX402Wallet2, getX402Balance: getX402Balance2, ensureAddress: ensureAddress2, usdcContractByCaip2: usdcContractByCaip22 } = await import("../x402-
|
|
9400
|
+
const { loadX402Wallet: loadX402Wallet2, getX402Balance: getX402Balance2, ensureAddress: ensureAddress2, usdcContractByCaip2: usdcContractByCaip22 } = await import("../x402-7S2EFINY.js");
|
|
9424
9401
|
const wallet = loadX402Wallet2();
|
|
9425
9402
|
if (!wallet) {
|
|
9426
9403
|
const storedKey = x402.privateKey;
|
|
@@ -9450,16 +9427,10 @@ async function probeX402(x402, timeoutMs) {
|
|
|
9450
9427
|
configured: true,
|
|
9451
9428
|
reachable: true,
|
|
9452
9429
|
balanceUsdc: balance.usdc,
|
|
9453
|
-
// internal-review: record the contract the balance was actually read against —
|
|
9454
|
-
// a zero here only means "none of *this* token, on *this* chain". Map
|
|
9455
|
-
// lookup off the network already resolved; no second RPC.
|
|
9456
9430
|
details: {
|
|
9457
9431
|
address: w.address,
|
|
9458
9432
|
network: w.network,
|
|
9459
9433
|
token: usdcContractByCaip22(w.network),
|
|
9460
|
-
// internal-review: and the endpoint that answered, which the caller can
|
|
9461
|
-
// point elsewhere — a wrong one reads as a plausible $0.00 otherwise.
|
|
9462
|
-
// Redacted here, at the boundary where the URL becomes display.
|
|
9463
9434
|
...rpcDetails(balance.rpcUrlRedacted, balance.rpcSource)
|
|
9464
9435
|
}
|
|
9465
9436
|
};
|
|
@@ -9478,7 +9449,7 @@ async function probeMpp(mpp, timeoutMs) {
|
|
|
9478
9449
|
if (!mpp) return null;
|
|
9479
9450
|
if (mpp.method === "tempo") {
|
|
9480
9451
|
try {
|
|
9481
|
-
const { connectedTempoAccount: connectedTempoAccount2, getTempoUsdcBalance: getTempoUsdcBalance2, resolveTempoNetwork: resolveTempoNetwork2 } = await import("../tempo-wallet-
|
|
9452
|
+
const { connectedTempoAccount: connectedTempoAccount2, getTempoUsdcBalance: getTempoUsdcBalance2, resolveTempoNetwork: resolveTempoNetwork2 } = await import("../tempo-wallet-O67H5M4N.js");
|
|
9482
9453
|
const account = await connectedTempoAccount2();
|
|
9483
9454
|
if (!account) {
|
|
9484
9455
|
return {
|
|
@@ -9499,13 +9470,10 @@ async function probeMpp(mpp, timeoutMs) {
|
|
|
9499
9470
|
configured: true,
|
|
9500
9471
|
reachable: true,
|
|
9501
9472
|
balanceUsdc: balance.usdc,
|
|
9502
|
-
// internal-review: record the contract the balance was actually read
|
|
9503
|
-
// against — a zero here only means "none of *this* token".
|
|
9504
9473
|
details: {
|
|
9505
9474
|
address: account.address,
|
|
9506
9475
|
chain_id: balance.chainId,
|
|
9507
9476
|
token: balance.tokenAddress,
|
|
9508
|
-
// internal-review: as on x402 above — which endpoint the number came from.
|
|
9509
9477
|
...rpcDetails(balance.rpcUrlRedacted, balance.rpcSource)
|
|
9510
9478
|
}
|
|
9511
9479
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { FacilitatorConfig } from '@x402/core/server';
|
|
2
|
-
import { aj as PaymentPayload, ap as PaymentRequirementsV1, aq as PaymentRequirementsV2, aE as X402Config, av as SettleResponse, aC as VerifyResponse, bi as X402ExactVersionSupport, bj as X402Receipt, bk as TransactionalPayoutHook, bl as CashuMeltCompleted } from '../step-cache-
|
|
3
|
-
export { bm as CreditDepositPayload, bn as CreditDrainPayload, bo as FundingLot, bp as LotDebit, bq as LotDepletion, br as MppxServer, bs as NON_CHANNEL_BITCOIN_RAILS, bt as NonChannelBitcoinRail, bu as PayoutReporter, bv as PostgresTempoSessionStore, bw as RevenueReporter, bx as SIGNED_ENVELOPE_FIELDS, by as SIGNED_ENVELOPE_TYPES, bz as X402TrackedChannel, bA as _testing, bB as createDefaultReplayStore, bC as depleteLots, bD as fifoOrder, bE as inKindDrawMsats, bF as isInKindDepletion, bG as isNonChannelBitcoinRail, bH as lotOwedSats, bI as netOwedSats, bJ as wrapMppx } from '../step-cache-
|
|
2
|
+
import { aj as PaymentPayload, ap as PaymentRequirementsV1, aq as PaymentRequirementsV2, aE as X402Config, av as SettleResponse, aC as VerifyResponse, bi as X402ExactVersionSupport, bj as X402Receipt, bk as TransactionalPayoutHook, bl as CashuMeltCompleted } from '../step-cache-CXg7ziML.js';
|
|
3
|
+
export { bm as CreditDepositPayload, bn as CreditDrainPayload, bo as FundingLot, bp as LotDebit, bq as LotDepletion, br as MppxServer, bs as NON_CHANNEL_BITCOIN_RAILS, bt as NonChannelBitcoinRail, bu as PayoutReporter, bv as PostgresTempoSessionStore, bw as RevenueReporter, bx as SIGNED_ENVELOPE_FIELDS, by as SIGNED_ENVELOPE_TYPES, bz as X402TrackedChannel, bA as _testing, bB as createDefaultReplayStore, bC as depleteLots, bD as fifoOrder, bE as inKindDrawMsats, bF as isInKindDepletion, bG as isNonChannelBitcoinRail, bH as lotOwedSats, bI as netOwedSats, bJ as wrapMppx } from '../step-cache-CXg7ziML.js';
|
|
4
4
|
import { Hono } from 'hono';
|
|
5
5
|
import { Env, BlankSchema } from 'hono/types';
|
|
6
6
|
import { Pool } from 'pg';
|
|
7
7
|
export { Pool } from 'pg';
|
|
8
|
-
import { g as getWallet } from '../wallet-
|
|
9
|
-
import { A as AccumulatorPool, a as AccumulatorQuerier, C as ConsumedCredentialStore } from '../credit-menu-
|
|
10
|
-
export { b as AppEnv, c as CreditFundingReport, F as FiatDenomination, d as FiatDenominationFailure, e as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, f as PaymentErrorCode, g as PaymentErrorDetail, h as PaymentInfo, R as ReporterBannerOpts, i as ResolvedFx, j as RevenueBootCheckOpts, S as SDKServerOpts, k as ServerJob, l as ShortPayForfeit, T as TempoChannelReport, m as TempoObserverHealth, n as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, o as VerifyIncomingSnapshot, X as X402BatchChannelObservation, p as X402FacilitatorHealth, q as X402SettlementEvidenceOutcome, r as X402SettlementRepair, s as X402SettlementRepairRefusal, t as X402SettlementRepaired, u as X402WedgedSettlement, v as X402WedgedSettlementPage, w as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, x as abortJob, y as applyPaymentInfoToJob, z as assertRevenueReporterReady, B as buildPaymentErrorResponse, D as clearAccumulatorForDvm, E as createDVMServer, G as creditDepositPayload, H as derivedFundCreditId, K as devModeSkipsPaymentVerification, L as fromJobRecord, N as fundedMicroFor, O as hasPaymentProof, Q as hashLockKey, W as implicitCreditId, Y as initWalletAccumulatorTable, Z as insertAccumulatorRows, _ as isDerivedCreditId, $ as isTerminal, a0 as isYieldMessage, a1 as issueUpfrontChallenges, a2 as msatsToFiatMicro, a3 as paymentErrorBody, a4 as pinAskFiat, a5 as priceFiatMicro, a6 as processIncomingPayment, a7 as providerMessage, a8 as repairX402ExactSettlementEffect, a9 as resolveFxSnapshot, aa as resolvePriceFiat, ab as revenueReporterBannerState, ac as toCreditTerms, ad as toJobRecord, ae as unknownRouteNotFound, af as verifyIncomingPayment, ag as verifyTempoSessionManagementCredential, ah as verifyUpfrontPayment, ai as x402RequiredUsdcMicro, aj as x402SettledShare } from '../credit-menu-
|
|
11
|
-
import { g as LockPubkey } from '../lightning-backend-
|
|
12
|
-
export { t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-
|
|
13
|
-
export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-
|
|
8
|
+
import { g as getWallet } from '../wallet-Dwjs5n_M.js';
|
|
9
|
+
import { A as AccumulatorPool, a as AccumulatorQuerier, C as ConsumedCredentialStore } from '../credit-menu-D4Gcdgc4.js';
|
|
10
|
+
export { b as AppEnv, c as CreditFundingReport, F as FiatDenomination, d as FiatDenominationFailure, e as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, f as PaymentErrorCode, g as PaymentErrorDetail, h as PaymentInfo, R as ReporterBannerOpts, i as ResolvedFx, j as RevenueBootCheckOpts, S as SDKServerOpts, k as ServerJob, l as ShortPayForfeit, T as TempoChannelReport, m as TempoObserverHealth, n as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, o as VerifyIncomingSnapshot, X as X402BatchChannelObservation, p as X402FacilitatorHealth, q as X402SettlementEvidenceOutcome, r as X402SettlementRepair, s as X402SettlementRepairRefusal, t as X402SettlementRepaired, u as X402WedgedSettlement, v as X402WedgedSettlementPage, w as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, x as abortJob, y as applyPaymentInfoToJob, z as assertRevenueReporterReady, B as buildPaymentErrorResponse, D as clearAccumulatorForDvm, E as createDVMServer, G as creditDepositPayload, H as derivedFundCreditId, K as devModeSkipsPaymentVerification, L as fromJobRecord, N as fundedMicroFor, O as hasPaymentProof, Q as hashLockKey, W as implicitCreditId, Y as initWalletAccumulatorTable, Z as insertAccumulatorRows, _ as isDerivedCreditId, $ as isTerminal, a0 as isYieldMessage, a1 as issueUpfrontChallenges, a2 as msatsToFiatMicro, a3 as paymentErrorBody, a4 as pinAskFiat, a5 as priceFiatMicro, a6 as processIncomingPayment, a7 as providerMessage, a8 as repairX402ExactSettlementEffect, a9 as resolveFxSnapshot, aa as resolvePriceFiat, ab as revenueReporterBannerState, ac as toCreditTerms, ad as toJobRecord, ae as unknownRouteNotFound, af as verifyIncomingPayment, ag as verifyTempoSessionManagementCredential, ah as verifyUpfrontPayment, ai as x402RequiredUsdcMicro, aj as x402SettledShare } from '../credit-menu-D4Gcdgc4.js';
|
|
11
|
+
import { g as LockPubkey } from '../lightning-backend-CQBnQgsT.js';
|
|
12
|
+
export { t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-CQBnQgsT.js';
|
|
13
|
+
export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-B2uZvga4.js';
|
|
14
14
|
import { Store } from 'mppx';
|
|
15
15
|
import { z } from 'zod';
|
|
16
16
|
import '@x402/evm/batch-settlement/server';
|
|
17
17
|
import 'viem';
|
|
18
18
|
import '@x402/core/types';
|
|
19
19
|
import '@cashu/cashu-ts';
|
|
20
|
-
import '../fx-
|
|
20
|
+
import '../fx-B0SLBe5x.js';
|
|
21
21
|
|
|
22
22
|
/** POST a verify request to the configured facilitator. */
|
|
23
23
|
declare function verifyWithFacilitator(payload: PaymentPayload, requirements: PaymentRequirementsV1 | PaymentRequirementsV2, config?: Pick<X402Config, "facilitator" | "facilitatorAuth">, createAuthHeaders?: FacilitatorConfig["createAuthHeaders"] | undefined): Promise<VerifyResponse>;
|
|
@@ -25,17 +25,17 @@ declare function verifyWithFacilitator(payload: PaymentPayload, requirements: Pa
|
|
|
25
25
|
declare function settleWithFacilitator(payload: PaymentPayload, requirements: PaymentRequirementsV1 | PaymentRequirementsV2, config?: Pick<X402Config, "facilitator" | "facilitatorAuth">, createAuthHeaders?: FacilitatorConfig["createAuthHeaders"] | undefined): Promise<SettleResponse>;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Verify an x402 `X-PAYMENT` header per the x402 spec
|
|
28
|
+
* Verify an x402 `X-PAYMENT` header per the x402 spec.
|
|
29
29
|
*
|
|
30
30
|
* Flow:
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
31
|
+
* 1. Decode the base64 `PaymentPayload`
|
|
32
|
+
* 2. Rebuild the `PaymentRequirements` the server advertised on the 402 — the
|
|
33
|
+
* facilitator deep-equals these against the payload's authorization, so a
|
|
34
|
+
* credential bought against any other set fails verification.
|
|
35
|
+
* 3. Call the facilitator's `/verify`
|
|
36
|
+
* 4. On valid, call the facilitator's `/settle` to broadcast the EIP-3009
|
|
37
|
+
* `transferWithAuthorization`. The on-chain tx hash flows through to the
|
|
38
|
+
* receipt and into `X-PAYMENT-RESPONSE` for the client.
|
|
39
39
|
*
|
|
40
40
|
* A positive `btcUsdRate` converts the settled USDC back to msats. Zero means
|
|
41
41
|
* the requirement was already stated exactly in USD and no rate was needed;
|
|
@@ -48,8 +48,8 @@ declare function verifyX402Payment(paymentHeader: string, config: X402Config, re
|
|
|
48
48
|
/**
|
|
49
49
|
* Snapshot of a DVM's published lock-pubkey state at a point in time. `current`
|
|
50
50
|
* is what the SDK advertises as `cashu.lock_pubkeys[0]`; `retired` are the
|
|
51
|
-
* pubkeys
|
|
52
|
-
*
|
|
51
|
+
* pubkeys inside the rotation grace window plus legacy sentinel-0 entries
|
|
52
|
+
* kept until explicitly cleaned up. Both halves are needed by the
|
|
53
53
|
* receive path (accept proofs locked to any entry) and the admin auth verifier
|
|
54
54
|
* (accept signatures from any entry during grace).
|
|
55
55
|
*/
|
|
@@ -67,10 +67,6 @@ interface LockPubkeyState {
|
|
|
67
67
|
* a process restart.
|
|
68
68
|
*/
|
|
69
69
|
type LockPubkeyStateLoader = () => Promise<LockPubkeyState>;
|
|
70
|
-
/**
|
|
71
|
-
* Subset of pg.Pool used by the lock-pubkey store. Sharing `AccumulatorPool`
|
|
72
|
-
* keeps the SDK's "pass me a Postgres pool" surface uniform across stores.
|
|
73
|
-
*/
|
|
74
70
|
type LockPubkeyPool = AccumulatorPool;
|
|
75
71
|
/**
|
|
76
72
|
* Create the `dvm_lock_pubkeys` table if absent. Each row is one entry in a
|
|
@@ -90,20 +86,16 @@ declare function initLockPubkeyTable(db: LockPubkeyPool): Promise<void>;
|
|
|
90
86
|
* Also backfills any distinct `lock_pubkey` values found in
|
|
91
87
|
* `wallet_accumulator` for this DVM that aren't yet in `dvm_lock_pubkeys`,
|
|
92
88
|
* inserting them as retired rows with `retired_at_ms = 0` — the
|
|
93
|
-
* "long-retired-still-meltable" sentinel. This handles
|
|
89
|
+
* "long-retired-still-meltable" sentinel. This handles legacy batches
|
|
94
90
|
* that would otherwise trip the monitor's `orphan_lock_pubkey` alarm every
|
|
95
91
|
* tick. Sentinel-0 rows are exempt from grace-window filtering and
|
|
96
92
|
* `pruneRetired` so they stay visible until the operator melts the legacy
|
|
97
93
|
* batches and the receive path keeps accepting in-flight tokens locked to
|
|
98
94
|
* them.
|
|
99
95
|
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* first-boot window. Closed the same way, with `ON CONFLICT DO NOTHING` on
|
|
104
|
-
* that partial index: the boot lock (internal-review) serializes the cross-machine
|
|
105
|
-
* half, but two callers on one pool share its acquisition (a fire-and-forget
|
|
106
|
-
* hydrate overlapping boot's), so the guard has to hold without it.
|
|
96
|
+
* `ON CONFLICT DO NOTHING` must remain even under the boot lock: callers on
|
|
97
|
+
* one pool share its acquisition, so concurrent seeds can both pass the
|
|
98
|
+
* `WHERE NOT EXISTS` check before either insert commits.
|
|
107
99
|
*/
|
|
108
100
|
declare function seedLockPubkeyState(db: LockPubkeyPool, dvmId: string, pubkey: string, now?: number): Promise<void>;
|
|
109
101
|
/**
|
|
@@ -137,18 +129,12 @@ declare function rotateLockPubkey(db: LockPubkeyPool, dvmId: string, newPubkey:
|
|
|
137
129
|
*/
|
|
138
130
|
declare function pruneRetired(db: AccumulatorQuerier, dvmId: string, graceMs: number, now?: number): Promise<number>;
|
|
139
131
|
/**
|
|
140
|
-
* Default rotation grace window
|
|
141
|
-
*
|
|
132
|
+
* Default rotation grace window in seconds. Override through
|
|
133
|
+
* `SDKServerOpts.lockPubkeyGraceSeconds`.
|
|
142
134
|
*/
|
|
143
135
|
declare const DEFAULT_LOCK_PUBKEY_GRACE_SECONDS = 86400;
|
|
144
|
-
/**
|
|
145
|
-
* Lift a single pubkey + grace-filtered retired list into the flat array the
|
|
146
|
-
* accept path checks against. Convenience for call sites that don't care
|
|
147
|
-
* about the retired-row structure.
|
|
148
|
-
*/
|
|
149
136
|
declare function activePubkeySet(state: LockPubkeyState): LockPubkey[];
|
|
150
137
|
|
|
151
|
-
/** Options for `installAdminCashuRoutes`. */
|
|
152
138
|
interface InstallAdminCashuRoutesOpts {
|
|
153
139
|
/** Pool against the SDK's accumulator DB. */
|
|
154
140
|
db: Pool;
|
|
@@ -157,7 +143,7 @@ interface InstallAdminCashuRoutesOpts {
|
|
|
157
143
|
/**
|
|
158
144
|
* Live lock-pubkey state loader. Auth accepts a signature from the current
|
|
159
145
|
* pubkey or any retired pubkey still within the rotation grace window
|
|
160
|
-
*
|
|
146
|
+
* The `/admin/cashu/rotate-lock-pubkey` route narrows that to
|
|
161
147
|
* current-only.
|
|
162
148
|
*/
|
|
163
149
|
getLockPubkeyState: LockPubkeyStateLoader;
|
|
@@ -166,7 +152,7 @@ interface InstallAdminCashuRoutesOpts {
|
|
|
166
152
|
/** Replay-protection store keyed by nonce. */
|
|
167
153
|
nonceStore: ConsumedCredentialStore;
|
|
168
154
|
/**
|
|
169
|
-
* Runs inside the transaction that marks the rows melted
|
|
155
|
+
* Runs inside the transaction that marks the rows melted: the
|
|
170
156
|
* proofs are SPENT and the Lightning payment reached the builder, so the
|
|
171
157
|
* melt is a landed payout, and its report commits with the mark or not at
|
|
172
158
|
* all. `enqueue` throwing rolls the mark back and fails the call — the CLI's
|
|
@@ -194,7 +180,7 @@ declare function createAdminCashuNonceStore(): ConsumedCredentialStore;
|
|
|
194
180
|
|
|
195
181
|
/**
|
|
196
182
|
* The `fx_rate_unavailable` payment-error detail, shaped like every other flat
|
|
197
|
-
* payment error
|
|
183
|
+
* payment error: a flat machine `error` code plus `message` and the
|
|
198
184
|
* `display`/`hint`/`retryable` fields an agent relays verbatim and branches
|
|
199
185
|
* retries on — the shape the `paymentErrorBody` builder enforces for the sibling
|
|
200
186
|
* 503s (`mint_health_pending`, `cashu_mint_sick`) and the 402 family alike. This
|
|
@@ -211,11 +197,7 @@ declare function rateUnavailablePaymentError(): {
|
|
|
211
197
|
/**
|
|
212
198
|
* Create a fetch wrapper that emits `dvm.fetch` spans via `loggers.isolate`.
|
|
213
199
|
*
|
|
214
|
-
*
|
|
215
|
-
* status code. When observability is disabled, `loggers.isolate` is the no-op
|
|
216
|
-
* logger — `span()` calls `fn()` directly with zero overhead.
|
|
217
|
-
*
|
|
218
|
-
* `signal` (internal-review) is the job's cancellation signal. When supplied, every
|
|
200
|
+
* `signal` is the job's cancellation signal. When supplied, every
|
|
219
201
|
* request made through this fetch aborts on job cancel — that is what stops
|
|
220
202
|
* provider spend mid-job. It is *merged* with any caller-supplied
|
|
221
203
|
* `init.signal` rather than replacing it, so a per-request timeout (scrapfly,
|
|
@@ -232,7 +214,7 @@ interface JobCredentialRequest {
|
|
|
232
214
|
header(name: string): string | undefined;
|
|
233
215
|
}
|
|
234
216
|
/**
|
|
235
|
-
*
|
|
217
|
+
* the credential gate on a runtime's `/v1/job/:id/*` routes — the
|
|
236
218
|
* "did this request present anything?" predicate and the 401 body that answers
|
|
237
219
|
* when it didn't, built together so the copy can never describe a credential
|
|
238
220
|
* the predicate doesn't accept.
|
|
@@ -244,20 +226,20 @@ interface JobCredentialGate {
|
|
|
244
226
|
body(): Record<string, unknown>;
|
|
245
227
|
}
|
|
246
228
|
/**
|
|
247
|
-
*
|
|
229
|
+
* build the credential gate for one runtime.
|
|
248
230
|
*
|
|
249
231
|
* `acceptsBearer` is what separates them. The isolate tier derives
|
|
250
232
|
* `requesterId` from `Authorization: Bearer`, so a Bearer token really is a
|
|
251
233
|
* job credential there. The SDK server does not — its auth middleware pins
|
|
252
234
|
* `requesterId` to `anonymous`/`dev-anonymous`, so every SDK job is gated on
|
|
253
|
-
* the
|
|
235
|
+
* the `X-Job-Token` and a Bearer header proves nothing. Counting it
|
|
254
236
|
* anyway would send a stale client that happens to send one back to the
|
|
255
237
|
* opaque 404 this exists to eliminate.
|
|
256
238
|
*
|
|
257
239
|
* A request carrying no accepted credential can be refused before the job is
|
|
258
240
|
* ever looked up, which is what makes {@link JobCredentialGate.body} safe to
|
|
259
241
|
* be specific about — the 404-not-403 choice on a *failed* ownership check is
|
|
260
|
-
* deliberate (
|
|
242
|
+
* deliberate (a wrong credential must never confirm a job id exists),
|
|
261
243
|
* and that property is untouched here because this body is returned before any
|
|
262
244
|
* store lookup, identical whether or not the job exists.
|
|
263
245
|
*
|
|
@@ -268,7 +250,6 @@ declare function jobCredentialGate(opts: {
|
|
|
268
250
|
acceptsBearer: boolean;
|
|
269
251
|
}): JobCredentialGate;
|
|
270
252
|
|
|
271
|
-
/** Options for `PostgresTempoChargeStore`. */
|
|
272
253
|
interface PostgresTempoChargeStoreOpts {
|
|
273
254
|
/** Table name. Defaults to `"mpp_tempo_charge_replays"`. Must match `/^[a-zA-Z_][a-zA-Z0-9_]*$/`. */
|
|
274
255
|
tableName?: string;
|
|
@@ -288,7 +269,7 @@ interface PostgresTempoChargeStoreOpts {
|
|
|
288
269
|
}
|
|
289
270
|
/**
|
|
290
271
|
* Postgres implementation of the atomic store mppx's `tempo.charge` uses for
|
|
291
|
-
* replay protection
|
|
272
|
+
* replay protection.
|
|
292
273
|
*
|
|
293
274
|
* mppx refuses a charge credential whose transaction hash it has already taken
|
|
294
275
|
* (`markHashUsed`), and refuses a zero-dollar proof credential whose challenge
|
|
@@ -350,7 +331,7 @@ declare class PostgresTempoChargeStore implements Store.AtomicStore {
|
|
|
350
331
|
* connection is held for exactly that long and never across a chain call.
|
|
351
332
|
*/
|
|
352
333
|
update<result>(key: string, fn: (current: unknown) => Store.Change<unknown, result>): Promise<result>;
|
|
353
|
-
/** The boot DDL itself — always runs under {@link withSdkInitLock}
|
|
334
|
+
/** The boot DDL itself — always runs under {@link withSdkInitLock}. */
|
|
354
335
|
private createTables;
|
|
355
336
|
private maybeSweep;
|
|
356
337
|
}
|
|
@@ -373,7 +354,6 @@ declare const TEMPO_CLOSE_REQUESTED_TOPIC = "0xf5a36fc00a96cbb9cf1f8f59299165e1d
|
|
|
373
354
|
*/
|
|
374
355
|
declare const TEMPO_CLOSE_DB_RECOVERY_BUDGET_MS = 15000;
|
|
375
356
|
|
|
376
|
-
/** Humanised `{ message, hint }` derived from a ZodError for the `invalid_input`/`invalid_quote_data` envelope. */
|
|
377
357
|
interface HumanizedZodError {
|
|
378
358
|
message: string;
|
|
379
359
|
hint: string;
|
|
@@ -391,11 +371,6 @@ interface HumanizedZodError {
|
|
|
391
371
|
* that fit: a chunking hint is the one output that tells a caller what to
|
|
392
372
|
* actually do, and losing it because the oversized field sorted fourth is the
|
|
393
373
|
* same class of unhelpful answer this whole path exists to avoid.
|
|
394
|
-
*
|
|
395
|
-
* The `ZodError.message` field is itself a JSON-stringified array of issues
|
|
396
|
-
* (per Zod's default Error contract). Using it raw — as the SDK previously
|
|
397
|
-
* did — leaks the unstructured array into the agent-facing response, which
|
|
398
|
-
* is what internal-review fixes.
|
|
399
374
|
*/
|
|
400
375
|
declare function humanizeZodError(err: z.ZodError, opts: {
|
|
401
376
|
schemaUrl: string;
|
package/dist/internal/server.js
CHANGED
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
} from "../chunk-BIFLRKMO.js";
|
|
7
7
|
import {
|
|
8
8
|
RevenueReporter
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-6GRIKOFB.js";
|
|
10
10
|
import {
|
|
11
11
|
PayoutReporter
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-L67WTZX2.js";
|
|
13
13
|
import {
|
|
14
14
|
PostgresTempoChargeStore
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-MRAGS5VP.js";
|
|
16
16
|
import "../chunk-YG7G4DPZ.js";
|
|
17
17
|
import {
|
|
18
18
|
DEFAULT_LOCK_PUBKEY_GRACE_SECONDS,
|
|
@@ -65,13 +65,13 @@ import {
|
|
|
65
65
|
verifyUpfrontPayment,
|
|
66
66
|
x402RequiredUsdcMicro,
|
|
67
67
|
x402SettledShare
|
|
68
|
-
} from "../chunk-
|
|
69
|
-
import "../chunk-
|
|
68
|
+
} from "../chunk-PCUQZDZA.js";
|
|
69
|
+
import "../chunk-QT4ONTST.js";
|
|
70
70
|
import {
|
|
71
71
|
settleWithFacilitator,
|
|
72
72
|
verifyWithFacilitator
|
|
73
73
|
} from "../chunk-BQ2NMWKE.js";
|
|
74
|
-
import "../chunk-
|
|
74
|
+
import "../chunk-PHHAYRQV.js";
|
|
75
75
|
import {
|
|
76
76
|
SIGNED_ENVELOPE_FIELDS,
|
|
77
77
|
SIGNED_ENVELOPE_TYPES,
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
isYieldMessage,
|
|
89
89
|
providerMessage,
|
|
90
90
|
toJobRecord
|
|
91
|
-
} from "../chunk-
|
|
91
|
+
} from "../chunk-JDT5LCJC.js";
|
|
92
92
|
import {
|
|
93
93
|
toLockPubkey
|
|
94
94
|
} from "../chunk-KXCKFIJI.js";
|
|
@@ -96,10 +96,10 @@ import "../chunk-Z4BNLUZF.js";
|
|
|
96
96
|
import "../chunk-5URG56JJ.js";
|
|
97
97
|
import "../chunk-MKI6OVW4.js";
|
|
98
98
|
import "../chunk-KXZUCCEY.js";
|
|
99
|
-
import "../chunk-
|
|
99
|
+
import "../chunk-XQXJKJ3P.js";
|
|
100
100
|
import "../chunk-66HGCPBU.js";
|
|
101
101
|
import "../chunk-FUJ36YDV.js";
|
|
102
|
-
import "../chunk-
|
|
102
|
+
import "../chunk-4A2RAKCW.js";
|
|
103
103
|
import "../chunk-AT6V3SY7.js";
|
|
104
104
|
import {
|
|
105
105
|
NON_CHANNEL_BITCOIN_RAILS,
|
|
@@ -110,13 +110,13 @@ import {
|
|
|
110
110
|
isNonChannelBitcoinRail,
|
|
111
111
|
lotOwedSats,
|
|
112
112
|
netOwedSats
|
|
113
|
-
} from "../chunk-
|
|
113
|
+
} from "../chunk-V7EVFLAK.js";
|
|
114
114
|
import "../chunk-S3XAHZQY.js";
|
|
115
115
|
import "../chunk-C3MTFLC6.js";
|
|
116
116
|
import {
|
|
117
117
|
_testing,
|
|
118
118
|
wrapMppx
|
|
119
|
-
} from "../chunk-
|
|
119
|
+
} from "../chunk-KMZXTBLA.js";
|
|
120
120
|
export {
|
|
121
121
|
DEFAULT_LOCK_PUBKEY_GRACE_SECONDS,
|
|
122
122
|
JobCancelledError,
|