@dvmkit/sdk 0.1.0-rc.3 → 0.1.0-rc.5
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-FT7IM66W.js → chunk-4KB3LTOS.js} +1343 -1258
- package/dist/{chunk-XY5Y5REG.js → chunk-AAJNGQMC.js} +1 -1
- package/dist/{chunk-RHP3BRTH.js → chunk-AB3L6B52.js} +3 -3
- package/dist/{chunk-C2DC4FKR.js → chunk-ATQIII6K.js} +330 -9
- package/dist/{chunk-5SO7ZVOH.js → chunk-F2L6KIMD.js} +5 -0
- package/dist/{chunk-YD3TZNXV.js → chunk-ZMZTZFRC.js} +17 -2
- package/dist/{credit-menu-DONAtGVf.d.ts → credit-menu-ClA1JyYW.d.ts} +2 -2
- package/dist/{fx-Bq4cvn16.d.ts → fx-ptKVFOwq.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/internal/index.d.ts +236 -7
- package/dist/internal/index.js +45 -6
- package/dist/{job-store-m2pYmvbr.d.ts → job-store-DxFqDPYq.d.ts} +6 -1
- package/dist/server/index.d.ts +5 -5
- package/dist/server/index.js +5 -213
- package/dist/testing/index.d.ts +1 -1
- package/dist/{usd-DjVAPMlf.d.ts → usd-Cha_j80I.d.ts} +1 -1
- package/dist/{x402-5EVIUSEP.js → x402-3VQ64MCS.js} +4 -4
- package/package.json +1 -1
|
@@ -635,6 +635,11 @@ type Message = (MessageBase & {
|
|
|
635
635
|
type: "progress";
|
|
636
636
|
content: ProgressContent;
|
|
637
637
|
});
|
|
638
|
+
/** Type guard: message is a prompt from the provider. */
|
|
639
|
+
declare function isPromptMessage(msg: Message): msg is MessageBase & {
|
|
640
|
+
type: "prompt";
|
|
641
|
+
content: PromptContent;
|
|
642
|
+
};
|
|
638
643
|
/** Type guard: message contains an artifact. */
|
|
639
644
|
declare function isArtifactMessage(msg: Message): msg is MessageBase & {
|
|
640
645
|
type: "artifact";
|
|
@@ -6828,4 +6833,4 @@ interface StaleJobReapable {
|
|
|
6828
6833
|
/** Runtime type guard for StaleJobReapable. */
|
|
6829
6834
|
declare function isStaleJobReapable(store: JobStore): store is JobStore & StaleJobReapable;
|
|
6830
6835
|
|
|
6831
|
-
export { type PaymentRequired as $, type ApprovalContent as A, type SignedRequestDomain as B, type Currency as C, type DVMConfig as D, SignedRequestError as E, type SignedRequestFailure as F, type SignedRequestReplayStore as G, type SignedRequestSignOpts as H, type IncomingMessage as I, type JobRecord as J, type KVStore as K, type Logger as L, type SignedRequestStatementHeader as M, type SignedRequestVerifier as N, createSignedRequestVerifier as O, type PaymentContent as P, type QuoteConfig as Q, type ResolvedCreditConfig as R, type SDKJobContext as S, isZodSchema as T, UnsupportedCurrencyError as U, signedRequestStatementHeader as V, validateCurrency as W, type JsonValue as X, type FundingReceipt as Y, type ZodLike as Z, type JobReceipt as _, type DVMDescriptor as a, caip2ToX402Network as a$, type X402Version as a0, type MppxCredential as a1, type Message as a2, type MessageType as a3, type MppxChallenge as a4, X402_BATCH_SETTLEMENT_SCHEME as a5, X402_EXACT_SCHEME as a6, type X402Wallet as a7, type X402Config as a8, type X402ExactVersionSupport as a9, PayoutReporter as aA, PostgresTempoSessionStore as aB, RAIL_REFUNDABLE as aC, type ReceiptCredit as aD, type ReceiptOutcome as aE, type ReceiptPayment as aF, type ResourceInfo as aG, RevenueReporter as aH, SIGNED_ENVELOPE_FIELDS as aI, SIGNED_ENVELOPE_TYPES as aJ, type SettleResponse as aK, type StaleJobReapable as aL, StepCache as aM, type StepRecord as aN, type UnsignedDrainReceipt as aO, type UnsignedFundingReceipt as aP, type UnsignedJobReceipt as aQ, type VerifyResponse as aR, type X402ResponseBody as aS, type X402SelfRelayRpcFailureReason as aT, type X402TrackedChannel as aU, X402_DEFAULT_NETWORK as aV, X402_V1_VERSION as aW, X402_VERSION as aX, _testing as aY, buildPaymentRequiredV2 as aZ, buildPaymentRequirements as a_, type X402Receipt as aa, type TransactionalPayoutHook as ab, type CashuMeltCompleted as ac, type BuildPaymentRequirementsOpts as ad, type CapabilityDescriptor as ae, type CashuMode as af, type CreditDepositPayload as ag, type DrainReceipt as ah, type DrainReceiptEvent as ai, type ExactEvmPayload as aj, type ExactEvmPayloadAuthorization as ak, type FundingLot as al, type FundingMethod as am, type LotDebit as an, type LotDepletion as ao, type MppxServer as ap, NON_CHANNEL_BITCOIN_RAILS as aq, type NonChannelBitcoinRail as ar, type OutgoingMessage as as, type PaymentPayload as at, type PaymentPayloadV1 as au, type PaymentPayloadV2 as av, type PaymentRequiredV2 as aw, type PaymentRequirements as ax, type PaymentRequirementsV1 as ay, type PaymentRequirementsV2 as az, type ArtifactContent as b, type
|
|
6836
|
+
export { type PaymentRequired as $, type ApprovalContent as A, type SignedRequestDomain as B, type Currency as C, type DVMConfig as D, SignedRequestError as E, type SignedRequestFailure as F, type SignedRequestReplayStore as G, type SignedRequestSignOpts as H, type IncomingMessage as I, type JobRecord as J, type KVStore as K, type Logger as L, type SignedRequestStatementHeader as M, type SignedRequestVerifier as N, createSignedRequestVerifier as O, type PaymentContent as P, type QuoteConfig as Q, type ResolvedCreditConfig as R, type SDKJobContext as S, isZodSchema as T, UnsupportedCurrencyError as U, signedRequestStatementHeader as V, validateCurrency as W, type JsonValue as X, type FundingReceipt as Y, type ZodLike as Z, type JobReceipt as _, type DVMDescriptor as a, caip2ToX402Network as a$, type X402Version as a0, type MppxCredential as a1, type Message as a2, type MessageType as a3, type MppxChallenge as a4, X402_BATCH_SETTLEMENT_SCHEME as a5, X402_EXACT_SCHEME as a6, type X402Wallet as a7, type X402Config as a8, type X402ExactVersionSupport as a9, PayoutReporter as aA, PostgresTempoSessionStore as aB, RAIL_REFUNDABLE as aC, type ReceiptCredit as aD, type ReceiptOutcome as aE, type ReceiptPayment as aF, type ResourceInfo as aG, RevenueReporter as aH, SIGNED_ENVELOPE_FIELDS as aI, SIGNED_ENVELOPE_TYPES as aJ, type SettleResponse as aK, type StaleJobReapable as aL, StepCache as aM, type StepRecord as aN, type UnsignedDrainReceipt as aO, type UnsignedFundingReceipt as aP, type UnsignedJobReceipt as aQ, type VerifyResponse as aR, type X402ResponseBody as aS, type X402SelfRelayRpcFailureReason as aT, type X402TrackedChannel as aU, X402_DEFAULT_NETWORK as aV, X402_V1_VERSION as aW, X402_VERSION as aX, _testing as aY, buildPaymentRequiredV2 as aZ, buildPaymentRequirements as a_, type X402Receipt as aa, type TransactionalPayoutHook as ab, type CashuMeltCompleted as ac, type BuildPaymentRequirementsOpts as ad, type CapabilityDescriptor as ae, type CashuMode as af, type CreditDepositPayload as ag, type DrainReceipt as ah, type DrainReceiptEvent as ai, type ExactEvmPayload as aj, type ExactEvmPayloadAuthorization as ak, type FundingLot as al, type FundingMethod as am, type LotDebit as an, type LotDepletion as ao, type MppxServer as ap, NON_CHANNEL_BITCOIN_RAILS as aq, type NonChannelBitcoinRail as ar, type OutgoingMessage as as, type PaymentPayload as at, type PaymentPayloadV1 as au, type PaymentPayloadV2 as av, type PaymentRequiredV2 as aw, type PaymentRequirements as ax, type PaymentRequirementsV1 as ay, type PaymentRequirementsV2 as az, type ArtifactContent as b, type DrainMethod as b$, canonicaliseForSigning as b0, canonicalize as b1, chainIdFromCaip2 as b2, computeResultHash as b3, createDefaultReplayStore as b4, decodePayment as b5, decodePaymentRequiredHeader as b6, depleteLots as b7, encodePayment as b8, encodePaymentRequiredHeader as b9, verifyReceipt as bA, verifyWithFacilitator as bB, wrapMppx as bC, x402NetworkToCaip2 as bD, type CreditDrainEnqueue as bE, type DVMAuthScheme as bF, type CreditLedgerLike as bG, type X402RefundSettlementGate as bH, type CreditSnapshot as bI, type DrawResult as bJ, type X402SettlementStatus as bK, type X402UnresolvedRefund as bL, type GrownDrawResult as bM, type DrawResolution as bN, type FundingRecord as bO, type CreditInvoiceRecord as bP, type InvoiceSettlement as bQ, type BlockedInvoiceCursor as bR, type InvoiceReconciliation as bS, type InvoiceWriteOff as bT, type DrawRecord as bU, type StalePendingDrawCursor as bV, type TempoCreditLossEvidence as bW, type CreditLedgerQuerier as bX, type TempoCreditLoss as bY, type X402CreditLossEvidence as bZ, type X402CreditLoss as b_, encodeSettleResponseHeader as ba, exactEvmAuthorization as bb, fifoOrder as bc, inKindDrawMsats as bd, isArtifactMessage as be, isDrainReceipt as bf, isFundingReceipt as bg, isInKindDepletion as bh, isNonChannelBitcoinRail as bi, isPaymentRequestMessage as bj, isPromptMessage as bk, isSignedJobReceipt as bl, isStaleJobReapable as bm, lotOwedSats as bn, netOwedSats as bo, paymentRequiredV2FromV1 as bp, settleWithFacilitator as bq, signDrainReceipt as br, signFundingReceipt as bs, signReceipt as bt, usdcContractByCaip2 as bu, usdcContractFor as bv, usdcDomainNameFor as bw, usdcDomainVersionFor as bx, verifyDrainReceipt as by, verifyFundingReceipt as bz, type CancelContent as c, type X402PayoutObserver as c$, type DrainRequestResult as c0, type BitcoinDepositLiability as c1, type CreditDrainRecord as c2, type ChannelDrainCursor as c3, type DrainWriteOff as c4, type DrainReleaseResult as c5, type DrainFulfilment as c6, type DrainTransitionResult as c7, type StreamableJobStore as c8, type ReceiptIssuingStore as c9, type ReplayStoreBackend as cA, type RevenueSkippedNoRailPayload as cB, type RevenueSkippedNoRailReason as cC, type Secp256k1AuthOpts as cD, type X402ChannelStorageOpts as cE, type X402RelayLockHolder as cF, type X402RelaySubmissionLock as cG, X402RelaySubmissionLockError as cH, allocateDrawValue as cI, clientCompatibilityAttributes as cJ, clientCompatibilityMiddleware as cK, clientUpgradeRequired as cL, isStreamableJobStore as cM, parseClientCapabilities as cN, parseClientCompatibility as cO, parseDvmClient as cP, parseProtocolVersion as cQ, requireClientCompatibility as cR, secp256k1Auth as cS, signedRequestInput as cT, type CreditDepositEnqueue as cU, type TopUpCapUnenforcedReason as cV, type X402SettlementIntent as cW, type X402SettlementCursor as cX, type X402SettlementWriteOff as cY, type X402FacilitatorAuth as cZ, type X402BatchSettlementConfig as c_, type RequestIdClaim as ca, type RequestIdClaimResult as cb, type AppendOutgoingOptions as cc, type PaymentCreditDelta as cd, type VerifyAndCreditResult as ce, type JobCounters as cf, CLIENT_COMPATIBILITY_HEADERS as cg, type ClientCompatibility as ch, type ClientCompatibilityEnv as ci, type ClientCompatibilityGate as cj, type ClientCompatibilityRequirement as ck, type ClientSemVer as cl, type CreditFundingBasis as cm, type CreditInvoiceStatus as cn, CreditLedger as co, CreditLedgerError as cp, type CreditLedgerErrorCode as cq, type CreditLedgerErrorDetails as cr, type CreditLedgerPool as cs, type CreditStatus as ct, DRAIN_DELIVERY_RESERVE_SATS as cu, DVM_PROTOCOL_VERSION as cv, type DrainConflictReason as cw, type DrawRailValue as cx, type DrawStatus as cy, PostgresX402ChannelStorage as cz, type CanonicalEnvelope as d, type X402SettlementReconciliationReason as d0, type CreditDrawReleaseEnqueue as d1, type CreateSignedRequestVerifierOpts as e, type CreditConfig as f, type CreditView as g, DEFAULT_CREDIT_MAX as h, DEFAULT_CREDIT_MIN as i, DEFAULT_CREDIT_TTL_SECONDS as j, type DVMRouteContext as k, type InputType as l, InvalidCurrencyError as m, type JobStatus as n, type JobStore as o, type PaymentMethod as p, type PriceValue as q, type ProgressContent as r, type PromptOpts as s, type QuoteContext as t, type QuoteResult as u, type ResponseContent as v, type SDKPaymentRequestOpts as w, SIGNED_REQUEST_AUTH_ID as x, SIGNED_REQUEST_STATEMENT_VERSION as y, type SignedRequestAudience as z };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { af as CashuMode,
|
|
2
|
-
export {
|
|
1
|
+
import { af as CashuMode, bE as CreditDrainEnqueue, R as ResolvedCreditConfig, bF as DVMAuthScheme, B as SignedRequestDomain, bG as CreditLedgerLike, bH as X402RefundSettlementGate, bI as CreditSnapshot, bJ as DrawResult, bK as X402SettlementStatus, bL as X402UnresolvedRefund, bM as GrownDrawResult, bN as DrawResolution, bO as FundingRecord, Y as FundingReceipt, bP as CreditInvoiceRecord, bQ as InvoiceSettlement, bR as BlockedInvoiceCursor, bS as InvoiceReconciliation, bT as InvoiceWriteOff, bU as DrawRecord, bV as StalePendingDrawCursor, bW as TempoCreditLossEvidence, bX as CreditLedgerQuerier, bY as TempoCreditLoss, bZ as X402CreditLossEvidence, b_ as X402CreditLoss, b$ as DrainMethod, c0 as DrainRequestResult, c1 as BitcoinDepositLiability, al as FundingLot, c2 as CreditDrainRecord, c3 as ChannelDrainCursor, c4 as DrainWriteOff, c5 as DrainReleaseResult, c6 as DrainFulfilment, c7 as DrainTransitionResult, c8 as StreamableJobStore, c9 as ReceiptIssuingStore, J as JobRecord, ca as RequestIdClaim, cb as RequestIdClaimResult, _ as JobReceipt, as as OutgoingMessage, cc as AppendOutgoingOptions, cd as PaymentCreditDelta, ce as VerifyAndCreditResult, cf as JobCounters, a2 as Message, K as KVStore, G as SignedRequestReplayStore, Z as ZodLike, a as DVMDescriptor } from '../job-store-DxFqDPYq.js';
|
|
2
|
+
export { cg as CLIENT_COMPATIBILITY_HEADERS, d as CanonicalEnvelope, ch as ClientCompatibility, ci as ClientCompatibilityEnv, cj as ClientCompatibilityGate, ck as ClientCompatibilityRequirement, cl as ClientSemVer, e as CreateSignedRequestVerifierOpts, cm as CreditFundingBasis, cn as CreditInvoiceStatus, co as CreditLedger, cp as CreditLedgerError, cq as CreditLedgerErrorCode, cr as CreditLedgerErrorDetails, cs as CreditLedgerPool, ct as CreditStatus, cu as DRAIN_DELIVERY_RESERVE_SATS, cv as DVM_PROTOCOL_VERSION, cw as DrainConflictReason, cx as DrawRailValue, cy as DrawStatus, n as JobStatus, o as JobStore, cz as PostgresX402ChannelStorage, cA as ReplayStoreBackend, cB as RevenueSkippedNoRailPayload, cC as RevenueSkippedNoRailReason, x as SIGNED_REQUEST_AUTH_ID, y as SIGNED_REQUEST_STATEMENT_VERSION, cD as Secp256k1AuthOpts, z as SignedRequestAudience, E as SignedRequestError, F as SignedRequestFailure, H as SignedRequestSignOpts, M as SignedRequestStatementHeader, N as SignedRequestVerifier, cE as X402ChannelStorageOpts, cF as X402RelayLockHolder, cG as X402RelaySubmissionLock, cH as X402RelaySubmissionLockError, cI as allocateDrawValue, cJ as clientCompatibilityAttributes, cK as clientCompatibilityMiddleware, cL as clientUpgradeRequired, O as createSignedRequestVerifier, cM as isStreamableJobStore, cN as parseClientCapabilities, cO as parseClientCompatibility, cP as parseDvmClient, cQ as parseProtocolVersion, cR as requireClientCompatibility, cS as secp256k1Auth, cT as signedRequestInput, V as signedRequestStatementHeader } from '../job-store-DxFqDPYq.js';
|
|
3
3
|
import { Pool } from 'pg';
|
|
4
|
-
import { aE as CreditMenu, f as AppEnv, U as UpfrontPaymentOpts, p as PaymentInfo, aF as ReceiptIssuer, aG as LightningReceive, aH as TempoSettlementReadiness, aI as DVMHostOpts } from '../credit-menu-
|
|
5
|
-
export { aJ as BuildCreditMenuArgs, aK as BuilderIdentity, aL as CREDIT_ENVELOPE_KEYS, e as ConsumedCredentialStore, aM as CreateX402BatchSettlementServerOpts, aN as CreditEnvelope, aO as CreditEnvelopeError, aP as CreditFundCommitment, aQ as CreditTerms, aR as DEFAULT_INVOICE_TTL_SECONDS, aS as DVMHost, aT as JobManager, aU as JobManagerOpts, aV as LightningReceiveConfig, aW as MIN_INVOICE_TTL_SECONDS, aX as MemoryConsumedCredentialStore, aY as MemoryConsumedCredentialStoreOpts, aZ as MemoryProcessedPaymentStore, a_ as MemoryX402ExactSettlementStore, a$ as MountOpts, b0 as OwnerDisplay, b1 as PlatformReporterOpts, b2 as PostgresProcessedPaymentStore, b3 as PostgresX402ExactSettlementStore, b4 as PriceFiat, b5 as ProcessedPaymentQuerier, b6 as ProcessedPaymentRail, b7 as ProcessedPaymentRecord, b8 as ProcessedPaymentReplayError, b9 as ProcessedPaymentStore, ba as X402BatchAcceptance, bb as X402BatchFunding, bc as X402BatchRefusal, bd as X402BatchSettlementServer, be as X402ExactAcceptance, bf as X402ExactIntentConflictError, bg as X402ExactSettlementAttempt, bh as X402ExactSettlementChainEvidence, bi as X402ExactSettlementEffect, bj as X402ExactSettlementEvidenceMissingError, bk as X402ExactSettlementEvidenceReader, bl as X402ExactSettlementIntent, bm as X402ExactSettlementNotReadyError, bn as X402ExactSettlementServer, bo as X402ExactSettlementServerOpts, bp as X402ExactSettlementStatus, bq as X402ExactSettlementStore, br as X402SettlementChainEvidence, bs as X402SettlementEvidenceReader, bt as X402SettlementSubmissionError, bu as X402_BATCH_AUTO_SETTLEMENT, bv as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bw as X402_BATCH_SETTLEMENT_NETWORK, bx as attachCreditMenu, by as buildCreditMenu, bz as createDVMHost, bA as createX402BatchSettlementServer, bB as creditEnvelopeIgnoreFields, bC as drawSettlementRef, bD as extractCreditEnvelope, bE as fundingCommitment, bF as selectPrimaryCredit, bG as stripCreditEnvelope, bH as toCreditView } from '../credit-menu-
|
|
4
|
+
import { aE as CreditMenu, f as AppEnv, U as UpfrontPaymentOpts, p as PaymentInfo, aF as ReceiptIssuer, aG as LightningReceive, aH as TempoSettlementReadiness, aI as DVMHostOpts } from '../credit-menu-ClA1JyYW.js';
|
|
5
|
+
export { aJ as BuildCreditMenuArgs, aK as BuilderIdentity, aL as CREDIT_ENVELOPE_KEYS, e as ConsumedCredentialStore, aM as CreateX402BatchSettlementServerOpts, aN as CreditEnvelope, aO as CreditEnvelopeError, aP as CreditFundCommitment, aQ as CreditTerms, aR as DEFAULT_INVOICE_TTL_SECONDS, aS as DVMHost, aT as JobManager, aU as JobManagerOpts, aV as LightningReceiveConfig, aW as MIN_INVOICE_TTL_SECONDS, aX as MemoryConsumedCredentialStore, aY as MemoryConsumedCredentialStoreOpts, aZ as MemoryProcessedPaymentStore, a_ as MemoryX402ExactSettlementStore, a$ as MountOpts, b0 as OwnerDisplay, b1 as PlatformReporterOpts, b2 as PostgresProcessedPaymentStore, b3 as PostgresX402ExactSettlementStore, b4 as PriceFiat, b5 as ProcessedPaymentQuerier, b6 as ProcessedPaymentRail, b7 as ProcessedPaymentRecord, b8 as ProcessedPaymentReplayError, b9 as ProcessedPaymentStore, ba as X402BatchAcceptance, bb as X402BatchFunding, bc as X402BatchRefusal, bd as X402BatchSettlementServer, be as X402ExactAcceptance, bf as X402ExactIntentConflictError, bg as X402ExactSettlementAttempt, bh as X402ExactSettlementChainEvidence, bi as X402ExactSettlementEffect, bj as X402ExactSettlementEvidenceMissingError, bk as X402ExactSettlementEvidenceReader, bl as X402ExactSettlementIntent, bm as X402ExactSettlementNotReadyError, bn as X402ExactSettlementServer, bo as X402ExactSettlementServerOpts, bp as X402ExactSettlementStatus, bq as X402ExactSettlementStore, br as X402SettlementChainEvidence, bs as X402SettlementEvidenceReader, bt as X402SettlementSubmissionError, bu as X402_BATCH_AUTO_SETTLEMENT, bv as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bw as X402_BATCH_SETTLEMENT_NETWORK, bx as attachCreditMenu, by as buildCreditMenu, bz as createDVMHost, bA as createX402BatchSettlementServer, bB as creditEnvelopeIgnoreFields, bC as drawSettlementRef, bD as extractCreditEnvelope, bE as fundingCommitment, bF as selectPrimaryCredit, bG as stripCreditEnvelope, bH as toCreditView } from '../credit-menu-ClA1JyYW.js';
|
|
6
6
|
import { Context } from 'hono';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
import { F as FxFetcher } from '../fx-
|
|
8
|
+
import { F as FxFetcher } from '../fx-ptKVFOwq.js';
|
|
9
9
|
export { P as PinnedFetch, S as SSRFError, a as SSRFGuardOpts, b as SSRFReason, c as SSRFResolver, d as assertSafeUrl, e as createPinnedFetch } from '../ssrf-DbFkpDv0.js';
|
|
10
10
|
import '@cashu/cashu-ts';
|
|
11
11
|
import 'mppx';
|
package/dist/server/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
CreditEnvelopeError,
|
|
21
21
|
DEFAULT_LOCK_PUBKEY_GRACE_SECONDS,
|
|
22
22
|
DVM_PROTOCOL_VERSION,
|
|
23
|
+
HttpTransport,
|
|
23
24
|
JobManager,
|
|
24
25
|
MemoryConsumedCredentialStore,
|
|
25
26
|
MemoryX402ExactSettlementStore,
|
|
@@ -27,6 +28,7 @@ import {
|
|
|
27
28
|
NwcError,
|
|
28
29
|
PostgresX402ExactSettlementStore,
|
|
29
30
|
REQUEST_ID_FIELD,
|
|
31
|
+
SpanWriter,
|
|
30
32
|
X402ExactIntentConflictError,
|
|
31
33
|
X402ExactSettlementEvidenceMissingError,
|
|
32
34
|
X402ExactSettlementNotReadyError,
|
|
@@ -71,17 +73,17 @@ import {
|
|
|
71
73
|
unknownRouteNotFound,
|
|
72
74
|
validateX402Env,
|
|
73
75
|
withNwcPool
|
|
74
|
-
} from "../chunk-
|
|
76
|
+
} from "../chunk-ATQIII6K.js";
|
|
75
77
|
import {
|
|
76
78
|
X402_DEFAULT_FACILITATOR,
|
|
77
79
|
X402_DEFAULT_NETWORK,
|
|
78
80
|
assertSupportedX402Network,
|
|
79
81
|
x402NetworkToCaip2
|
|
80
|
-
} from "../chunk-
|
|
82
|
+
} from "../chunk-AAJNGQMC.js";
|
|
81
83
|
import {
|
|
82
84
|
IMPLICIT_CREDIT_TTL_MS,
|
|
83
85
|
resolveRpcOverride
|
|
84
|
-
} from "../chunk-
|
|
86
|
+
} from "../chunk-F2L6KIMD.js";
|
|
85
87
|
import {
|
|
86
88
|
MemoryCreditLedger
|
|
87
89
|
} from "../chunk-EXHBXA4U.js";
|
|
@@ -218,216 +220,6 @@ function isTestMintUrl(url) {
|
|
|
218
220
|
var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "0.0.0.0", "::1"]);
|
|
219
221
|
var TEST_MINT_HOSTS = /* @__PURE__ */ new Set(["testnut.cashu.space"]);
|
|
220
222
|
|
|
221
|
-
// src/observability/span-writer.ts
|
|
222
|
-
var noop = () => {
|
|
223
|
-
};
|
|
224
|
-
var MAX_BUFFERED_SPANS = 1e4;
|
|
225
|
-
var MAX_ROW_JSONB_BYTES = 64 * 1024;
|
|
226
|
-
var MAX_STRING_VALUE_BYTES = 4 * 1024;
|
|
227
|
-
var FLUSH_THRESHOLD = 1e3;
|
|
228
|
-
var MAX_BACKOFF_EXPONENT = 6;
|
|
229
|
-
var SpanWriter = class {
|
|
230
|
-
constructor(transport, flushIntervalMs = 1e4) {
|
|
231
|
-
this.transport = transport;
|
|
232
|
-
this.flushIntervalMs = flushIntervalMs;
|
|
233
|
-
}
|
|
234
|
-
transport;
|
|
235
|
-
flushIntervalMs;
|
|
236
|
-
buffer = [];
|
|
237
|
-
flushTimer = null;
|
|
238
|
-
flushing = false;
|
|
239
|
-
dropCount = 0;
|
|
240
|
-
truncatedSpanCount = 0;
|
|
241
|
-
consecutiveFailures = 0;
|
|
242
|
-
backoffTimer = null;
|
|
243
|
-
/** Enqueue a span row. Non-blocking — truncates oversize JSONB and appends to buffer. */
|
|
244
|
-
enqueue(row) {
|
|
245
|
-
const originalBytes = JSON.stringify({
|
|
246
|
-
attributes: row.attributes,
|
|
247
|
-
dimensions: row.dimensions
|
|
248
|
-
}).length;
|
|
249
|
-
if (originalBytes > MAX_ROW_JSONB_BYTES) {
|
|
250
|
-
row = this.truncateForSize(row, originalBytes);
|
|
251
|
-
}
|
|
252
|
-
if (this.buffer.length >= MAX_BUFFERED_SPANS) {
|
|
253
|
-
this.dropCount++;
|
|
254
|
-
if (this.dropCount === 1 || this.dropCount % 1e3 === 0) {
|
|
255
|
-
console.error(
|
|
256
|
-
JSON.stringify({
|
|
257
|
-
event: "span_buffer_drop",
|
|
258
|
-
reason: "buffer_full",
|
|
259
|
-
total_dropped: this.dropCount,
|
|
260
|
-
buffer_size: this.buffer.length
|
|
261
|
-
})
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
this.buffer.push(row);
|
|
267
|
-
if (this.buffer.length >= FLUSH_THRESHOLD && !this.flushing) {
|
|
268
|
-
void this.flush().catch(noop);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
/** Start periodic flush to the transport. */
|
|
272
|
-
startFlush() {
|
|
273
|
-
this.flushTimer = setInterval(() => {
|
|
274
|
-
void this.flush().catch(noop);
|
|
275
|
-
}, this.flushIntervalMs);
|
|
276
|
-
}
|
|
277
|
-
/** Stop periodic flush. */
|
|
278
|
-
stopFlush() {
|
|
279
|
-
if (this.flushTimer) {
|
|
280
|
-
clearInterval(this.flushTimer);
|
|
281
|
-
this.flushTimer = null;
|
|
282
|
-
}
|
|
283
|
-
if (this.backoffTimer) {
|
|
284
|
-
clearTimeout(this.backoffTimer);
|
|
285
|
-
this.backoffTimer = null;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
/** Flush buffered spans. Single-flight: concurrent calls exit early. */
|
|
289
|
-
async flush() {
|
|
290
|
-
if (this.flushing) return;
|
|
291
|
-
if (this.buffer.length === 0) return;
|
|
292
|
-
this.flushing = true;
|
|
293
|
-
const batch = this.buffer;
|
|
294
|
-
this.buffer = [];
|
|
295
|
-
try {
|
|
296
|
-
await this.transport.send(batch);
|
|
297
|
-
this.consecutiveFailures = 0;
|
|
298
|
-
} catch (err) {
|
|
299
|
-
this.consecutiveFailures++;
|
|
300
|
-
console.error(
|
|
301
|
-
JSON.stringify({
|
|
302
|
-
event: "span_flush_failed",
|
|
303
|
-
error: err instanceof Error ? err.message : String(err),
|
|
304
|
-
batch_size: batch.length,
|
|
305
|
-
consecutive_failures: this.consecutiveFailures
|
|
306
|
-
})
|
|
307
|
-
);
|
|
308
|
-
const room = MAX_BUFFERED_SPANS - this.buffer.length;
|
|
309
|
-
if (room > 0) {
|
|
310
|
-
this.buffer.unshift(...batch.slice(0, room));
|
|
311
|
-
}
|
|
312
|
-
if (this.consecutiveFailures > 1) {
|
|
313
|
-
const exponent = Math.min(this.consecutiveFailures - 1, MAX_BACKOFF_EXPONENT);
|
|
314
|
-
const backoffMs = this.flushIntervalMs * Math.pow(2, exponent);
|
|
315
|
-
this.stopFlush();
|
|
316
|
-
this.backoffTimer = setTimeout(() => {
|
|
317
|
-
this.backoffTimer = null;
|
|
318
|
-
this.startFlush();
|
|
319
|
-
}, backoffMs);
|
|
320
|
-
}
|
|
321
|
-
} finally {
|
|
322
|
-
this.flushing = false;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
/** Flush remaining spans on shutdown. */
|
|
326
|
-
async shutdown() {
|
|
327
|
-
this.stopFlush();
|
|
328
|
-
await this.flush();
|
|
329
|
-
}
|
|
330
|
-
/** Number of spans dropped due to buffer overflow. */
|
|
331
|
-
getDropCount() {
|
|
332
|
-
return this.dropCount;
|
|
333
|
-
}
|
|
334
|
-
/** Number of spans truncated due to oversized JSONB payload. */
|
|
335
|
-
getTruncatedSpanCount() {
|
|
336
|
-
return this.truncatedSpanCount;
|
|
337
|
-
}
|
|
338
|
-
/** Current buffer size. */
|
|
339
|
-
getBufferSize() {
|
|
340
|
-
return this.buffer.length;
|
|
341
|
-
}
|
|
342
|
-
/** Consecutive flush failures; resets to 0 on the next successful flush. */
|
|
343
|
-
getConsecutiveFailures() {
|
|
344
|
-
return this.consecutiveFailures;
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Two-pass truncation: cap individual string values, then fall back to
|
|
348
|
-
* wholesale attribute replacement if the blob is still over the limit.
|
|
349
|
-
*/
|
|
350
|
-
truncateForSize(row, originalBytes) {
|
|
351
|
-
const truncatedAttrs = {};
|
|
352
|
-
for (const [key, value] of Object.entries(row.attributes)) {
|
|
353
|
-
if (typeof value === "string" && value.length > MAX_STRING_VALUE_BYTES) {
|
|
354
|
-
const omitted = value.length - MAX_STRING_VALUE_BYTES;
|
|
355
|
-
truncatedAttrs[key] = `${value.slice(0, MAX_STRING_VALUE_BYTES)}\u2026 [truncated, ${omitted} chars omitted]`;
|
|
356
|
-
} else {
|
|
357
|
-
truncatedAttrs[key] = value;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
const afterStringPass = JSON.stringify({
|
|
361
|
-
attributes: truncatedAttrs,
|
|
362
|
-
dimensions: row.dimensions
|
|
363
|
-
}).length;
|
|
364
|
-
let mode;
|
|
365
|
-
if (afterStringPass <= MAX_ROW_JSONB_BYTES) {
|
|
366
|
-
row = { ...row, attributes: truncatedAttrs };
|
|
367
|
-
mode = "string_pass";
|
|
368
|
-
} else {
|
|
369
|
-
const dimSize = JSON.stringify(row.dimensions).length;
|
|
370
|
-
if (dimSize > MAX_ROW_JSONB_BYTES) {
|
|
371
|
-
console.error(
|
|
372
|
-
JSON.stringify({
|
|
373
|
-
event: "span_dimension_oversized",
|
|
374
|
-
name: row.name,
|
|
375
|
-
dataset: row.dataset,
|
|
376
|
-
dimension_bytes: dimSize
|
|
377
|
-
})
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
row = {
|
|
381
|
-
...row,
|
|
382
|
-
attributes: {
|
|
383
|
-
_truncated: true,
|
|
384
|
-
original_bytes: originalBytes,
|
|
385
|
-
original_keys: Object.keys(row.attributes).sort()
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
mode = "wholesale_fallback";
|
|
389
|
-
}
|
|
390
|
-
this.truncatedSpanCount++;
|
|
391
|
-
if (this.truncatedSpanCount === 1 || this.truncatedSpanCount % 100 === 0) {
|
|
392
|
-
console.error(
|
|
393
|
-
JSON.stringify({
|
|
394
|
-
event: "span_truncated",
|
|
395
|
-
name: row.name,
|
|
396
|
-
dataset: row.dataset,
|
|
397
|
-
original_bytes: originalBytes,
|
|
398
|
-
after_string_pass_bytes: afterStringPass,
|
|
399
|
-
mode,
|
|
400
|
-
total_truncated: this.truncatedSpanCount
|
|
401
|
-
})
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
return row;
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
var HttpTransport = class {
|
|
408
|
-
constructor(platformUrl, serviceToken) {
|
|
409
|
-
this.platformUrl = platformUrl;
|
|
410
|
-
this.serviceToken = serviceToken;
|
|
411
|
-
}
|
|
412
|
-
platformUrl;
|
|
413
|
-
serviceToken;
|
|
414
|
-
async send(rows) {
|
|
415
|
-
if (rows.length === 0) return;
|
|
416
|
-
const resp = await fetch(`${this.platformUrl.replace(/\/$/, "")}/_internal/spans`, {
|
|
417
|
-
method: "POST",
|
|
418
|
-
headers: {
|
|
419
|
-
"Content-Type": "application/json",
|
|
420
|
-
Authorization: `Bearer ${this.serviceToken}`
|
|
421
|
-
},
|
|
422
|
-
body: JSON.stringify({ spans: rows })
|
|
423
|
-
});
|
|
424
|
-
if (!resp.ok) {
|
|
425
|
-
const text = await resp.text().catch(() => "");
|
|
426
|
-
throw new Error(`Span ingestion failed: ${resp.status} ${text}`);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
|
|
431
223
|
// src/sdk/server/lightning-rail-health.ts
|
|
432
224
|
var LIGHTNING_RAIL_HEALTH_REFRESH_TTL_MS = 5 * 60 * 1e3;
|
|
433
225
|
var LIGHTNING_RAIL_HEALTH_MAX_STALENESS_MS = 3 * 60 * 60 * 1e3;
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c8 as StreamableJobStore, c9 as ReceiptIssuingStore, J as JobRecord, ca as RequestIdClaim, cb as RequestIdClaimResult, _ as JobReceipt, as as OutgoingMessage, cc as AppendOutgoingOptions, cd as PaymentCreditDelta, ce as VerifyAndCreditResult, cf as JobCounters, a2 as Message, a3 as MessageType, K as KVStore, L as Logger, v as ResponseContent, P as PaymentContent, S as SDKJobContext } from '../job-store-DxFqDPYq.js';
|
|
2
2
|
import '@cashu/cashu-ts';
|
|
3
3
|
import 'mppx';
|
|
4
4
|
import '@x402/core/server';
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
tryX402Payment,
|
|
12
12
|
verifyX402Payment,
|
|
13
13
|
x402WrongAssetHint
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-AB3L6B52.js";
|
|
15
|
+
import "./chunk-4KB3LTOS.js";
|
|
16
16
|
import {
|
|
17
17
|
X402_DEFAULT_FACILITATOR,
|
|
18
18
|
X402_DEFAULT_NETWORK,
|
|
@@ -37,8 +37,8 @@ import {
|
|
|
37
37
|
x402NetworkListForCopy,
|
|
38
38
|
x402NetworkToCaip2,
|
|
39
39
|
x402SupportedNetworksHint
|
|
40
|
-
} from "./chunk-
|
|
41
|
-
import "./chunk-
|
|
40
|
+
} from "./chunk-AAJNGQMC.js";
|
|
41
|
+
import "./chunk-F2L6KIMD.js";
|
|
42
42
|
import "./chunk-66HGCPBU.js";
|
|
43
43
|
import "./chunk-FUJ36YDV.js";
|
|
44
44
|
import "./chunk-AT6V3SY7.js";
|